Deca23
Hello! 
I am currently working on a ladder logic code that aims to verify traffic lights duration. Code will be uploaded to Arduino and then Arduino will receive input signals from PLC station. The code needs to verify that each light is turned ON for specific time.
For example, I have 3 lights, green, yellow and red. Green should be turned on for 8 secs, yellow 4 secs and red 12 secs.
This is how it works so far: 
[203128%2F8137206%2Fmceclip0]
Lights will trigger sequences, sequences will enable timers. As we can see, green light triggers sequence 1 that enables TON0.
This will only verify if green light is turned on for 7.9s or more. But, I would like to know if there is a way to verify if it was less than the time required, or if it goes more, trigger bad verification. 
I was trying to use ElapsedTime1 time as if it stores the value, but when timer stops receiving input, the value is lost.
Please let me know if there is any tools that I might use for what I want. Thanks!
 
Reply 0 0
thiagoralves
I’m not sure if that will work, but what if you connect sequence1 to the EN pin of the timer  (you will have to double click the block and enable execution control) instead of the IN pin? Then the value of ET will hold while EN is off (I guess). Other alternative would be to use a MOVE block to move the value to another variable that will hold it even while the timer is off.
Reply 0 0
Deca23
Hi Thiago!
Thanks for your feedback. It did work. But I have to use the same input for both EN and IN pins in order to both receive input and store the value of input being ON. Hopefully this is will not affect how the code performs.
[203128%2F8137514%2Fmceclip0]
As we can see in the picture, ElapsedTime stored a value of 3 secs. Which what I was looking for.
Still need to try it out on PLC to Arduino set-up and see if code runs properly. But thanks a lot for your help!
Reply 0 0
Deca23
Hi @thiagoralves. I am still working on this project. But when I try to run a simulation, I only got this on the Console window: 
[203128%2F8139805%2Fmceclip0]
[203128%2F8139806%2Fmceclip0]
And I am not able to run anything. 
Please let me know if you know something about this. I have tried closing and opening the software, as well as re-starting my computer but nothing works. 
Other codes do work. What's weird is that this is the second version of Traffic Light 1 code (which lets me run simulation), which is a shorter code than the one that I am trying right now, but essentially it follows same structure.
Reply 0 0
thiagoralves
It looks like the compiler got stuck into an infinite loop somewhere. This is hard to debug. Try making a copy of your project and then start removing some things you may think should be causing this until it compiles. Then you will know what section is causing the loop
Reply 0 0
Reply