79509214

Date: 2025-03-14 13:37:57
Score: 1
Natty:
Report link

I really didn't find in the official codesys Help a detailed descriptive definition for each possible combination type and the expected response, but I found this note here:

"Conversions from a "larger" type to a "smaller" type are also implicitly possible (for example, from INT to BYTE or from DINT to WORD)."

Would that be enough?

Despite this, there are several notes distributed in the codesys help explaining specific situations about value conversions, such as notes about floating points and possible problems between different Target Systems, like here:

"The rounding logic for borderline cases depends on the target system or the FPU (Floating Point Unit) of the target system. For example, a value of -1.5 can be converted differently on different controllers."

Another situation, as example, is about DATA and TIME conversion, explained in the help for the ADD operator.

Finally, what I recommend as good practice is, when in doubt, use explicit conversion.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Contains question mark (0.5):
  • Low reputation (0.5):
Posted by: dwpessoa