S/15 first pass

stasis

Member
Join Date
Mar 2005
Location
Columbus, Ga
Posts
344
I asked this in another post, but never got a 'yes or no' answer...

...is it possible to use the S/15 bit at the end of sub-routines to clear the values in the sub?
 
Yes - you can certainly use it at any point in your program.

That said, it is typically used at the beginning of your code since you typically want to reset all data BEFORE scanning/evaluating any of your logic.

Marc
 
Yes. It will only be true for the first program scan including the execution of all subroutines that are called during that scan. You can program whatever you want to happen with it. If you used it on the first rung of a subroutine to clear or restore values, any logic following it's use through the end of the program could change those values depending on how it's written, so it would make sense to use it at the end of the routine. I prefer to call a conditional sub from the main when first_scan is true and put all the power up stuff there. Just remember that whatever you program is going to happen every time the processor power is cycled and when it's changed from program to run mode.
 
S:1/15 is true on the "First Pass" of the processor when it first goes into the Run mode ... on subsequent passes (scans), S:1/15 will NOT be true ... even if the processor is making its first pass through a particular subroutine ...

I don't think that you're making the following mistake ... but I've seen it done (or at least "tried") before ...

fairly common mistake: a program has some subroutines ... the JSR rungs to these are "conditional" ... and the subroutines are not being used (called) when the processor first goes into the Run mode ... the programmer thinks to himself: "I'll just put an S:1/15 rung in each one of these subroutines ... then, later on when the processor scans them for the first time, the S:1/15 rung will be true" ...

that won't work ...

as I said, I don't think that you're making that mistake, but just to be sure ...
 
I assumed that...

I am not sure I was ever taught that Ron, but I have always assumed that to be the case... Thanks for the clarification...
 
no, Ron...I only wanted to clear a subs values on the first pass. Just wasn't sure if it was proper to have it in the sub or not.

I've always thought of first pass as just that, the first time a processor scans after power-up. Isn't that correct?
 
Greetings stasis,



you said:



Just wasn't sure if it was proper to have it in the sub or not.




yes, that’s perfectly valid ...



I've always thought of first pass as just that, the first time a processor scans after power-up. Isn't that correct?



in simplest terms: yes, that is correct ...



but ... if you really want to split hairs ...



the Allen-Bradley PLC-5 and SLC-500 processor families also do a “pre-scan” when they first go into the “Run” mode ... this is a one-time pass through ALL of the program files (even uncalled subroutines) which is done pretty much for safety reasons ... and the “pre-scan” happens just BEFORE the “First Pass - S:1/15” scan ... several things happen during the “pre-scan” ... one important thing is that ALL of the OTE (Output Energize) instructions in the program are written to a “0” state ... even OTEs on unconditional (or otherwise “true”) rungs which are located in “uncalled” subroutine files ...



I helped debug a program once which might be of interest as an example ... the programmer had left a “scrap” subroutine file in the program ... this was an “uncalled” and “unused” subroutine ... in fact, the JSR rung which had previously been used to “call” this subroutine had been totally deleted ... the programmer had then gone to a new subroutine and set up Latch and Unlatch instructions to control a particular output ... reason: he needed this particular output to retain its On/Off status after a power failure ... problem: after each “power down” test cycle, the output always went Off ... reason: the OTE located in the “uncalled” and “unused” and “scrap” subroutine file was writing a “0” into the bit during each “pre-scan” ... solution: delete the OTE ... problem solved ...



and so ... most people look at this thing exactly the way you seem to look at it: “S:1/15 is true the first time a processor scans after power-up.” ...



and I’m not going to debate what we mean by the term “scans” ... but like I said earlier, if you really want to split hairs ... technically there is a “scan” (specifically, the “pre-scan”) which happens once when the processor first goes into the “Run” mode just BEFORE S:1/15 comes into play ... and sometimes knowing about the “pre-scan” is exactly the kung-fu which can solve a ticklish problem ...



finally ... I’m sure that none of this is related to your immediate question ... but it’s a slow day ... I thought I’d just pass this on for what it’s worth ...
 
Again... Thanks ...

With every new day there is a new challenge, and with every new challenge comes knowledge, and with new knowledge comes the realization that I really don't know a fraction of what I thought I did... :oops:

Thanks Ron, for that explanation, I knew the result of the "pre-scan" but never had it explained to me... I don't think that was covered in my A-B courses (or maybe I was day dreaming).
 
thanks for clarifying that Ron...see, this is why I post questions here. You get your answer & answers to the questions you haven't asked yet! Once again, thanks for that information.
 
Ron Beaufort said:
Greetings stasis,



you said:



[/font][/color]



yes, that’s perfectly valid ...







in simplest terms: yes, that is correct ...



but ... if you really want to split hairs ...



the Allen-Bradley PLC-5 and SLC-500 processor families also do a “pre-scan” when they first go into the “Run” mode ... this is a one-time pass through ALL of the program files (even uncalled subroutines) which is done pretty much for safety reasons ... and the “pre-scan” happens just BEFORE the “First Pass - S:1/15” scan ... several things happen during the “pre-scan” ... one important thing is that ALL of the OTE (Output Energize) instructions in the program are written to a “0” state ... even OTEs on unconditional (or otherwise “true”) rungs which are located in “uncalled” subroutine files ...



I helped debug a program once which might be of interest as an example ... the programmer had left a “scrap” subroutine file in the program ... this was an “uncalled” and “unused” subroutine ... in fact, the JSR rung which had previously been used to “call” this subroutine had been totally deleted ... the programmer had then gone to a new subroutine and set up Latch and Unlatch instructions to control a particular output ... reason: he needed this particular output to retain its On/Off status after a power failure ... problem: after each “power down” test cycle, the output always went Off ... reason: the OTE located in the “uncalled” and “unused” and “scrap” subroutine file was writing a “0” into the bit during each “pre-scan” ... solution: delete the OTE ... problem solved ...



and so ... most people look at this thing exactly the way you seem to look at it: “S:1/15 is true the first time a processor scans after power-up.” ...



and I’m not going to debate what we mean by the term “scans” ... but like I said earlier, if you really want to split hairs ... technically there is a “scan” (specifically, the “pre-scan”) which happens once when the processor first goes into the “Run” mode just BEFORE S:1/15 comes into play ... and sometimes knowing about the “pre-scan” is exactly the kung-fu which can solve a ticklish problem ...



finally ... I’m sure that none of this is related to your immediate question ... but it’s a slow day ... I thought I’d just pass this on for what it’s worth ...


Now that my friends in one useful piece of information..Damn i hope i remember that..

Double damn..my mother was right..reading does pay off..(Dont tell her i said that!!)
 
S:1/15 First Pass Bit!
Use this bit to initialize your program as the application requires. When this bit is set by the processor, it indicates that the first scan of the user program is in progress (following a power up in the RUN mode or entry into a REM Run or REM Test mode). The processor clears this bit following the first scan.

When this bit is cleared, it indicates that the program is not in the first scan of a REM Test or REM Run mode.
 

Similar Topics

Hello, I am still new to PLC programming and I just got this job two year out of school so I don’t remember much. I was given a task were I have...
Replies
1
Views
169
So I'm having issues with a certain rung and one of my coworkers mentioned it may not allow the signal past the latch coil. For example in the...
Replies
27
Views
3,748
I’m a bit stuck on HMI (KTP-1200) programming… See the picture attached. The PASS or FAIL box should only appear when the toggle switch is...
Replies
7
Views
1,072
I've been given a line that has several sysmac c200Hx PLCs. The First station Im trying to wrap my head around has a NS8 HMI. I'm using Cx-one...
Replies
2
Views
748
See image below. Look at line 95. I tested all data type, but none of them works. https://ibb.co/H2Csr15 See this. TEMPDATA2 is used only...
Replies
3
Views
2,705
Back
Top Bottom