Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Jack H.Automating manufacturing systems with PLCs.2005.pdf
Скачиваний:
261
Добавлен:
23.08.2013
Размер:
5.34 Mб
Скачать

plc numbers - 13.10

13.2.2 Other Base Number Systems

Other number bases are typically converted to and from binary for storage and mathematical operations. Hexadecimal numbers are popular for representing binary values because they are quite compact compared to binary. (Note: large binary numbers with a long string of 1s and 0s are next to impossible to read.) Octal numbers are also popular for inputs and outputs because they work in counts of eight; inputs and outputs are in counts of eight.

An example of conversion to, and from, hexadecimal is shown in Figure 13.14 and Figure 13.15. Note that both of these conversions are identical to the methods used for binary numbers, and the same techniques extend to octal numbers also.

163 = 4096 162 = 256 161 = 16 160 = 1

f 8 a 3

15(163) = 61440 8(162) = 2048

10(161) = 160 3(160) = 3

63651

Figure 13.14 Conversion of a Hexadecimal Number to a Decimal Number

5724

 

=

357.75

 

16(0.75) = 12 ’c’

 

-----------

 

 

 

16

 

 

 

 

 

 

357

 

 

 

 

 

 

--------

= 22.3125

16(0.3125) = 5

 

16

 

 

 

 

 

 

22

 

 

 

 

1 6 5 c

-----

=

1.375

16(0.375) = 6

 

16

 

 

 

 

 

1

 

 

 

 

 

 

-----

 

=

0.0625

16(0.0625) = 1

 

16

 

 

 

 

 

 

Figure 13.15 Conversion from Decimal to Hexadecimal