S5 Functinoblock Question

JIMCON

Member
Join Date
Sep 2005
Location
SWEDEN
Posts
124
Hello..

Right now im gonna convert my S5 Functionblocks to S7..
But I cant translate 2 words in the S5 FB declaration area.

IB = input byte
B = byte
IW = Input word

but hmm ?? IWI = ??
IBI = ??
 
I dont get this at all. ?

M001: ?? what does it stand for


;
NAME: LOADSH1
DECL: DBLS B
DECL: DBG1 B
DECL: G1KW IW
DECL: G1LS IBI
DECL: DBG2 B
DECL: G2KW IW
DECL: G2LS IBI
DECL: DBG3 B
DECL: G3KW IW
DECL: G3LS IBI
DECL: DBG4 B
DECL: G4KW IW
DECL: G4LS IBI


AN =G1LS
JC =M001
DO =DBG1
L =G1KW
DO =DBLS
T DW 1
T DW 11
L KF +1
T DW 16
JU =M002
M001: DO =DBG1
L =G1KW
DO =DBLS
T DW 1
L KF +0
T DW 11
T DW 16

M002: AN =G2LS
JC =M003
DO =DBG2
L =G2KW
DO =DBLS
T DW 2
T DW 12
L KF +1
T DW 17
JU =M004
M003: DO =DBG2
L =G2KW
DO =DBLS
T DW 2
L KF +0
T DW 12
T DW 17

M004: AN =G3LS
JC =M005
DO =DBG3
L =G3KW
DO =DBLS
T DW 3
T DW 13
L KF +1
T DW 18
JU =M006
M005: DO =DBG3
L =G3KW
DO =DBLS
T DW 3
L KF +0
T DW 13
T DW 18

M006: AN =G4LS
JC =M007
DO =DBG4
L =G4KW
DO =DBLS
T DW 4
T DW 14
L KF +1
T DW 19
JU =M008
M007: DO =DBG4
L =G4KW
DO =DBLS
T DW 4
L KF +0
T DW 14
T DW 19

M008: DO =DBLS
L DW 11
L DW 12
+F
T DW 21

L DW 13
L DW 14
+F
T DW 22

L DW 21
L DW 22
+F
T DW 23

L DW 16
L DW 17
+F
T DW 24
L DW 18
L DW 19
+F
T DW 25
L DW 24
L DW 25
+F
T DW 26

A(
L DW 26
L KF +0
>F
)
JC =M009

L KF +1
T DW 26


M009: JU FB 243
NAME: DIV:16
Z1 : DW 23
Z2 : DW 26
OV : F 0.3
FEH : F 0.3
Z3=0: F 0.3
Z4=0: F 0.3
Z3 : DW 27
Z4 : DW 30

BE
 
Last edited:
JIMCON

If you're declaring inputs and outputs for your function block you also have to declare the size: BI for bit, BY for byte, W for word and, if using a 135 or higher D for double. So, IBI in fact is I BI or Input Byte and IW is I W or Input Word.

M001 is a label. You can let the program execution jump to a label with the instructions JC <label> (conditional) or JU <label> (unconditional).

The jump to FB243 can be translated to S7 by a simple integer division ( /I ), so you don't have to translate FB243 at all. That would even be impossible, because that's a propietary routine from Siemens embedded in the operating system ROM of the S5 PLC.

Kind regards,
 
Last edited:
Thanx alot jvdcande.

I guess i have to spend the rest of the week understand how these FB´s works in S5 contra S7..

Aaah Headache o_O I dont like S5 at all lol ... :cry:
If u got some good links to pages with some help pdf´s just post it up :geek:
 
Last edited:
Are you using the S5->S7 translator provided in Simatic Manager ? This will give you the S7 equivalent of S5 where possible. Any areas that will not translate will be highlighted and will give you a further list of queries.
 
It only work on basic instructions. It dont work on the code above.
Speaking about the S5 code above. I now atleast know that "DO" means Indirect adressing.
 
Last edited:
This is waht i have understod of the code above.. But cant find the way to translate t to S7..



..........AN =G1LS <-- If not G1LS
..........JC =M001 <-- Jump M001
..........DO =DBG1 <-- Point at DBG1
..........L =G1KW <-- Load G1KW
..........DO =DBLS <-- Point at DBLS
..........T DW 1 <-- Transfer contents of ACCU1 to DW 1
..........T DW 11 <-- Transfer contents of ACCU1 to DW 11
..........L KF +1 <-- Load konstant +1 into ACCU1
..........T DW 16 <-- Transfer contenst of ACCU1 to DW16
..........JU =M002 <-- Jump to M002
....M001: DO =DBG1 <-- Point at DBG1
..........L =G1KW <-- Load G1KW to ACCU1
..........DO =DBLS <-- Point at DBLS
..........T DW 1 <-- Transfer contents of ACCU1 to DW 1
..........L KF +0 <-- Load constant +0 into ACCU1
..........T DW 11 <-- Transfer contents of ACCU1 to DW 11
..........T DW 16 <-- Transfer contents of ACCU1 to DW 16
 
DO =DBG1 means process the block passed as a formal operand. In this example, DBG1 is a data block. To do the same in Step7, declare a parameter of type BLOCK_DB (e.g. DBG1) and then use OPN #DBG1
 
Ok shall I declare it in TEMP as a Word then..?

U mean like this ?

AN #G1LS
JC M001
OPN DB [#DBG1]
L #G1KW
OPN DB [#DBLS]
T DBW 1
T DBW 11
L 1
T DBW 16
JU M002
 
Last edited:
I put the following code through the S5 to S7 converter:
Code:
Name :BERT 
Decl :DBLS I/Q/D/B/T/C:B																								 
	 :																														 
	 :DO =DBLS																												
	 :L DW  1																											 
	 :BE

and here is what it produced with no errors:

Code:
FUNCTION FC 67 : VOID
  NAME: BERT
  VAR_INPUT
	DBLS	  :block_db;  // DBLS
  END_VAR
  BEGIN
  NETWORK
	   //;
	   OPN #DBLS ;
	   L   DBW 2;
  
  
END_FUNCTION

I strongly recommend you use the convertor and then resolve each conversion issue as reported.
 
So it is possible to paste specific code into the S5 file converter. ??
I thought you only could convert whoe projects ?

Ahh uhhmm forget what i said... now i know how u did..
 
Last edited:
When you call the block, the parameter you will enter will be a data block, DB25 for example.
Ok do I have to create this DB ? Or is it created..

Anyway I took your advice and used the konverted file.. And it worked as u said :) Thank u so much for that help. But now im facing another problem.
I now have the FB56 ready and inserted in my FC55, and i have tied all variables to it except the one´s that are word "input and "output pins. The case is that in the blocks in S5 they have just entered (ex. DW 153) on an input pin. But when i want to do the same in S7 (ex. DBW 153) on an input pin, it doesnt accept this.??

Maybe i have to create a DB and declare all the DBW´s ?? (ex. DB150.DBW153) or shall i use MW ?? is it the same ?

Hmm but then i have to open that DB every time i want to write to a DBW ..
 
Last edited:
S5?

Yeah, it works... eventually, but only after a great deal of mental mind-f'ing... or rather, mind-bending.

But I've always had to wonder... what the hell were they smokin' when they came up with that particularly obtuse way of looking at logic, logical elements, and logical functions?

If you are switching to an S7-2XX then you will be mightly impressed with the difference. Once you shake the S5-think, you will find that you can think more rationally, and more easily... without all of the mind-.... bending.

However, if you are switching to an S7-3XX or -4XX... well, you won't be moving far from where you were. In that case... too bad for you.

It's a damned shame that Siemens is trying to down-play and, probably, eliminate the S7-2XX line. They stumbled onto the best development philosophy when they bought the TI line... and now they are running it into the ground... to ultimate elimination.

Are all Europeans this crazy? Or is it only the Germans?

My main process was designed and built by a German concern. After we ran it for a while according to their "think"... we had at it, in a practical sense. Control-wise, and maintenance-wise, they wouldn't recognize it now.

So... is it all Europeans, or is it just the Germans?
 

Similar Topics

OK. You guys helped me out a bunch with my first Siemens question. I found a bunch of issues with integrity checking the PLC programs I was...
Replies
3
Views
105
Hi all, Writng a FB in ST on Beckhoff TC for a pulser which turns on and off on a cycle, is paused by turning bControlInput to FALSE, but resumes...
Replies
4
Views
93
Hello folks! Never been here before but I have a question that's been bugging me for a while. I recently got a job at a chemical plant that's...
Replies
8
Views
282
I am currently backing a Micro Logix 1100 and no-one seems to have the file for me to upload from. Is there a way for me to upload the project off...
Replies
15
Views
341
Good morning crew! Ok my logic works but I am missing something. When the start button is pushed it should like the red light for 4sec then shut...
Replies
13
Views
344
Back
Top Bottom