Page 340 - Introduction to Microcontrollers Architecture, Programming, and Interfacing of The Motorola 68HC12
P. 340

11






                               Input/Output












        An input routine is a program segment that inputs words from the outside world into
        the computer, and an output routine is a program segment that does the reverse. It
        outputs words from the computer to the outside world. Clearly, a computer that does not
        have input and output routines, and the hardware to carry out these routines, would be
        useless regardless of its power to invert matrices or manipulate great quantities of data.
        Until now, we have implied that you should avoid knowing the details of these routines.
        Even though we have left the discussion of input and output until near the end of this
        book, it is really simple and should pose no problem to the reader.
            In this chapter, we first describe how the basic input and output operations are
        implemented in hardware and executed in software, using simple ports available in both
        the 6812 'A4 and 'B32. We then discuss the use of buffers in input and output. To
        describe synchronization, we describe a greatly simplified timer interrupt mechanism,
        which is also available in both the 6812 'A4 and 'B32. We then discuss gadfly and
        interrupt mechanisms. Finally, we introduce D-to-A and A-to-D converters.
            Upon concluding this chapter, you should understand how basic input and output
        operations are performed and be able to read and write input and output routines that use
        simple synchronization mechanisms.


         11.1 Input and Output Devices


        In this section, we introduce a simplified hardware model used to understand input-output
        routines. We also discuss simple input and output ports to provide enough background
        for the later sections of this chapter.










            Figure 11.1. Simplified Diagram of a Microcomputer (Identical to Figure 1.1)


                                          317
   335   336   337   338   339   340   341   342   343   344   345