"DO" instruction - S5 to S7 automatic conversion?

uptown47

Lifetime Supporting Member
Join Date
Feb 2008
Location
Over there, next to those boxes
Posts
1,146
Hi all,

I'm trying to convert a "DO" instruction in S5.

I was always told there was no easy way to do this but the in-built S5-S7 converter did it without complaint. I just wondered if someone could confirm that what it has come up with is correct and I also have a question as to why it has transferred the Status Word to the accumulator during the procedure.

I'll show the old S5 code and then the new S7 code as per the in-built converter:

Code:
Old S5 code:
L KF+20
L DW 70
+F
T FW 194
C DB 10
DO FW 194
L DW 0
C DB 99
DO DW 99
A F 0.0
= F 254.7
 
 
The S7 in-built converter came up with the following conversion:
 
L 20
L DBW 140
+I
T MW 194
OPN DB 10
T #conv_akku1 (a temp double word)
L STW (why are we loading the Status Word into the accumulator??)
 
T #conv_stw (a temp word)
L MB 195 (why are we only loading the byte and not the full word??)
 
SLW 4
LAR1
L #conv_stw
T STW (putting the status word back - but why ??)
L #conv_akku1
L DBW[AR1,P#0.0]
OPN DB 100
T DBW 198
T #conv_akku1
TAK
T #conv_akku2
L STW
T #conv_stw
L DBB 198
SLW 13
SRW 13 (why shift left and then shift right??)
L DBB 199
SLW 3
OW
LAR1
L #conv_stw
T STW (again? Why?)
L #conv_akku2
L #conv_akku1
A M[AR1,P#0.0]
= M254.7

Anyone any ideas with regards the questions here and whether this will actually perform as per the S5 code?

Many thanks for anyone who can get their head around this!

Cheers

;-)
 
Yes it will. To ensure the code executes exactly as the S5 would, the S7 has to save the accumulator and status word because they get modified by the instructions that compute the indirect address. The acc and status word have to then be restored to continue processing as before. When you examine the code in this example you can can see that you do not need to save the acc and status word. Code produced by the automatic converter always does save and restore the acc/status word though.
 

Similar Topics

Hello all, I am currently trying to establish a message instruction to pass data from a 1756-L73 to a 1756-L71. My communication path from the...
Replies
5
Views
93
Software Ver. 22.00.00, After the 1st time of being true the EQL. instruction is still allowing the rung to be true even though the inputs are...
Replies
7
Views
186
Logix 5000 v32 on 1769-L16ER I used the FBC instruction to scan an array of DINTs for true bits and it works but I found a thing that just...
Replies
2
Views
69
hey good afternoon ! I have a simple question, I need to import an Add on instruction to a controller that is in operation and cannot stop. Is it...
Replies
6
Views
244
Hello Friends I am trying to connect to a Zebra printer. I can print the label with hyperterminal both by RS232 and TCP/IP. Now, I am trying to...
Replies
7
Views
219
Back
Top Bottom