Mrslipmat
Member
Hi guys
Its been some time since I worked with SCL and have a few lines of code I need some help with, I have the SCL raw code and am currently trying to convert it in TIA V14, could anybody please point me in the right direction with the ladder solution ?
Code is as follows:
// Actual Position
MOVE_BLK(IN:=#DATA_IN[4],
COUNT:=4,
OUT=>#TMP_ARRAY[1]);
#X := DINT_TO_REAL(DWORD_TO_DINT(#TMP_VAL)) / 1000.0;
I have a function for the block move, however I'm not sure if they are converting DINT_TO_REAL and then dividing by 1000.0 as apposed to converting DWORD to REAL then REAL to DINT then dividing by 1000.0
A few other pieces of code are attached below I'm having problems with converting too.
// Differential pressure
MOVE_BLK(IN := #DATA_IN[16],
COUNT := 2,
OUT => #TMP_ARRAY_16[1]);
#TMP_VAL_REAL := INT_TO_REAL(WORD_TO_INT(#TMP_VAL_WORD));
#XDP := #TMP_VAL_REAL / 16.383;
// Speed setpoint 1 limit and conversion
#TMP_VAL_REAL := #VA1;
IF ((#TMP_VAL_REAL < 0.0) AND NOT (#PQ_ACTIVE)) THEN
#TMP_VAL_REAL := 0.0;
ELSIF (#TMP_VAL_REAL < -100.0) THEN
#TMP_VAL_REAL := -100.0;
END_IF;
IF (#TMP_VAL_REAL > 100.0) THEN
#TMP_VAL_REAL := 100.0;
END_IF;
#TMP_VAL_REAL := #TMP_VAL_REAL * 163.83;
#TMP_VAL := DINT_TO_DWORD(REAL_TO_DINT(#TMP_VAL_REAL));
MOVE_BLK(IN := #TMP_ARRAY[3], // Only written to the lower word
COUNT := 2,
OUT => #DATA_OUT[8]);
Any help would be greatly appreciated and many thanks in advance.
Mrslipmat
Its been some time since I worked with SCL and have a few lines of code I need some help with, I have the SCL raw code and am currently trying to convert it in TIA V14, could anybody please point me in the right direction with the ladder solution ?
Code is as follows:
// Actual Position
MOVE_BLK(IN:=#DATA_IN[4],
COUNT:=4,
OUT=>#TMP_ARRAY[1]);
#X := DINT_TO_REAL(DWORD_TO_DINT(#TMP_VAL)) / 1000.0;
I have a function for the block move, however I'm not sure if they are converting DINT_TO_REAL and then dividing by 1000.0 as apposed to converting DWORD to REAL then REAL to DINT then dividing by 1000.0
A few other pieces of code are attached below I'm having problems with converting too.
// Differential pressure
MOVE_BLK(IN := #DATA_IN[16],
COUNT := 2,
OUT => #TMP_ARRAY_16[1]);
#TMP_VAL_REAL := INT_TO_REAL(WORD_TO_INT(#TMP_VAL_WORD));
#XDP := #TMP_VAL_REAL / 16.383;
// Speed setpoint 1 limit and conversion
#TMP_VAL_REAL := #VA1;
IF ((#TMP_VAL_REAL < 0.0) AND NOT (#PQ_ACTIVE)) THEN
#TMP_VAL_REAL := 0.0;
ELSIF (#TMP_VAL_REAL < -100.0) THEN
#TMP_VAL_REAL := -100.0;
END_IF;
IF (#TMP_VAL_REAL > 100.0) THEN
#TMP_VAL_REAL := 100.0;
END_IF;
#TMP_VAL_REAL := #TMP_VAL_REAL * 163.83;
#TMP_VAL := DINT_TO_DWORD(REAL_TO_DINT(#TMP_VAL_REAL));
MOVE_BLK(IN := #TMP_ARRAY[3], // Only written to the lower word
COUNT := 2,
OUT => #DATA_OUT[8]);
Any help would be greatly appreciated and many thanks in advance.
Mrslipmat