The STEP 7 (TIA Portal) V11 program "STEP7_V11_Hex_ASCII" converts a hexadecimal number into ASCII characters. The two functions "DataCalc" and "HexAscII" store the separate characters in ASCII format in data block DB1. These variables of the data type "Char" have a length of one byte.
- The "DataCalc" converts the data byte for byte from the hexadecimal format into the ASCII format.
- The "HexAscII" function is for the byte-for-byte preparation for data type conversion with the FC "DataCalc" and for saving the data in DB1.
- The FC "DataCalc" is called once in the FC "HexAscII" for each conversion to the character type "CHAR".
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 V11 project with the STEP 7 program described above including the German and English comments.
Copy the "STEP7_V11_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 V11 to open and process the extracted project.
STEP7_V11_Hex_ASCII.zip ( 6816 KB )
The screens and download in this FAQ response were created with STEP 7 (TIA Portal) V11+SP2.