Counter Logic Commands
Overview
The custom logic editor uses the following counter logic commands:
-
COUNTER -
COUNTER_NV
COUNTER
The COUNTER command:
-
Increments or decrements a count value
-
Provides a method for setting the count value to a preset value
-
Indicates when the count value equals 0
-
Indicates the relationship between the count value and the preset value - equal to, greater than or less than
-
Saves the increment, decrement and set status from the previous scan
|
Arguments |
Representation |
|---|---|
|
3 |
|
|
Input Argument |
Type |
Range/Bit |
Description |
|---|---|---|---|
|
|
|
0–65,535 |
Counter preset value |
|
|
|
Bit4 |
Increments the counter current value on a rising edge. Counter current value shall roll over from 0 to 65,535. |
|
Bit5 |
Decrements the counter current value on a falling edge. Counter current value shall roll over from 65,535 to 0. |
||
|
Bit6 |
Sets the current counter value to the preset value on a rising edge |
|
Output Argument |
Type |
Range/Bit |
Description |
|---|---|---|---|
|
|
|
0–65,535 |
Counter current value |
|
|
|
Bit0 |
The counter current value is 0: |
|
Bit1 |
The counter current value is lower
than the preset value: |
||
|
Bit2 |
The counter current value is equal
to the preset value: |
||
|
Bit3 |
The counter current value is greater
than the preset value: |
||
|
Bit7 |
|
||
|
Bit8 |
|
||
|
Bit9 |
|
COUNTER_NV
The COUNTER_NV command:
-
Increments or decrements a count value
-
Provides a method for setting the count value to a preset value
-
Indicates when the count value equals 0
-
Indicates the relationship between the count value and the preset value - equal to, greater than or less than
-
Saves the increment, decrement and set status from the previous scan
Use the COUNTER_NV command,
instead of the COUNTER command, to
retain the count during a power cycle.
|
Arguments |
Representation |
|---|---|
|
3 |
|
|
Input Argument |
Type |
Range/Bit |
Description |
|---|---|---|---|
|
|
|
0–65,535 |
Counter preset value |
|
|
|
Bit4 |
Increments the counter current value on a rising edge. Counter current value shall roll over from 0 to 65,535. |
|
Bit5 |
Decrements the counter current value on a falling edge. Counter current value shall roll over from 65,535 to 0. |
||
|
Bit6 |
Sets the current counter value to the preset value on a rising edge |
|
Output Argument |
Type |
Range/Bit |
Description |
|---|---|---|---|
|
|
|
0–65,535 |
Counter current value |
|
|
|
Bit0 |
The counter current value is 0: |
|
Bit1 |
The counter current value is lower
than the preset value: |
||
|
Bit2 |
The counter current value is equal
to the preset value: |
||
|
Bit3 |
The counter current value is greater
than the preset value: |
||
|
Bit7 |
|
||
|
Bit8 |
|
||
|
Bit9 |
|