Visiting an old friend.

vishal-s

Member
Join Date
May 2003
Location
Mumbai.
Posts
32
Consider the following code written on an S7 plc.
[attachment]
There is an inherent error in this little program. Sometimes the program works fine but more often it won't. A couple of months back when I was still learning Ladder programming, I was bothered with this problem. However, instead of reasoning I found a default path. I just replaced the T32 contact in rung 3 by "compare T32 with 1999". :D

Recently, when debugging a program I encountered a similar problem. This time, with a better understanding of PLCs, I decided to act like an engineer and came up with following solution:
1. swap network 2 and network 3.
2. If for some reason network 3 must follow network 2 utoh in network4 use T32 to set a bit (say, M0.0) and in network 2 replace Q0.0 with this bit.

Any more ideas?
 
vishal-s said:
Sometimes the program works fine but more often it won't.

Define "fine"... :confused:

If the 'problem' is that output Q0.1 sometimes doesn't latch, it's because input I0.0 happens to be ON when timer T32 times out. Notice that T32 can time out whether or not I0.0 is ON, and it's 'done' bit will only be ON for 1 scan. Therefore, Q0.1 only gets one chance to latch. If I0.0 is ON during that 'one chance', it won't latch.

I won't offer a workaround, because I don't know what the intended function of this program is. IOW, what do you WANT to happen?... :confused:

beerchug

-Eric
 
Details!

The problem indeed is that Q0.1 does not latch but it has nothing to do with I0.0. The program is only a demonstrative one and is not a part of any practical program. However, I've verified it on an S7-200 trainer kit. Think of I0.0 as a momentary switch, on only for a few milliseconds. The probability that I0.0 'll be on when timer T32 times out is almost nill. Still Q0.1 won't latch and that is more often than sometimes ( the probability is around 50%).

Whether Q0.1 would latch or not depends on when the timer times out. If T32 times out somewhere between network 1 and network 3, Q0.1 is latched. However, if the T32 times out after network 3 then in the next scan cycle it first causes Q0.0 to unlatch which in turn resets the timer in network 2. And so, when the PLC comes to network 3 T32 is false and consequently Q0.1 does not latch.

I hope I am not missing any details this time.
 
Last edited:
Yeah, what Ron said....

But I think you'd also want to stick network 3 ahead of the other two so it has a chance to see the timer 'done' bit before it goes away.

I think a better solution would be to make the timer 'done' bit turn on a separate bit and let THAT bit clear the Q0.0 latch (thereby resetting the timer). IOW, create a bit named "timer done" and use that in place of your existing T32 contacts.

beerchug

-Eric
 

Similar Topics

First i would like to say that this is a grat site. I was viewing the thread on the Dual Compressor Simulation for Logixpro. I have run 150 mph...
Replies
0
Views
3,518
This is admittedly a pretty obscure problem, but maybe someone else has run into it, or at least something similar. For reasons I won't get into...
Replies
3
Views
133
Does Rockwell still offer reset codes for old school Master Disk floppy's? In a bind and need to reset the activation disk soon and to be pointed...
Replies
9
Views
230
Has anyone found a way to convert/replace/update the firmware on old Parker TS80xx series HMIs (i.e. TS8010, TS8006, etc) to accept Crimson...
Replies
0
Views
96
Hey all, I am currently working on a depalletizer for a customer and we are doing a hoist upgrade. This is a SLC500 processor and the drives are...
Replies
6
Views
303
Back
Top Bottom