Anyone know how to use comparator and timer to set up a pulsing frequency?
I've been using two timers to do this but im trying to cut down on my code.
On the first rung, a single timer that resets itself.
On the second rung, a "Less Than" comparison that controls the output pulse. One value in the comparison will be the timer's accumulated value. If you want a square wave pulse, the other comparison value will be half the timer's preset.
---[/]---[t1]--
T1 10
--(cmp)----(out)
T1>5
Was this what you meant? I got it to work, but i'm curious if I did it correctly. I know you can do it several ways.The TMR instruction resets when the logic preceding it evaluates as false, so use a normally closed contact addressed to the .DN bit of the timer.
To have the output on for one second then off for one second your preset for T4:0 needs to be 2000 instead of 1000.
I do this with two rungs and four instructions.