Siemens S7/TIA v18: Set & Reset Instruction...

I have no idea if you have put down on paper the theory of how you need this machine to work but it makes sense to have a brainstorming session with those who may need to know or have ideas, write down the sequence of events that need to happen i.e. make a flowchart it makes writing the program easier.
Do not fall into the trap of design as you go along it makes your code messy, creates bugs every time you make changes on the fly you end up with lots of effective redundant code, test as far as possible the individual functions.

We've got a system spec and a software requirements spec, so that's useful for guiding software development...apart from the previous post about part numbers/identification.
 
Last edited:
Ah.. I now understand, I did a similar thing years ago, the operation was similar but more automated, at the start the operator pressed a teach button that then guided the OP to do the following:
Place test part into pickup station.
Press (cannot remember what it was called) but then press teach button, the part was placed into the component holder & clamped, there was a recipe where a part type was entered where the operator scanned a barcode on the master test part, this loaded the recipe with the allowable tollerances in or something like that.
The parameters were then taken (in this case sensors LDV's I think) then checked the relevant dimentions compared them to the master recipe as a double check things were within tollerance, the part was ejected & this allowed the operator to then start adding the machined parts, the system tested each part then either rejected it or accepted it by placing it into the relevant bin, again sequential fails (number that could be selected on the HMI) for example 3 in a row would alarm & stop the process.
So not far removed from your system.
 
Yes specs are very important, one of our main customers would produce a specification (their own FDS), we took that, constructed a Sofware Design Specification for their approval this then was turned into a software/drawings & parts manual to be issued to the client at the end of the project.
 
Ah.. I now understand, I did a similar thing years ago, the operation was similar but more automated, at the start the operator pressed a teach button that then guided the OP to do the following:
Place test part into pickup station.
Press (cannot remember what it was called) but then press teach button, the part was placed into the component holder & clamped, there was a recipe where a part type was entered where the operator scanned a barcode on the master test part, this loaded the recipe with the allowable tollerances in or something like that.
The parameters were then taken (in this case sensors LDV's I think) then checked the relevant dimentions compared them to the master recipe as a double check things were within tollerance, the part was ejected & this allowed the operator to then start adding the machined parts, the system tested each part then either rejected it or accepted it by placing it into the relevant bin, again sequential fails (number that could be selected on the HMI) for example 3 in a row would alarm & stop the process.
So not far removed from your system.

Yes, sounds pretty similar, albeit our system is a lot more manual rather than automated.
Now I'm starting to think "how will each individual part be identified? With a unique serial number? And what happens if bubba types it in wrong?".
 
it is certainly an American thing "Seal in",


I think the issue there is not wanting motors and other devices, driven by Set/Latched bit, to start up after a PLC cycles power or mode.

Life may be cheap in the third world, but it ain't here.
|
It does not apply everywhere of course, e.g not here because these bits are not controlling motors, but I can see how the "Set/Reset = bad" mentality can set* in and infect those too lazy to think it through.

* pun intended ;)
 
That does not quite make sense, first of all, a "seal in" circuit is the same i.e. if retentive it will stay as per last scan due to the output coil being true so it's own contact will be true, this applies to SET/RESET or latch/Unlatch.
There are some differences in different platforms for example Mitsubishi will not reset bits even though they are not retentive if PLC is put into stop however, a power down or reset will, some platforms may offer the ability to make bits retentive on power down or reset again for example in Mitsubishi there are two latch type in one regardless of stop or power down the data is retained, but the other latch area it retains on a stop but resets on power down/up or reset.
Regardless of the way it operates any good programmer will code in such a manner to make sure the system is safe, if it is required to save the last state often a hold bit is set on a power down/stop this disables say all outputs (those that should be disabled) until a manual intervention like a resume process.
It is worth testing a platform you are not used to this makes sense so the programmer understands the functions of the PLC. Try different scenarios i.e.
Retentive or not, going from run to stop & power down/up & a reset.
 
For the OP's information the code below shows ways of controlling a startup situation there are many ways to skin a cat this is just a few of them.

Startup.png
 
For the OP's information the code below shows ways of controlling a startup situation there are many ways to skin a cat this is just a few of them.

Thanks for the picture.
I'm not familiar with the S7 equivalent of 'first scan', I'll have to look it up...I think in Mitsubishi-Q it is SM404.
 
I cannot remember in siemens however, there are OB's that can be programed OB20 & OB 21 I think these are only called either on warm restart or cold restart, create an OB20 or 21 then just reset or set or what ever in there.
Actually I think that was S5 I think they may be OB100 to 102 in S7.
 
Thanks for the picture.
I'm not familiar with the S7 equivalent of 'first scan', I'll have to look it up...I think in Mitsubishi-Q it is SM404.


It's OB100 for startup (do not know how it behaves with warm/cold startup).



It used to be OB100 and 101 for a distinction between warm and cold startup.



The numbers don't mean much in TIA, but it's the Startup OB now.
 
That does not quite make sense, first of all, a "seal in" circuit is the same i.e. if retentive it will stay as per last scan due to the output coil being true so it's own contact will be true, this applies to SET/RESET or latch/Unlatch.


What I meant by "seal-in" is a circuit comprising atomic instructions (contacts and coils; e.g. the canonical Start/Stop Circuit pattern or its relatives; i.e. not Set/Latch/Reset/Unlatch). That kind of seal-in will not maintain an output coil value of 1 across a PLC RUN Mode cycle, or across a power cycle, on at least some PLCs.


A bit controlled only by Set/Latch/Reset/Unlatch will maintain an output coil value of 1 across RUN mode cycles and power cycles, on at least some PLCs. So if that 1 is controlling a motor or other device, then watch out.

As @parky notes, it makes sense to design and test a system to ensure behaves as you want, especially regarding safety, and comes up in a known state any time the PLC transitions to RUN mode. With a coil-driven output, the known state is simple: all coil-driven bits are assigned values of 0 (on some PLCs)*. With Set/Latch/Reset/Unlatched bits, there may be a need for first-pass logic to ensure the bits are in a known and safe state.

* whether that state is safe is another matter, of course.
 
In S7-300 you have OB100 and OB102.
In S7-400 you have OB100, OB101 and OB102.
In S7-1500 you activate the system merker bits. 1st scan is then M1.0


1500 can also do a startup OB, which by default is OB100.
 

Similar Topics

Context: PLC= S7-1212C, HMI=KTP1200 Basic. Hi again, When the "REPORT" button is pressed (on a different screen), it takes the operator to the...
Replies
7
Views
677
Context: PLC= S7-1212C, HMI=KTP1200 Basic. Hi, The operator has reported that, from time-to-time, when he presses the "Generate Report" button...
Replies
5
Views
469
General Question: The PLC and HMI that I've been working on (a laser measurement system) is soon to be transported to the site where it will be...
Replies
2
Views
702
Hi, I'm not sure how to do this... Basically, I want to restrict the user input values for this tag to be in the range 20.001 to 25.0. I...
Replies
17
Views
1,651
Can someone help me with this? I'm no good at SCL - virtually everything I've done so far has been ladder logic. The return value from the...
Replies
13
Views
1,111
Back
Top Bottom