Ring Counter Maximum Value Example
Ring Counter Maximum Value Example
The following example uses 1 Phase 2 Multiplication (Low Active) and Ring Counter. Then, the maximum value of Ring Counter (50,100,150) is modified to repeat the incremental count.
Wiring Diagram
The wiring diagram is the same as that of 1.6.1 ‘Linear Counter Example.’
High Speed Counter Program Configuration
Configure ‘M100’ for Start Address (You can enter a desired address), Channel as ‘1’
Check [Enable Count] for the Channel Configuration.
Select ‘Ring Counter’ for the Count Mode and ‘1 Phase 2 Multiplication (Low Active)’ for the Input Pulse Type.
Enter ‘50’ for the Ring Counter Maximum Value.
Write a Scan Program
Write the scan program as shown below.
Enable Ring Counter Low Active decreasing count signal. *F92: 0.2 seconds
It configures an initial value of the memory.
F12 (Scan On and Off): Flags used to set up the initial value of the memory
MOV 50 M170: Move the value of 50 to the memory M170 (Ring Counter Max. Value)
SET M500, 501, 502: Set the 0, 1st, 2nd Bit of the M memory device 50 (Logic 1)
The value of M01 will be 1 (turned ON/SET) when the Ring Counter Value (M310) is bigger than 25, Carry occurs (M300) and M500 is set.
When the value of M01 is 1 (SET), the maximum value of the Ring Counter (M170) will be 100. RESET M300 (Carry) and M500 (Logic 0)
The value of M02 will be 1 (SET) when the Ring Counter maximum value is less than 50, Carry occurs (M300) and M500 is RESET.
When the value of M02 is 1 (SET), the maximum value of the Ring Counter (M170) will be 150. RESET M300 (Carry) and M501 (Logic 0)
The maximum value of the Ring Counter will be 50 when the Ring Counter value is 0 and M500 and M501 are RESET. SET M500 and M501. RESET M300.
Check the operation
After counting from 0 to 50 in the Ring Count, the maximum value will be changed to 100 and the Ring Count restarts from 0.
After counting from 0 to 100 in the Ring Count, the maximum value will be changed to 150 and the Ring Count restarts from 0.
It will repeat the previous two steps (1 and 2).