"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

I'm trying to dig to the source of a minor "recoverable" system fault throwing a fault light on a machine that has been confusing my operator...
Replies
3
Views
62
I'm using a SLC typed write from the ControlLogix5572 to the MicroLogix 1400, with path: 2, (MicroLogix IP). The ControlLogix equipment has a...
Replies
0
Views
87
Does this instruction calculate values during a single scan, or does it require number of scans based on element count in the array? For Example...
Replies
3
Views
113
Hello All, Was hoping I could get a little help with Modicon ladder logic. This is the first time I have seen Modicon logic and currently trying...
Replies
6
Views
259
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
8
Views
351
Back
Top Bottom