The STEP 7 program "STEP7_V55_Hex_ASCII" converts a hexadecimal number into ASCII characters. The FC1 "HexAscII" stores the separate characters in ASCII format in data block DB1 "CharStore". These variables of the data type "Char" have a length of one byte.
- The data is converted byte for byte from the hexadecimal format into the ASCII format.
- After data type conversion, the separate characters are stored byte for byte in DB1.
- The FC1 "HexAscII" is called once for each conversion to the "CHAR" character type.
Fig. 01 shows an example of how the control value "ABC1 23DE" (hexadecimal format) and the individual characters in ASCII format are stored in DB1. The attached download contains an archived STEP 7 V5.5 project with the STEP 7 program described above including the German and English comments.
You must parameterize the inputs below for executing the FC1 "HexAscII" function.
||Enable input. The function is enable with a "True" signal at the "EN" input parameter.|
||Input of the number to be converted in double-word format|
||Input of the number of the DB where the result is to be stored.|
||Input of the number of the byte as of which the result is to be stored in the DB.|
Copy the "STEP7_V55_Hex_ASCII.zip" file into a separate directory and then start the file with a double-click. The STEP 7 project is now unpacked automatically with all the associated subdirectories. You can then use STEP 7 V5.5 to open and process the extracted project.
STEP7_V55_Hex_ASCII.zip ( 128 KB )
The pictures in this FAQ were created with STEP 7 V5.5.