show the entry list
STEP 7 -- Creating S7 programs -- Executing operations
 How in STEP 7 V5.x do you program signal generation (rectangle, sawtooth, triangle, sinus) using the cyclic interrupts? How do you determine the velocity, acceleration and distance? How can you address I/O bytes and individual bits via the I/O? How do you implement numerical differentiation in STEP 7 V5.5? How can you convert a hexadecimal number into ASCII characters with STEP 7 V5.5? What should you watch out for with the display of negative integer values in the LAD/STL/FBD editor when monitoring? Information on the topic of "Executing operations" How do you calculate power, exponential, root, polynomial, logarithm and linear values and how do you convert trigonometric functions into degrees? How can you convert a number value of the data type INT into a string in S5TIME, or into the data types BCD and REAL? How can you delay the output signal in relation to the input signal? How can you accumulate physical flow measurements (e.g. mass flow rate, flow velocity) to an overall value? How do you monitor a 32-bit field, evaluate the position of an active bit and access individual bits of a double-word? How can you link variables and block parameters with each other? How do you check real numbers for parity? How is numerical integration programmed in S7-SCL and STEP 7? When is there a first scan in logic operation sequences? What does the NOP statement in the STL editor mean in STEP 7? How accurately can I calculate with REAL numbers that are used in extensive formulas? Which functions and IEC standard functions exist in STEP 7 for converting and comparing string variables? How do you program a shift register with the LAD/FBD statements in STEP 7 V5.5 and in V11?
How can you convert a hexadecimal number into ASCII characters with STEP 7 V5.5?
Part number:

Description
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

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.

 Inputs Data type Description EN Boolean Enable input. The function is enable with a "True" signal at the "EN" input parameter. in_dword Dword Input of the number to be converted in double-word format db_no Block_DB Input of the number of the DB where the result is to be stored. db_byte Int 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 )

Creation environment
The pictures in this FAQ were created with STEP 7 V5.5.

 Entry ID:1549540 Date:2011-08-29