Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 34 of 38

DL06 Micro PLC User Manual, Volume 2 of 2, pages 330 to 339

Pages 330 to 339 of 370

The original document is the PDF (6.0 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the AutomationDirect Direct Logic DL06

Page 330

Appendix G: ASCII Table

ASCII Conversion Table

1 2 3 4 5 6 G 8 9 10 11 12 13 14 A B C D

DECIMAL TO HEX TO ASCII CONVERTER

G-2

DEC

HEX

ASCII

DEC

HEX

ASCII

DEC

HEX

ASCII

DEC

HEX

ASCII

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F

NUL SOH STX ETX EOT ENQ ACK BEL BS TAB LF VT FF CR SO SI DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US

32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63

20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F space ! “ # $ % & ‘ ( ) * + , . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ?

64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95

40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F

@ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _

96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127

60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F

` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ DEL

DL06 Micro PLC User Manual, 3rd Edition Rev. A

Page 331 read from a scan by OCR; it may hold reading errors

*PENDIX

H

Product Weight Table .............. ee eee ee ee H-2

PRODUCT WEIGHTS

In this Appendix

Page 332

Appendix H: Product Weights

Product Weight Table

1 2 3 4 E 6 7 H 9 10 11 12 13 14 A B C D H–2

PLC

Weight

D0–06AR D0–06DR D0–06DR-D D0–06AA D0–06DA D0–06DD1 D0–06DD1-D D0–06DD2-D D0–06DD2 D0–06LCD

1.78 lb./807g. 1.76 lb./798 g. 1.72 lb./780 g. 1.78 lb./807 g. 1.76 lb./798 g. 1.68 lb./762 g. 1.64 lb./743 g. 1.64 lb./743 g. 1.68 lb./798 g. 0.12 lb./54.4g.

DL06 Micro PLC User Manual, 3rd Edition Rev. A

Page 333

NUMBERING SYSTEMS

ENDIX A PPENDIX

I

In this Appendix Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .I–2 Binary Numbering System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .I–2 Hexadecimal Numbering System . . . . . . . . . . . . . . . . . . . . . . . . . . .I–3 Octal Numbering System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .I–4 Binary Coded Decimal (BCD) Numbering System . . . . . . . . . . . . . . .I–5 Real (Floating Point) Numbering System . . . . . . . . . . . . . . . . . . . . . .I–5 BCD/Binary/Decimal/Hex/Octal - What is the Difference? . . . . . . . . .I–6 Data Type Mismatch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .I–7 Signed vs. Unsigned Integers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .I–8 AutomationDirect.com Products and Data Types . . . . . . . . . . . . . . .I–9

Page 334

Appendix I: Numbering Systems

Introduction As almost anyone who uses a computer is somewhat aware, the actual operations of a 1 computer are done with a binary number system. Traditionally, the two possible states for a binary system are represented by the digits for "zero" (0) and "one" (1) although "off" and 2 "on" or sometimes "no" and yes" are closer to what is actually involved. Most of the time a typical PC user has no need to think about this aspect of computers, but every now and then 3 one gets confronted with the underlying nature of the binary system. A PLC user, specifically the PLC programmer, should be familiar with the binary system. This appendix will provide an explaination of the numbering systems most commonly used 4 by a PLC. E Binary Numbering System Computers, includeing PLCs, use the Base 2 numbering system, which is called Binary and 6 often called Decimal. Like in a computer there are only two valid digits a PLC relys on, zero and one, or off and on respectively. You would think that it would be hard to have a 7 numbering system built on Base 2 with only two possible values, but the secret is by encoding using several digits. Each digit in the base 2 system when referenced by a computer is called a bit. When four bits H are grouped together, they form what is known as a nibble. Eight bits or two nibbles would be a byte. Sixteen bits or two bytes would be a word (Table 1). Thirty-two bits or two words I is a double word. Word 10 Byte Byte 11 Table 1 12 Binary is not “natural” for us to use since we grow up using the base 10 system. Base 10 uses the numbers 0-9, as we are all well aware. From now on, the different bases will be shown as a 13 subscripted number following the number. Example; 10 decimal would be 10 . Table 2 shows how base 2 numbers relate to their decimal equivalents. 14 A nibble of 1001 would be equal to a decimal number 9 (1*2 + 1*2 or 8 + 1 ). A byte of 11010101 would be equal to 213 (1*2 + 1*2 +1*2 + 1*2 +1*2 or 128 + 64 + 16 + A 4 + 1 ). Binary/Decimal Bit Pattern B C D Nibble Nibble Nibble Nibble 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

10

3

2

7

2

4

0

10

10

10

10

10

16384

8192

4096

2048

1024

512

7 27

6 26

5 25

4 24

3 23

2 22

1 21

0 20

1

Decimal Bit Value

8 28

2

9 29

4

10 210

8

11 211

16

12 212

32

13 213

64

14 214

128

15 215

256

Bit # Power

Max Value

6553510

Table 2

I–2

2

10

32678

10

6

0

DL06 Micro PLC User Manual, 3rd Edition Rev. A

Page 335

Appendix I: Numbering Systems

Hexadecimal Numbering System

1 2 3 4 E Decimal Hex Decimal Hex 6 7 H I Table 3 10 Note that “10” and “11” in hex are not the same as “10” and “11” in decimal. Only the first ten numbers 0-9 are the same in the two representations. For example, consider the hex 11 number “D8AF”. To evaluate this hex number use the same method used to write decimal numbers. Each digit in a decimal number represents a multiple of a power of ten (base 10). Powers of ten increase from right to left. For example, the decimal number 365 means 3x10 12 + 6x10 + 5. In hex each digit represents a multiple of a power of sixteen (base 16). Therefore, the hex number D8AF translated to decimal means 13x16 + 8x16 + 10x16 + 15 = 55471. 13 However, going through the arithmetic for hex numbers in order to evaluate them is not really necessay. The easier way is to use the calculator that comes as an accessory in Windows. It can convert between decimal and hex when in “Scientific” view. 14 Note that a hex number such as “365” is not the same as the decimal number “365”. Its actual value in decimal terms is 3x16 + 6x16 + 5 = 869. To avoid confusion, hex numbers are A often labeled or tagged so that their meaning is clear. One method of tagging hex numbers is to append a lower case “h” at the end. Another method of labeling is to precede the number B with 0x. Thus, the hex number “D8AF” can also be written “D8AFh”, where the lower case “h” at the end is just a label to make sure we know that it is a hex number. Also, D8AF can be written with a labeling prefix as “0xD8AF”. C D The binary numbering system can be difficult and cumbersome to interpret for some users. Therefore, the hexadecimal numbering system was developed as a convenience for humans since the PLC (computer) only uderstands pure binary. The hexadecimal system is useful because it can represent every byte (8 bits) as two consecutive hexadecimal digits. It is easier for us to read hexadecimal numbers than binary numbers. The hexadecimal numbering system uses 16 characters (base 16) to represent values. The first ten characters are the same as our decimal system (0-9), and the first six letters of the alphabet (A-F). Table 3 lists the first eighteen decimal numbers; 0-17 in the left column and the equivalent hexadecimal numbers are shown in the right column. 0 1 2 3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

9 10 11 12 13 14 15 16 17

9 A B C D E F 10 11

2

3

2

2

DL06 Micro PLC User Manual, 3rd Edition Rev. A

I–3

Page 336

Appendix I: Numbering Systems

Octal Numbering System

1 2 3 4 E 6 7 H I 10 11 12 13 14 A B C D I–4

Many of the early computers used the octal numbering system for compiled printouts. Today, the PLC is about the only device that uses the Octal numbering system. The octal numbering system uses 8 values to represent numbers. The values are 0-7 being Base 8. Table 4 shows the first 31 decimal digits in octal. Note that the octal values are 0-7, 10-17, 20-27, and 30-37. Octal

Decimal

Octal

Decimal

0 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

Table 4 This follows the DirectLOGIC PLCs. Refer to Chapter 3 bit maps and notice that the memory addresses are numbered in octal, as well as each bit. The octal system is much like counting in the decimal system without the digits 8 and 9 being available. The general format for four digits of the octal number is: (d x 80) + (d x 81) + (d x 82) + (d x 83) where “d” means digit. This is the same format used in the binary, decimal, or hexadecimal systems except that the base number for octal is 8. Using the powers of expansion, the example below shows octal 4730 converted to decimal. positional value

512

64

4

7

8

3

1

0 0 x 80 = 0 x 1= 0 1 8= 24 3x8 =3x 7 x 82 = 7 x 64 = 448 4 x 83 = 4 x 512 = 2048 2520

DL06 Micro PLC User Manual, 3rd Edition Rev. A decimal equivalent

Page 337

Appendix I: Numbering Systems

Binary Coded Decimal (BCD) Numbering System

1 2 3 BCD Bit Pattern 4 E Table 5 6 One plus for BCD is that it reads like a decimal number, for example, 867 in BCD would be expressed the same as 867 decimal. No conversion is needed; however, within the PLC, BCD 7 calculations can be performed if numbers are adjusted to BCD after normal binary arithmetic. H Real (Floating Point) Numbering System I The terms Real and floating-point both describe IEEE-754 floating point arithmetic. This standard specifies how single precision (32 bit) and double precision (64 bit) floating point numbers are to be represented as well as how arithmetic should be carried out on them. 10 Real (Floating Point 32) Bit Pattern 11 12 Table 6 13 Most PLCs use the 32-bit format for floating point (or Real) numbers. Floating point numbers which DirectLOGIC PLCs use have three basic components: sign, 14 exponent and mantissa. The 32 bit word required for the IEEE standard floating point numbers is shown in Table 6. It is represented as a number from 0 to 31, left to right. The A first bit (31) is the sign bit, the next eight bits (30-23) are the exponent bits and the final 23 bits (22-0) are the fraction bits. In summary: The sign bit is either “0” for positive or “1” for negative; B The exponent uses base 2; The first bit of the mantissa is typically assumed to be “1.fff ”, where “f ” is the field of C fraction bits. The Internet can provide a more indepth explaination of the floating point numbering D system. One website to look at is: BCD is a numbering system where four bits are used to represent each decimal digit. The binary codes corresponding to the hexadecimal digits A-F are not used in the BCD system. For this reason numbers cannot be coded as efficiently using the BCD system. For example, a byte can represent a maximum of 256 different numbers (i.e. 0-255) using normal binary, whereas only 100 distinct numbers (i.e. 0-99) could be coded using BCD. Also, note that BCD is a subset of hexadecimal and neither one does negative numbers. Bit # Power Bit Value Max Value

15 8

14 13 103 4 2 9

12

11

1

8

10 9 102 4 2 9

Bit # 31 30 Sign

29

28

27 26 Exponent

Bit # 15

13

12

11

14

25

8

7

6

5

4

3

2

1

10

1

8

4

23

22

0

2

1

10

2

1

8

4

9

24

1

0

21

10 9 8 7 6 5 Mantissa (continues from above)

9

20 19 18 Mantissa

17

16

4

1

0

3

2 http://www.psc.edu/general/software/packages/ieee/ieee.html DL06 Micro PLC User Manual, 3rd Edition Rev. A

I–5

Page 338

Appendix I: Numbering Systems

BCD/Binary/Decimal/Hex/Octal 1 What is the Difference?

I–6

Sometimes there is confusion about the differences between the data types used in a PLC. The PLC’s native data format is BCD, while the I/O numbering system is octal. Other numbering formats used are binary and Real. Although data is stored in the same manner (0’s and 1’s), there are differences in the way that the PLC interprets it. While all of the formats rely on the base 2 numbering system and bit-coded data, the format of the data is dissimilar. Table 7 below shows the bit patterns and values for various formats. 10

9

8

7

6

5

4

3

2

1

0

Decimal Bit Value

8192 8192

4096 4096

2048 2048

1024 1024

512 512

256 256

128 128

64 64

32 32

11

11

22

12

44

13

88

14

16 16

15

16384 16384

Binary/Decimal Bit Pattern Bit #

32678 32678

2 3 4 E 6 7 H I 10 11 12 13 14 A B C D

Bit # Decimal Bit Value Max Value

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

8

4

2

1

8

4

2

1

8

4

2

1

8

4

2

1

Bit # Decimal Bit Value Max Value

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

8

4

2

1

8

4

2

1

8

4

2

1

8

4

2

1

2 4

1 2 7

0 1

20 19 18 Mantissa

17

16

4

1

0

Max Value

65535

Hexadecimal Bit Pattern

F

F

F

F

BCD Bit Pattern

9

9

9

9

Octal Bit Pattern Bit # Bit Value Max Value

15 1 1

14 4

13 2 7

12 1

11 4

10 2 7

9 1

8 4

7 2 7

6 1

5 4

4 2 7

3 1

Real (Floating Point 32) Bit Pattern Bit #

31 30 Sign

29

28

27 26 Exponent

Bit #

15

13

12

11

14

25

24

23

22

21

10 9 8 7 6 5 Mantissa (continued from above)

3

2

Table 7 As seen in Table 7, the BCD and hexadecimal formats are similar, although the maximum number for each grouping is different (9 for BCD and F for hexadecimal). This allows both formats to use the same display method. The unfortunate side effect is that unless the data type is documented, it’s difficult to know what the data type is unless it contains the letters A-F.

DL06 Micro PLC User Manual, 3rd Edition Rev. A

Page 339

Appendix I: Numbering Systems

Data Type Mismatch

1 2 3 Data Type Mismatch 4 E Table 8 As the table shows, BCD and binary share the same bit pattern up until you get to the 6 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 7 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 H and the decimal bit pattern correspond to a base 10 value of 4095 . 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, I the result is a base 10 value of 16533 . 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 10 hexadecimal as 0xFFF. 11 Base 10 Value BCD Bit Pattern Binary Bit Pattern Table 9 12 Look at the following example and note the same value represented by the different 13 numbering systems. 0100 0011 Binary 0001 0010 0011 0100 Binary 14 6 7 Decimal 4 6 6 0 Decimal 1 2 3 4 Hex 4 3 Hex A 0110 0111 BCD 0100 0110 0110 0000 BCD 1 0 3 Octal 1 1 0 6 4 Octal B C D 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. Decimal 0 1 2 3 4 5 6 7 8 9 BCD 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001

10 0001 0000 0000 1010

11 0001 0001 0000 1011

10

10

4095

0100 0000 1001 0101

1111 1111 1111

DL06 Micro PLC User Manual, 3rd Edition Rev. A

I–7