Page 132 - Understanding Automotive Electronics
P. 132

2735 | CH 4  Page 119  Tuesday, March 10, 1998  11:06 AM



                                         MICROCOMPUTER INSTRUMENTATION AND CONTROL                         4




                                         abbreviations are only for the convenience of the programmer because the
                                         program that the microcomputer eventually runs must be in the form of
                                         binary numbers. When each instruction is converted to the binary code
                                         that the microcomputer recognizes, it is called a machine language
                                         program.
                    Once the program has      The assembly language abbreviation for the jump instruction is JMP.
                    been written in assembly   Table 4.1 shows the assembly language equivalents for typical microcomputer
                    language, a special kind   instructions, along with a detailed description of the operation called for by
                    of program, called an   the instruction. When writing a microcomputer program, it is easier and
                    assembler, converts the   faster to use the abbreviated name rather than the complete function name.
                    assembly language pro-  Assembly language simplifies programming tasks for the computer
                    gram into the binary   programmer because the abbreviations are easier to remember and write than
                    code recognized by the   the binary numbers the computer uses. However, the program eventually
                    microcomputer.       must be converted to the binary codes that the microcomputer recognizes as
                                         instructions, which is done by a special program called an assembler. The
                                         assembler program is run on the computer to convert assembly language to
                                         binary codes. This enables the programmer to write the program using words
                                         that have meaning to the programmer and also to produce machine codes
                                         that the computer can use.


                                         Logic Functions
                    A microcomputer can       Microprocessors are capable of performing all of the basic logic functions
                    AND the contents of its   such as AND, OR, NOT, and combinations of these. For instance, the NOT
                    accumulator with a   operation affects the accumulator by changing all ones to zeros and zeros to
                    memory location to per-  ones. Other logic functions are performed by using the contents of the
                    form the logical AND   accumulator and some memory location.  All eight bits of the accumulator are
                    function.            affected, and all are changed at the same time. As shown in Figure 4.13, the
                                         AND operation requires two inputs. One input is the contents of the
                                         accumulator, and the other input is the contents of a memory location; thus,
                                         the eight accumulator bits are ANDed with the eight memory bits. The AND
                                         operation is performed on a bit-by-bit basis. For instance, bit 0 of the
                                         accumulator (the rightmost bit) is ANDed with bit 0 of the memory location,
                                         bit 1 with bit 1, bit 2 with bit 2, and so on. In other words, the AND operation
                                         is performed as if eight AND gates were connected with one input to a bit in
                                         the accumulator, and with the other input to a bit (in the same position) in the
                                         memory location. The resulting AND outputs are stored back into the
                                         accumulator in the corresponding bit positions. The OR logic function is
                                         performed in exactly the same way as the AND except that a 1 would be
                                         produced at the output if signal A or signal B were a 1, or if both were a 1 (i.e.,
                                         using OR logic).







                                         UNDERSTANDING AUTOMOTIVE ELECTRONICS                            119
   127   128   129   130   131   132   133   134   135   136   137