MASTER YOUR CASTLE with your new build or reno project
Enter competition

How do I convert integer to ASCII using Twido Suite and rearrange the bytes order?

FA198345

27/04/2019

Goals and Symptoms

Goals: To explain the new function available in Twido firmware 5.0 or higher.

Causes and Fixes

The new function to convert Integer to ASCII characters is available in Twido firmware 5.0 or higher. The INT_TO_ASCII function always writes the Most Significant Byte (MSB) first.
The End character is "Space" (ASCII 32). Also the function automatically calculates how many memory words (%MWs) should be filled with the ASCII values ( from 1 to 4 %MWs).
After the conversion, the customer can use the ROL (Rotate to Left) function to rearrange the bytes order.
Below is an example converting an integer value to ASCII characters and rearranging the bytes order. You may use the attached PLC code example if are converting integer value to 3 or 4 ASCII characters.