[RTU560] Sending a command to an output card using Structured Text
Hi folks!
I'm currently working with the RTU560 and I want to use it as PLC. For that I've been using the RTUtil560 and the MULTIPROG wt software to configure the device and create the PLC application.
The RTU has 2 binary input cards and 1 binary output card properly configured in RTUtil560. The objective is to send a command to the output card according to the values of the inputs. So, I'm writting a small Structured Text program, but I can't send a command to the output card.
The variables are 1 DPI input variable called voltaje_0 and 1 DCO output variable called PUMP0. The manual says the values for these variables are accessed by voltaje_0.Value and PUMP0.Value and both are bytes, but only the the first two bits are important.
The debugging system of multiprog gives me the values of both variables in the format 16#01 or 16#02 (hex?), so when I do, for example PUMP0.Value:=16#02, the compiler says:
"Illegal data type operand! [Accu data type: INT; Operand data type: BYTE (POU: 'Main').] (Specific Code Generator)"
So, how can I send a command to the output card?
Best regards,
Charlie
Answers
The problem arises because you are trying to feed an INT variable with a BYTE value.
You have to transform the value of the variables from BYTE (hex) to INT (decimal), by means of an BYTE_TO_INT function (MULTIPROGwt uses IEC1131-3, so it must have this instruction). The result must be something similar to this:
PUMP0.Value:=BYTE_TO_INT(Voltaje0.Value);
**I am not fully aware of the correct syntax, this is only a guide.
by juancar70 Rank: 4137 on 2/10/2021 7:38:09 PM | Like (0) | Report
You can enter values of type BYTE directly by preceding them with BYTE#
For example, the following line declares a value of 1 in BYTE format:
BYTE#1
Add new comment