Skip to main content

Reply to "PLC Project for model railroad layout"

mikeexplorer posted:

....I found that you cannot have loops in ladder logic, and when I tried running this, the PLC would fault out for a watchdog timer.

Well, you can loop but if you're trying to build a do loop or For-Nxt (like you would in computer code) yes, you can and will overrun the watchdog timer. What you may want to look at is indexed addressing. 

Say you want to build what amounts to "5" loops. Start first by programming a free running timer that counts 1-5 and then resets. This can be done with the CTU instruction, or ADD. You then take the accumulator register of the counter and use that as the WORD value in your binary address. The /xx bit extension remains unchanged.

Another way to approach this is already illustrated in your image 1119171635  above. Using MUL and EQU instructions, scan "1" process bit one logic, MUL by "2". Scan "2" process bit two logic, MUL by "2 and so forth. You use 16 scans to execute your complete logic.

OGR Publishing, Inc., 1310 Eastside Centre Ct, Suite 6, Mountain Home, AR 72653
800-980-OGRR (6477)
www.ogaugerr.com

×
×
×
×
×