Microcontrollers in Practice

This chapter presents several ways in which the microcontrollers interact with analog signals. It contains a description of the analog comparator of AT90S8535, the A/D converter of HC11 and AVR, and an example of interfacing 68HC11 to an external D/A converter.
The simplest way for a microcontroller to interact with an analog signal is by using an analog comparator. It seems that all the information a comparator can offer about a signal is one bit, containing answer to the question whether the amplitude of the respective signal is or isn't higher than a certain threshold. In fact, it's not only the amplitude of the signal that counts the moments when the signal crosses the threshold are also important.
This paragraph presents the interface with the analog comparator of the AVR, an ingenious and flexible implementation. The block diagram of the interface is shown in Fig. 7.1.
The inputs of the comparator are connected to pins PB2, PB3 of the circuit. The corresponding lines of port B must be configured as inputs, with the internal pull-up resistors disabled (refer to Chap. 2 for details).
The bits in the Control and Status Register (ACSR) of the comparator offer the following control features:
Control of the comparator's power supply, by means of the ACD (Analog Comparator Disable) bit. Setting this bit to 1 disables the comparator.
Read...