AN-294 Integer to Bytes conversion

AN-294 Integer to Bytes conversion

When handling communication channels like RS232, CAN or Telnet on Ethernet, it is sometimes necessary to send or receive a long integer as 4 bytes.

This document describes a software routine that converts a 32 bit integer held in a VR to 4 bytes for transmission. The second part shows the reverse operation, converting 4 bytes back to a long integer.

    • Related Articles

    • AN-332 Hexadecimal string to Integer Decimal number

      This document exposes a useful BASIC subroutine to parse a hexadecimal string value to a decimal integer and store it into a VR. It does something similar to the BASIC command VAL(“numerical_string”), which converts a string to a numerical value.
    • AN-341 Conversion from EURO205 to EURO205X

      The Euro 205X is the closest controller in the MC2 range to the performance and functionality of the Euro 205. This document gives the answers to the most asked questions about the upgrade path from Euro 205 to the new Euro 205X.
    • AN-296 Conversion MC206x to MC405

      The MC405 is the closest controller in the MC4 range to the performance and functionality of the MC206/MC206X. This document gives the answers to the most asked questions about the upgrade path from MC206/MC206X to the new MC405
    • AN-334 Conversion from EURO205x to EURO 404/408

      The Euro 404/408 is the closest controller in the MC4 range to the performance and functionality of the Euro 205X. This document gives the answers to the most asked questions about the upgrade path from Euro 205X to the new Euro 404/408.
    • AN-358 Conversion from Old Trio Keypad to UNIPLAY HMI

      Systems using the P502 and P503 vacuum-fluorescent keypads can be updated to use the Trio 7 inch or 10 inch HMI. (P845 and P846) This document explains how to convert from this old keypads to the UNIPLAY HMI There are options to either use a ...