10/9/2012 5:30 PM | |
Posts: 28 Rating: (1) |
Hi all, I have attached a test program I was working with since our timers seem to be screwing up. OB1 basically calls an FC that calls three timer-based FCs, which I have simplified the logic by enabling and disabling with marker bits. The idea is to have pulse bits representing one second (IEC timer in PLC Misc. sent to all other FCs). After a few pulses, an "alarm" goes high unless it is reset. Obviously I could use an IEC timer every time instead, but limitations in the design prohibit me from adding more IEC timers. Now, with just one FC timer, the program runs fine; the counter will increment each second until the bit is reset. However, when I add the other two FC timers, I get two problems: 1. None of the counters will even run until the last FC's memory bit is activated, but then all three run simultaneously. (That is, only M0.7 works and causes all FC timers to run in unison.) 2. The watch table gave me strange numbers. I turn on the simulator one time and I get a value of 257. The next time I try I get 15797. The values do not change as I run the timers. I want to say that maybe a variable is being rewritten, but I have three distinct timer variables from the UDT entering each FC, and the rest of the values are temps or unique marker bits. (I am assuming temps don't carry over between nested FCs) Then again, I don't see how the FCs all run or stop depending on the marker bit for only the last FC. Any help would be appreciated. I am probably missing something huge but I can't see it thus far. Thanks in advance. AttachmentC:\Users\csaharkh\Desktop\PLC programs\P13 Test Lab CJS 1_with_multi_timers.zip (226 Downloads) |
10/9/2012 7:06 PM | |
Posts: 28 Rating: (1) |
I have attached a few photos to demonstrate the strtucture of my program. The IEC timer is always running in that every x amount of time, the timer stops and starts again, generating the bit. This is all in a separate, process independent FC. The FC "timer" blocks simply read for the pulse bit from that FC, which is coupled with process information (simplified to a marker bit for testing purposes) and acts as a TON without the need for more timers. In other words, the time for the three FCs is just adding up x many one-second pulses toestablish a y secondmakshift timer, and is reset by a "move 0" instruction. Also, the logic for the counters are exactly the same between the three different FCs except that the starting marker bits are different. Hope that helps, AttachmentC:\Users\csaharkh\Desktop\Actual_Timers.zip (279 Downloads) |
Follow us on