Forum

S7-1200 bit set at ...
 
Notifications
Clear all

S7-1200 bit set at the end of OB1 is seen one cycle late at the top, trace shows the lag

4 Posts
3 Users
0 Reactions
5 Views
(@annaz)
New Member
Joined: 8 months ago
Posts: 0
Topic starter   [#94]

Hello all,

Bench rig, CPU 1214C, TIA V17, learning about cycle time with a trace. OB1 calls FC_Sequence, which uses a bit Part_Present to start a small timer and an output, and FC_Sensors, which sets Part_Present from the input I0.0.

The trace shows the output reacting one cycle after the input goes on, about 2 to 3 ms later, every single time. I was expecting it in the same cycle.

I moved both calls out of OB1 into OB30 at 1 ms, same order, thinking faster would sort it, and the lag got smaller in ms but it's still one cycle behind. A different input does exactly the same thing.

Is this normal? Could anyone explain why it happens, I'd rather understand it than just make it go away.


Advertisement

   
Quote
(@sanjay12)
New Member
Joined: 1 year ago
Posts: 0
 

V17, noted. Which order are the two calls in OB1, network 1 and network 2? Post the network list, I think I know before you answer.



   
ReplyQuote
(@annaz)
New Member
Joined: 8 months ago
Posts: 0
Topic starter  

Network 1: CALL FC_Sequence. Network 2: CALL FC_Sensors. Sensors last, because I wrote it last. Screenshot of OB1 attached.



   
ReplyQuote
(@sergio74)
New Member
Joined: 2 years ago
Posts: 0
 

There's your cycle. OB1 runs top to bottom, once per cycle. Network 1 reads Part_Present as the previous cycle left it. Network 2 then sets it. The new value waits until the next cycle reaches network 1 again. Producer after consumer, one cycle of delay, every time, on every PLC ever made, on the 300 with OB1 and on a Logix with rung order.

Swap them. FC_Sensors in network 1, FC_Sequence in network 2, and the delay's gone.

OB30 at 1 ms didn't fix it because the order inside was the same, it only made the cycle shorter, so one cycle of lag got shorter with it. There's a writeup on the cycle here: https://plctr.com/understanding-plc-scan-time-and-cycle-time/



   
ReplyQuote
Share: