×

Subscribe to newsletter

subscribe to our weekly newsletter to get notified with latest story and article Subscribe now!




PLC BLOG | B&R Automation | Counter | B&R automation studio Counter Function Blocks Programming | CTU | CTD | CTUD
Share on Facebook Share On Twitter Share on LinkedIn Share on Whatsapp


B&R automation studio Counter Function Blocks Programming | CTU | CTD | CTUD

Counter Instructions Use To Counts Input Bit Of Counter by Increment Or Decrement By 1 of counter value, When Input Bit Of Counter Changes from True to false. increments and decrements of counter depend on type of counter instruction if we use Up Counters then counter increments counter value when input bit change from false to true. Counter Input Bit may be Pulses, Events, Boolean condition. in B&R automation studio There are three general counters function block Upward counter(CTU),Downward counter(CTD) and Upward/Downward counter. Counters Are Used Where Something Counts

How To Add Counter in B&R Automation Studio

Counters Are Function Block, To Insert Counters Function Block In Your Project Select Function Block From Instructions Menu then Select External Library, and select any counter from menu and add to your project.

How To Add Counter in B&R Automation Studio

How to Declare Counter Instance type B&R Automation Studio

All Counters Functions Block Have Instance type. Instance define is important for function block. Declaration Of Instance Name May Be Local Or Global, open any variable table where you want to declare counter, then right click and select add variable then first enter name of counter then in a type click to browse button and then select function block from category and select counter, or you can directly enter Instance type. Upward counter Instance type is CTU, for Downward counter Instance type is CTD and for Upward/Downward counter Instance type is CTUD. in a below image all three counter define with instance name.

How to Declare Counter Instance type B&R Automation Studio

B&R Automation Studio Downward counter CTD Counter Instruction

Downward counter decrements its counter value by 1 every time its input goes from false to true (positive edge). following is parameter of Downward counter CTD counter:
    Input Parameter
  • CD counter input bit when this bit changes from false to true (rising edge) counter value decrement by 1. data type is bool
  • LOAD if load bit is set to true then preset value(PV) move to Counter value (CV).data type bool
  • PV preset value or counter start value, data type is UINT.
  • Output Parameter
  • Q output of counter it set to true if the counter value equals to zero.
  • CV it is counter value, rising edge of CD counter value decrement by 1. data type is UINT

B&R Automation Studio Downward counter CTD Counter Instruction

above is an example of B&R Automation Studio Downward counter CTD Counter Instruction, initially counter value (CV) is zero, when load input is set to true then current value initialized with the preset value (PV). rising edge of counter input bit (CD) decrement counter value (CV) by 1 until to reach counter value to zero if the counter value is zero then counter output(Q) set true. Counter value(CV) not change if load input is set to true and counter input bit change from false to true, for decrement counter value (CV) set load input false after transfer preset value to current value.


B&R Automation Studio Upward counter (CTU) Instruction

Upward counter (CTU) Instruction increments counter value by one every time its input goes from off to on (positive edge).following is parameter of Downward counter CTD counter:
    Input Parameter
  • CU counter input bit, when this bit changes from false to true (rising edge) counter value increments by 1. data type is bool
  • Reset reset counter value(CV) to zero
  • PV preset value or counter start value, data type is UINT.
  • Output Parameter
  • Q output of counter it set to true if the counter value equals to greater then preset value(PV).
  • CV it is counter value, rising edge of CU counter value increments by 1. data type is UINT

B&R Automation Studio Upward counter (CTU) Instruction

above is the example of B&R Automation Studio Upward counter (CTU) Instruction initially counter value is zero, if the counter Up input(CU) change from false to true then counter value increments by 1 until to reach preset value when current value is greater then or equal to preset value counter output (Q) is set to true. reset input reset the counter output parameter. if the counter current value reached to preset value and reset bit is false then upward counter counts up to 32766 every time its input goes from false to true. Further positive edges to CU are ignored as soon as the CV value is greater then or equal to 32766


B&R Automation Studio Upward or Downward counter (CTUD) Instruction

Upward or Downward counter (CTUD) Instruction work either as upward counter or downward counter, selection of counter operation is depend on counter selection input bit. if the counter down(CD) bit set to true then CTUD work as downward counter if the counter UP bit set to true (CU) then counter work as upward counter. Following is parameter of Upward or Downward counter (CTUD)
    Input Parameter
  • CU counter UP input bit, when this bit changes from false to true (rising edge) counter value increments by 1. data type is bool
  • CD counter down input bit when this bit changes from false to true (rising edge) counter value decrement by 1. data type is bool
  • Reset reset counter value(CV) to zero
  • LOAD if load bit is set to true then preset value(PV) move to Counter value (CV).data type bool
  • PV preset value or counter start value, data type is UINT.
  • Output Parameter
  • QU counter up output of counter it set to true if the counter value equals to greater then preset value(PV).
  • QD counter down output of counter it set to true if the counter value equals to zero.
  • CV it is counter value, rising edge of CU counter value increments or decrement by 1. data type is UINT

B&R Automation Studio Upward or Downward counter (CTUD) Instruction

above is the example of B&R Automation Studio Upward or Downward counter (CTUD) Instruction if the counter Up input bit change from false to true then counter value increments by 1, when the counter value (CV) is equal to preset value then counter up output(QU) is set to true. if the counter current load input is set to true then preset value (PV) transfer to current value. when current value is initialized with preset value and counter down input bit(CD) changes from false to true then counter current value decrement by 1.if the counter value equals to zero then counter down output is set to true. all working of this counter is same as above counter.


Share on Facebook Share On Twitter Share on LinkedIn Share on Whatsapp


Suggested Post


 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

comment