wbaldisser
Member
hi everybody,
I'm working on the conversion of a S5 program to an S7.
For some reasons that aren't important to this forum, I had created the FB242 and FB243 in my S7 program. My problem is that I'm not sure if what I have done is correct. There is somebody who can help me?
It can be usefull for other peoples because I sow in other forums people asking for this two functions in the S7.
FUNCTION "MUL:16" : VOID
TITLE =
//Multiply two words and return the result expressed in low and high order
//product.(Used for the conversion from S5 to S7)
VAR_INPUT
Z1 : WORD ; //Multiplier
Z2 : WORD ; //Multiplicand
END_VAR
VAR_OUTPUT
Z3 : BOOL ; //"1", if the product is zero.
Z32 : WORD ; //Product, high-order word.
Z31 : WORD ; //Product, low-order word.
END_VAR
VAR_TEMP
tmpResult : DWORD ;
END_VAR
BEGIN
NETWORK
TITLE =
L #Z1;
L #Z2;
*D ;
T #tmpResult;
L #tmpResult;
L 0;
==I ;
JC m1; //Check if is 0
R #Z3;
JU m2;
m1: S #Z3;
m2: LAR1 P##tmpResult; //Split high and low order word
L W [AR1,P#0.0];
T #Z32;
L W [AR1,P#2.0];
T #Z31;
END_FUNCTION
can someone see if this procedure do exact the same that the s5 version?
thanks.
I'm working on the conversion of a S5 program to an S7.
For some reasons that aren't important to this forum, I had created the FB242 and FB243 in my S7 program. My problem is that I'm not sure if what I have done is correct. There is somebody who can help me?
It can be usefull for other peoples because I sow in other forums people asking for this two functions in the S7.
FUNCTION "MUL:16" : VOID
TITLE =
//Multiply two words and return the result expressed in low and high order
//product.(Used for the conversion from S5 to S7)
VAR_INPUT
Z1 : WORD ; //Multiplier
Z2 : WORD ; //Multiplicand
END_VAR
VAR_OUTPUT
Z3 : BOOL ; //"1", if the product is zero.
Z32 : WORD ; //Product, high-order word.
Z31 : WORD ; //Product, low-order word.
END_VAR
VAR_TEMP
tmpResult : DWORD ;
END_VAR
BEGIN
NETWORK
TITLE =
L #Z1;
L #Z2;
*D ;
T #tmpResult;
L #tmpResult;
L 0;
==I ;
JC m1; //Check if is 0
R #Z3;
JU m2;
m1: S #Z3;
m2: LAR1 P##tmpResult; //Split high and low order word
L W [AR1,P#0.0];
T #Z32;
L W [AR1,P#2.0];
T #Z31;
END_FUNCTION
can someone see if this procedure do exact the same that the s5 version?
thanks.