Programmable Logic Controllers. Su Chen Jonathon Lin
Чтение книги онлайн.

Читать онлайн книгу Programmable Logic Controllers - Su Chen Jonathon Lin страница 17

Название: Programmable Logic Controllers

Автор: Su Chen Jonathon Lin

Издательство: Ingram

Жанр: Физика

Серия:

isbn: 9780831193690

isbn:

СКАЧАТЬ 3.6.6Converting Hexadecimal to Decimal

      The procedure of converting a hexadecimal number to its decimal equivalent starts by multiplying the place values (1, 161, 162,…, 16n) to their corresponding digits and summing the results. For example, the procedure of converting 5AC16 to decimal follows.

image

       Example 3.7: Converting B9516 to its decimal equivalent

      The decimal equivalent of B9516 is calculated as below:

image

       3.6.7Converting Binary to Octal

      Converting a binary number to its octal equivalent involves three steps (Figure 3.4). The first step separates the binary number into groups of three digits, starting from right to left. The second step assigns its octal equivalent for each three-digit group. The last step assembles the octal equivalent values in the proper sequence.

image

      Figure 3.4: Converting a binary number to its octal equivalent

       Example 3.8: Converting 110011012 to its octal equivalent

      110011012 has a total of 8 digits that can form three 3-digit groups with the third group having only 2 most significant digits. The binary digits in these three groups are:

image

      The octal equivalent of 110011012 becomes 3158.

       3.6.8Converting Octal to Binary

      Converting an octal number to its binary equivalent is the reverse of converting binary to octal. It involves the following two steps:

      •Convert each octal digit to its 3-digit equivalent.

      •Assemble the binary equivalent values in the proper sequence.

       Example 3.9: Converting 6358 to its binary equivalent

      The converting process follows:

image

      The binary equivalent of 6358 becomes 1100111012.

       3.6.9Converting Binary to Hexadecimal

      Converting a binary number to its hexadecimal equivalent involves the same three steps as converting binary to octal, except hexadecimal conversion involves 4-bit binary groupings. Four-bit groupings are used because each hexadecimal digit can be represented in four binary digits (Figure 3.5).

image

      Figure 3.5: Converting a binary number to its hexadecimal number

       Example 3.10: Converting 101100111010102 to its hexadecimal equivalent

      The binary 101100111010102 has 14 digits that can form four 4-bit groups with the fourth group having only 2 digits. The binary digits in these four groups are:

image

      The hexadecimal equivalent of 101100111010102 becomes 2CEA16.

       3.6.10Converting Hexadecimal to Binary

      Converting a hexadecimal number to its binary equivalent is the reverse of converting binary to hexadecimal. It involves the following two steps:

      •Convert each hexadecimal digit to its 4-digit equivalent.

      •Assemble the binary equivalent values in the proper sequence.

       Example 3.11: Converting A3C16 to its binary equivalent

      The converting process is as follows:

image

      The binary equivalent of A3C16 becomes 1010001111002.

      The operation of PLCs involves manipulation, transmission, and storage of data in various forms. PLCs are digital devices that can readily handle binary data. However, binary data in series of ones and zeros are intuitively difficult for humans to understand and interpret. The binary data must be converted to interpretable formats of numerals, letters, and symbols. The techniques to assign binary patterns to numerals, letters, and symbols are referred to as binary encoding. Several binary coding standards have been established. Some commonly used binary coding standards are ASCII, BCD, and Gray codes. They are introduced in the following three sections.

      ASCII code, pronounced as-kee, stands for American Standard Code for Information Interchange. This coding standard provides a set of alphanumeric characters to be used for information interchange in communication systems, computing systems, and peripheral equipment manufactured by different vendors.

      ASCII code can be 6, 7, or 8 bits. A 6-bit code can represent a total of 64 (or 26) possible characters; 7-bit code for 128 (or 27) characters; and 8-bit code for 256 (or 28) characters. Standard ASCII uses a 7-bit code with 128 possible characters to represent upper and lower case alphabets, 0 through 9 numerals, punctuation marks, standard symbols, and other special symbols. The 8-bit ASCII character set is referred to as extended ASCII. The 8-bit ASCII set allows the parity check function to be added to a standard 7-bit code (Table 3.9). In communication, parity checking refers to the use of parity bits to check that data has been transmitted accurately. The parity bit is added to every data unit (typically 7 or 8 bits) that is transmitted.

      The development of binary coded decimal (BCD) arose from the need for allowing data to be input to, and output from, digital devices such as computers and PLCs, in the form of decimal numbers. The purpose of BCD code is to facilitate the communication between the operator and digital devices; that is, to allow humans to use decimal numbers and digital devices to process binary numbers. BCD represents each of ten decimal numbers (0 – 9) as a 4-bit binary number. Table 3.10 summarizes the binary and BCD equivalents of ten decimals (0 – 9).

      The BCD representation of a decimal number can be readily obtained by replacing each decimal digit by its BCD equivalent, which can be found from Table 3.10.

      Table 3.9: Partial listing of 8-bit ASCII code

image

      Table 3.10: Binary and BCD equivalents of ten decimals (0 – 9)

DecimalBinaryBCD
000000
1010001
2100010
3110011
41000100
51010101
61100110
71110111
810001000
910011001
СКАЧАТЬ