CTReset Statement

Resets the counter value of the specified input counter and enables the input to be a counter input.

Syntax
CTReset(bitNumber)

Parameters

bitNumber
Number of the input bit set as a counter. This must be an integer expression representing a valid input bit. Only 16 counters can be active at the same time.

Description
CTReset works with the CTR function to allow inputs to be used as counters. CTReset sets the specified input bit as a counter and then starts the counter. If the specified input is already used as a counter, it is reset and started again.

Notes


  • Turning Off Power and Its Effect on Counters

    Turning off main power releases all counters.

  • Using the Ctr Function

    Use the Ctr Function to retrieve current Hardware Input counter values.


See Also
Ctr

CTReset Statement Example
The following example shows a sample of code which could be used to get a hardware input counter value.

CTReset 3  'Reset Counter 3 to 0
On 0       'Turn an output switch on
Wait Ctr(3) >= 5
Off 0      'When 5 input cycles are counted for Input 3 turn switch off (output 0 off)