PLCS.net - Interactive Q & A

PLCS.net - Interactive Q & A (http://www.plctalk.net/qanda/index.php)
-   LIVE PLC Questions And Answers (http://www.plctalk.net/qanda/forumdisplay.php?f=2)
-   -   Siemens S7 314, First Scan bit? (http://www.plctalk.net/qanda/showthread.php?t=47036)

O_P May 7th, 2009 03:05 AM

Siemens S7 314, First Scan bit?
 
Hi!

Is there any "system bits" in siemens PLC's?

I whould like to find a bit that is "1" only in the first scan cycle. Or at the start up of CPU..

I've searched a litle in different manuals and online-help.
But I've only found small instruktions with OB100 and such.

So are there no default system bits for this function??

Regards
OP

RMA May 7th, 2009 03:18 AM

Unlike some other PLCs the Siemens CPUs don't have a "first scan" Bit, however, you can easily do it yourself by setting a bit TRUE in OB100, which is automatically run on start-up (or after power up, if the switch is in the RUN position). Then at the end of OB1, reset the bit back to FALSE.

Since it's quite common for programmers to use Bits M0.0 and M0.1 as FALSE and TRUE flags, then M0.2 offers itself as a convenient Bit for the "First scan" flag.

Just be sure that you don't use the same Byte as is used to generate the standard frequency generator Bits - this Byte is defined in the CPU parameters.

PeterW May 7th, 2009 06:10 AM

I usually keep MB0 for the cycle clock.

Usually the first scan bit is used to initialise parts of the program, in Siemens you would usually initialise these parts of the program within blocks called from the start up blocks, this saves having to use up scan time during the normal program sequence.

The only time I have seen a first scan flag used in a Siemens program was where this was used to set up pointers within instance DB's.

Apart from advanced programming such as that, any other thing (such as presetting states etc) can all be done within the OB100 calls.

O_P May 7th, 2009 06:18 AM

Thanks for all your anwers!!

I solved it like this:


OB100:
Code:

      SET 
      S    "First_Scan"
      S    "Always_1"
      R    "Always_0"
      SAVE

OB1: In last Network

Code:

      SET 
      R    "First_Scan"
      S    "Always_1"
      R    "Always_0"
      SAVE

I realy hope this works:rolleyes:

O_P May 8th, 2009 07:53 AM

I've change it.. Now i looks like this:

M0.1 = Allways 1
M0.2 = First Scan


OB1:

NW1:
M0.1 M0.2
-|/|---------( )

NW2:
M0.1 M0.1
-|/|---------( )
|
M0.1 |
-| |--


L D[AR2,P#0.0] May 8th, 2009 08:35 AM

You should also check that your always 1 and always 0 are exactly as they should be at the end of OB1 - if they are not flag up an error. You may make a typo and accidently modify the always 1 always 0 flags within your program.

O_P May 9th, 2009 10:22 AM

Quote:

Originally Posted by L D[AR2,P#0.0] (Post 322153)
You should also check that your always 1 and always 0 are exactly as they should be at the end of OB1 - if they are not flag up an error. You may make a typo and accidently modify the always 1 always 0 flags within your program.


Ah good thinking! Thanks for the advice!


All times are GMT -5. The time now is 03:19 PM.

.