Siemens S7 314, First Scan bit?

O_P

Member
Join Date
Apr 2009
Location
Sweden
Posts
11
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
 
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.
 
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.
 
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:
 
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 |
-| |--

 
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.
 
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!
 

Similar Topics

Hi guys... been a very long time since I've posted... I have a few machines here from the Czech republic that came with siemens plcs in them...
Replies
4
Views
1,907
Hi all I have a cpu314c with a 5ai/2ao unit, I can’t get any reading within my program. I have tried with the simulator and the program works...
Replies
8
Views
2,310
Good day I recently Changed a screen on a Machine from OP7 to KP400 Comfort using TIA portal v12. since the change the communication is a bit of...
Replies
6
Views
2,385
Hi guys, looking for some advice from someone with some siemens hardware experience. Im a student considering buying a siemens plc to practice...
Replies
4
Views
5,019
Hi all, I have been struggling for a while trying to get Modbus TCP/IP comms setup using the MODBUS_PN block with an S7-314. I was using a...
Replies
0
Views
1,477
Back
Top Bottom