Hey guys, I'm trying to build a basic counter on an AB Micro 850. I want it to count from 0 to 3, and then reset it back to 0 and repeat the process forever. The counter should increment once roughly once every 230ms.
The image below is how it's implemented now:
From my understanding, this setup should work, assuming that fast_flash has a rising edge every 230ms. Once the counter reaches 4, reset will be set to TRUE. The next time this block is evaluated, it will see that reset is true and set the counter back to zero. I don't see any issues with this, but if anyone sees any problems it would be appreciated.
My real concern is generating the pulses to drive the counter. I can't find any elegant way to generate periodic pulses on the Micro850, so I was hoping that someone could give me some advice. This is how I have it now:
I pretty much have two timers, one for each of the on/off durations, which cause a chain of events that make them start/reset each other forever. This seems extremely convoluted to me, and I'm not really confident that this is a dependable setup.
The reason I'm asking this is that when I run this program, everything works fine...for a while. When I did short-term testing of the program (less than a few hours) I never ran into problems, but after I left the PLC running full-time for a few days, I noticed a problem that can only really be explained by the counter not working. I'm not sure if it's due to the counter being constantly reset, the counter running towards an overflow or the square-wave driving the counter falling out of sync and causing it to freeze the counter.
I'm not sure what could be causing this problem, so I was hoping that someone could look at my PLC functions and see if there's a better way to implement the counter, or if I'm doing something that might lead to problems.
The image below is how it's implemented now:
From my understanding, this setup should work, assuming that fast_flash has a rising edge every 230ms. Once the counter reaches 4, reset will be set to TRUE. The next time this block is evaluated, it will see that reset is true and set the counter back to zero. I don't see any issues with this, but if anyone sees any problems it would be appreciated.
My real concern is generating the pulses to drive the counter. I can't find any elegant way to generate periodic pulses on the Micro850, so I was hoping that someone could give me some advice. This is how I have it now:
I pretty much have two timers, one for each of the on/off durations, which cause a chain of events that make them start/reset each other forever. This seems extremely convoluted to me, and I'm not really confident that this is a dependable setup.
The reason I'm asking this is that when I run this program, everything works fine...for a while. When I did short-term testing of the program (less than a few hours) I never ran into problems, but after I left the PLC running full-time for a few days, I noticed a problem that can only really be explained by the counter not working. I'm not sure if it's due to the counter being constantly reset, the counter running towards an overflow or the square-wave driving the counter falling out of sync and causing it to freeze the counter.
I'm not sure what could be causing this problem, so I was hoping that someone could look at my PLC functions and see if there's a better way to implement the counter, or if I'm doing something that might lead to problems.