uptown47
Lifetime Supporting Member
Hi all,
When the 'automatic' S5 to S7 translates comes across a DO instruction it translates it but I have a question about the translation.
Could you tell me if I'm right here:
I understand what this code is doing. It's taking the value of FW 240 and calling the corresponding Datablock (i.e. if FW 240 = 40 then its calling DB 40).
This is the S7 Conversion:
This is the same code again with my comments next to it for what I think is going on with the Accumulators etc...
Am I right with this or am I off on a tangent here?
It seems like an awfully complicated way of doing a "DO" instruction? Is there no simpler way ??
Many thanks for any help / reassurance you can give me.
Cheers
uptown (John) ;-))
When the 'automatic' S5 to S7 translates comes across a DO instruction it translates it but I have a question about the translation.
Could you tell me if I'm right here:
Code:
S5 CODE IS:
DO FW 240
C DB 0
I understand what this code is doing. It's taking the value of FW 240 and calling the corresponding Datablock (i.e. if FW 240 = 40 then its calling DB 40).
This is the S7 Conversion:
Code:
(#conv_akku1 = TEMP Dword
#conv_index = TEMP Word)
T #conv_akku1
L MB 241
T #conv_index
TAK
L #conv_akku1
OPN DB[#conv_index]
This is the same code again with my comments next to it for what I think is going on with the Accumulators etc...
Code:
T #conv_akku1 // Transfer the contents of Accumulator
// 1 into #conv_akku1 ?? WHY ??
L MB 241 // Load value of MB241 into Accumulator 1
// - old Accu 1 value moved to Accu 2
T #conv_index // Transfer Accu 1 (value of MB241) into
// #conv_index
TAK // Swap contents of Accumulator 1 and 2 so
// now Accumulator 1 = whatever was in
// Accu 2 (Instruction pointer perhaps?)
// as all this code takes place in a FB.
// Accu 2 is now equal to value of MB241
L #conv_akku1 // Accu 1 now equal to #conv_akku1
// Accu 2 now got its instruction pointer?
// back
OPN DB[#conv_index] // Open DB of value MB241
Am I right with this or am I off on a tangent here?
It seems like an awfully complicated way of doing a "DO" instruction? Is there no simpler way ??
Many thanks for any help / reassurance you can give me.
Cheers
uptown (John) ;-))