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

11,4 Synchronization Hardware                                       325


            Arrays or strings can be used with buffers to input or output many numbers in a
        similar way. Queues are implemented in buffers to input or output data when the
        program needs them in the same order that they are input or when the device needs them
        in the same order that they are provided by the program, but at different times than they
        are provided. Generally, data structures are used to maintain order in the data that are
        being transferred between the MPU and an input-output device.



         11.4 Synchronization Hardware

        The previous section illustrated the use of a delay loop to synchronize the output to a
        traffic light controller. In the next sections, we consider the use of gadfly loops and
        interrupts to synchronize input and output. These use hardware to indicate when I/O is to
        be done. The most commonly used hardware is an edge-triggered flip-flop that is set
        when an output is needed or when an input is available. In this section, we introduce the
         ' A4 or 'B32 basic counter/timer device to illustrate edge-triggered sensing of I/O status
        signals. (See Figure 11.7.) We also briefly discuss PORTT and its direction bits.









































                          Figure 11.7. The Counter/Timer Subsystem
   343   344   345   346   347   348   349   350   351   352   353