Page 73 - Programmable Logic Controllers, Fifth Edition - Mobile version
P. 73

0110  0111 0101  0100
                                                  1100
                       0010                                                               Light source
                                                      1101
                     0011


                    0001                                 1111
                                         1
                                         1             1110
                       0000              0
                                          1
                            1000               1010
                                  1001   1011                                                 Sensors
               Figure 3-15  Optical encoder disk.
               Source: Photo courtesy Baumer Electric.





               angular position. In this example, the encoder disk is at-  memory to represent the alphanumeric, function, or
               tached to a rotating shaft and outputs a digital Gray code   control data represented by the specific keyboard key
               signal that is used to determine the position of the shaft.   that was depressed.  ASCII input modules convert
               A fixed array of photo diodes senses the reflected light   ASCII code input information from an external device
               from each of the cells across a row of the encoder path.   to alphanumeric information that the PLC can pro-
               Depending on the amount of light reflected, each cell   cess. The communication interfacing is done through
               will output a voltage corresponding to a binary 1 or 0.   either an RS-232 or RS-422 protocol. Modules are
               Thus, a different 4-bit word is generated for each row of   available that will transmit and receive ASCII files
               the disk.                                             and that can be used to create an operator interface.
                                                                     The user writes a program in the BASIC language that
                                                                     operates in conjunction with the ladder logic as the
               3.8  ASCII Code                                       program runs.

               ASCII stands for American Standard Code for Informa-
               tion Interchange. It is an alphanumeric code because it in-  3.9  Parity Bit
               cludes letters as well as numbers. The characters accessed
               by the ASCII code include 10 numeric digits; 26 lower-  Some PLC communication systems use a binary bit to
               case and 26 uppercase letters of the alphabet; and about   check the accuracy of data transmission. For example,
               25 special characters, including those found on a standard   when data are transferred between PLCs, one of the bi-
               typewriter. Table 3-8 shows a partial listing of the ASCII   nary digits may be accidentally changed from a 1 to a 0.
               code. It is used to interface the PLC CPU with alphanu-  This can happen because of a transient or a noise or be-
               meric keyboards and printers.                         cause of a failure in some portion of the transmission net-
                  The ASCII code is a seven-bit code in which the deci-  work. A parity bit is used to detect errors that may occur
               mal digits are represented by the 8-4-2-1 BCD code pre-  while a word is moved.
               ceded by 011. Uppercase letters are preceded by 100 or   Parity is a system in which each character transmitted
               101. Lowercase letters are preceded by 110 or 111. Char-  contains one additional bit. That bit is known as a par-
               acter symbols are preceded by 010, 011, 101, and 111.   ity bit. The bit may be a binary 0 or binary 1, depend-
               This seven-bit code provides all possible combinations of   ing on the number of 1s and 0s in the character itself.
               characters used when communicating with peripherals or   Two systems of parity are normally used: odd and even.
               interfaces in a PLC system.                           Odd parity means that the total number of binary 1 bits in
                  The keystrokes on the keyboard of a computer are   the character, including the parity bit, is odd. Even parity
               converted directly into ASCII for processing by the   means that the number of binary 1 bits in the character, in-
               computer. Each time you press a key on a computer     cluding the parity bit, is even. Examples of odd and even
               keyboard, a 7-  or 8-bit word is stored in computer   parity are shown in Table 3-9.





               54         Chapter 3  Number Systems and Codes







          pet73842_ch03_046-060.indd   54                                                                               03/11/15   3:50 PM
   68   69   70   71   72   73   74   75   76   77   78