December 2001 PLC Modules 7 – 183
Module 9054 Conversion from ASCII/hexadecimal → binary
Module 9054 converts strings of ASCII-coded hexadecimal values into a block
of binary values in the word-marker range. The string in the specified string
memory is interpreted as a sequence of ASCII-coded hexadecimal numbers
and converted into a block of corresponding binary bytes. Two ASCII
characters produce one binary byte. The TNC saves the binary block beginning
at the specified address in the word-marker range.
Call:
PS B/W/D/K <String address in which the hexadecimal value is saved>
PS B/W/D/K <Word address from which the TNC saves the binary
values>
CM 9054
Error recognition:
Example Initial state:
SO = “63”
BO = 99
Marker Value Meaning
M4203 0 Number was converted
1 For error see W1022
W1022 2 Invalid string address
11 Invalid word address
Odd number of characters in the string or a character
that cannot be interpreted as hexadecimal
Function STL String accu. (characters), or logic accu. [bit]
1..128
Push string address
S0 onto the data
stack
PS K+0 63
7 .................. 0
Push word address
B0 onto the data
stack
PS B0 xxxxxxxx
Conversion of the
two ASCII characters
6 and 3 into the
binary number 99
CM 9054
0 1 1
6
0 0 0 1
3
1