PLCgen: IO table file: allow a choice of conversion (cast expression) between PLC type and CIF data
In the CIF documentation we can find the following:
It is highly recommended that the number of transferred bits from the I/O matches with the CIF type of the variable (...). If the size of the CIF variable type does not match with the size of the I/O port type, a cast expression is automatically inserted.
The example of this automatically inserted cast expression (conversion) we can find in the test io_func_func:
(* Write discrete variable "a.out_int" to PLC output. *)
out_a_out_int := DINT_TO_INT("DB".a_out_int);
However, there are situation when the choice of the conversion need to be made by the user, especially when more PLC types are allowed (see #1107) and when scaling is used (see #1109). For example the cast expression of PLC data WORD to CIF data REAL is:
#in_real := DINT_TO_REAL(WORD_TO_DINT("in_word":P));
I think it is sometimes better to let the customer make a choice themselves using the IO table file.
Addressees: #679, #1062 (closed), #1107, #1109