Make your own free website on Tripod.com
Updated May 22 2003

Intro to ASCII and hexadecimal


Before we start into PCL we need to learn a little background information on the tools we will be using and how to use them.

ASCII Character Set

Computers only work in ones and zeros or binary.  When I press the capital E on my keyboard, an E does not go through the computer.  A series of ones and zeros will be processed by the computer.  How does the computer know that our series of ones and zeros is to represent a capital E?  There is a look up table the computer can use to see how the character "E", the binary code represents, should be display on the monitor or originally, how a printer should print the E on paper.  This is the ASCII character set.  It contains the uppercase and lowercase letters, numbers, and symbols and how they are displayed.  It also contains control codes.  We can insert the control codes into our document to make the display or printer do certain things.  Common control codes would include a space, tab, and backspace, a carriage and line feed, and many others.

Hexadecimal

In the ASCII table, our capital E is represented in binary as 0100 0101.  If we where to work in a binary editor, things would be tough and hard to troubleshoot and remember everything.  Generally nasty.  To make thing easier we use the Hexadecimal number system which the computer can easily translate into binary.  To continue our example:

E = 0100 0101 = 45 = 45h

Currently this is not a lesson on numbering systems.  Here is a chart you can look at to see the comparison between binary, decimal, and hexadecimal.

Binary
Decimal
Hexadecimal
0000
0
0
0001
1
1
0010
2
2
0011
3
3
0100
4
4
0101
5
5
0110
6
6
0111
7
7
1000
8
8
1001
9
9
1010
10
A
1011
11
B
1100
12
C
1101
13
D
1110
14
E
1111
15
F

So, you ask, why are you telling me this?  Well, we will be using a hex editor to build our print jobs in PCL and PJL so you will need a basic understanding on how to read the ASCII and other character sets tables and how to enter them in the hex editor.  Lets take a look at the ASCII Table.


HEX
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
0
NUL
SOH
STX
ETX
EOT
ENQ
ACK
BEL
BS
HT
LF
VT
FF
CR
SO
SI 
1
DLE
DC1
DC2
DC3
DC4
NAK
SYN
ETB
CAN
EM
SUB
ESC
FS
GS
RS
US
2
SP
!
"
#
$
%
&
'
(
)
*
+
,
-
.
/
3
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
4
@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
5
P
Q
R
S
T
U
V
W
X
Y
Z
[
\
]
^
_
6
`
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
7
p
q
r
s
t
u
v
w
x
y
z
{
|
}
~
DEL



The hex values run along the top and left side.  Pick the character you want and read the left hex value first and the top hex value second.  Now you can see how E is 45.  There is another way people draw the ASCII table.  E is still 45 but as you can see the layout of the numbering is slightly different.

HEX
00
10
20
30
40
50
60
70
0 NUL
DLE
SP
0
@
P
`
p
1 SOH
DC1
!
1
A
Q
a q
2 STX
DC2
"
2
B
R
b r
3 ETX
DC3
#
3
C
S
c s
4 EOT
DC4
$
4
D
T
d t
5 ENQ
NAK
%
5
E
U
e u
6 ACK
SYN
&
6
F
V
f v
7 BEL
ETB
'
7
G
W
g w
8 BS
CAN
(
8
H
X
h x
9 HT
EM
)
9
I
Y
i y
A LF
SUB
*
:
J
Z
j z
B VT
ESC
+
;
K
[
k {
C FF
FS
,
<
L
\
l |
D CR
GS
-
=
M
]
m }
E SO
RS
.
>
N
^
n ~
F
SI
US
/
?
O
_
o DEL


Control Codes

Control Codes (Control Characters) are used to control different functions on the display or printer as briefly described in the first paragraph.
Here is the list of control codes supported by most printers.

BS     BackSpace
HT     Horizontal Tab
LF      Line Feed
FF      Form Feed
CR     Carriage Return
SO     Shift Out
SI       Shift In
ESC   ESCape
SP      SPace


Here are the others if you are interested.

NUL    NULL
SOH    Start Of Heading
STX    Start of TeXt
ETX    End of TeXt
EOT    End Of Transmission
ENQ    ENQuiry
ACK   ACKnowledge
BEL    BELl
DLE    Data Link Escape
DC1    Device Control 1
DC2    Device Control 2
DC3    Device Control 3
DC4    Device Control 4
NAK    Negative AcKnowledge
SYN    SYNchronous idle
ETB     End of Transmission Block
CAN   CANcel
EM      End of Medium
SUB    SUBstitute
FS       File Seperator
GS      Group Seperator
RS      Record Seperator
US      Unit Seperator


Prev     Beginning     Next