Appendix
G
Numbering
S
ystems
G--8
Numbering Systems
DL105 PLC User Manual, 3rd Edition
Data Type Mismatch
Data type mismatching is a common problem when using an operator interface.
Diagnosing it can be a challenge until you identify the symptoms. Since the PLC
uses BCD as the native format, many people tend to think it is interchangeable with
binary (unsigned integer) format. This is true to some extent, but not in this case.
Table 8 shows how BCD and binary numbers differ.
Data Type Mismatch
Decimal
0
1
2
3
4
5
6
7
8
9
10
11
BCD
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 0001 0000 0001 0001
Binary
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 0000 1010 0000 1011
Table 8
As the table shows, BCD and binary share the same bit pattern up until you get to the
decimal number 10. Once you get past 10, the bit pattern changes. The BCD bit
pattern for the decimal 10 is actually equal to a value of 16 in binary, causing the
number to jump six digits by when viewing it as the BCD. With larger numbers, the
error multiplies. Binary values from 10 to 15 Decimal are actually invalid for the BCD
data type.
Looking at a larger number, such as the value shown in Table 9, both the BCD bit
pattern and the decimal bit pattern correspond to a base 10 value of 409510. If bit
patterns are read, or interpreted, in a different format than what is used to write them,
the data will not be correct. For instance, if the BCD bit pattern is interpreted as a
decimal (binary) bit pattern, the result is a base 10 value of 1653310. Similarly, if you
try to view the decimal (binary) bit pattern as a BCD value, it is not a valid BCD value
at all, but could be represented in hexadecimal as 0xFFF.
Base 10 Value
BCD Bit Pattern
Binary Bit Pattern
4095
0100 0000 1001 0101
1111 1111 1111
Table 9
Look at the following examples and note the same value represented by the different
numbering systems. The decimal values of 67 and 4660 are used.
6
7 Decimal
4
6
6
0 Decimal
0110 0111 BCD
0100 0110 0110 0000 BCD
0100 0011 Binary
0001 0010 0011 0100 Binary
4
3 Hex
1
2
3
4 Hex
1
0
3 Octal
1
1
0
6
4 Octal
Содержание DL105
Страница 2: ...DL105 PLC User Manual Manual Number D1 USER M...
Страница 308: ...1B DL105 Error Codes In This Appendix Error Code Table...
Страница 314: ...1C Instruction Execution Times In This Appendix Introduction Instruction Execution Times...
Страница 324: ...1D Special Relays In This Appendix DL105 PLC Special Relays...
Страница 327: ...1E PLC Memory In This Appendix DL105 PLC Memory...
Страница 329: ...1F European Union Directives CE In This Appendix European Union EU Directives Basic EMC Installation Guidelines...