DL06 Micro PLC User Manual, 3rd Edition, Rev. E
3-24
Chapter 3: CPU Specifications and Operation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
A
B
C
D
V–Memory
Variable memory (V-memory) stores data for the ladder program and for configuration settings.
V-memory locations and V-memory addresses are the same thing, and are numbered in octal.
For example, V2073 is a valid location, while V1983 is not valid (9 and 8 are not valid octal
digits).
Each V-memory location is one data word wide, meaning 16 bits. For configuration registers,
our manuals will show each bit of a V-memory word. The least significant bit (LSB) will be
on the right, and the most significant bit (MSB) on the left. We use the word “significant”,
referring to the relative binary weighting of the bits.
V-memory data is
16-bit binary,
but we rarely program the data registers one bit at a time. We use instructions or viewing tools
that let us work with decimal, octal, and hexadecimal numbers. All these are converted and
stored as binary for us.
A frequently-asked question is “How do I tell if a number is octal, BCD, or hex?” The answer
is that we usually cannot tell just by looking at the data ... but it does not really matter. What
matters is, the source or mechanism which writes data into a V-memory location and the thing
which later reads it must both use the same data type (i.e., octal, hex, binary, or whatever). The
V-memory location is just a storage box ... that’s all. It does not convert or move the data on
its own.
Binary-Coded Decimal Numbers
Since humans naturally count in
decimal (10 fingers, 10 toes), we prefer to enter and view PLC data in decimal as well.
However, computers are more efficient in using pure binary numbers. A compromise solution
between the two is Binary-Coded Decimal (BCD) representation. A BCD digit ranges from
0 to 9, and is stored as four binary bits (a nibble). This permits each V-memory location to
store four BCD digits, with a range of decimal numbers from 0000 to 9999.
In a pure binary sense, a 16-bit word can represent numbers from 0 to 65535. In storing BCD
numbers, the range is reduced to only 0 to 9999. Many math instructions use Binary-Coded
Decimal (BCD) data, and
Direct
SOFT and the handheld programmer allow us to enter and
view data in BCD.
Hexadecimal Numbers
Hexadecimal numbers are similar to BCD numbers, except they utilize all possible binary
values in each 4-bit digit. They are base-16 numbers so we need 16 different digits. To extend
our decimal digits 0 through 9, we use A through F as shown.
A 4-digit hexadecimal number can represent all 65536 values in a V-memory word. The range
is from 0000 to FFFF (hex). PLCs often need this full range for sensor data, etc. Hexadecimal
is just a convenient way for humans to view full binary data.
0 1 0 0 1 1 1 0 0 0 1 0 1 0 0 1
MSB
LSB
V-memory data
(binary)
V-memory address
(octal)
V2017
0 1 0 0
1 0 0 1
0 0 1 1
0 1 1 0
4
9
3
6
V-memory storage
BCD number
1 0 1 0
0 1 1 1
1 1 1 1
0 1 0 0
A
7
F
4
V-memory storage
Hexadecimal number
8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7
8 9 A B C D E F
0 1 2 3 4 5 6 7
Decimal
Hexadecimal