11.1 Introduction
In microcontroller applications, the MCU drives peripheral devices (the IO devices) like 7-segment display unit, LCD, Servo Motor, LM35 Temp Sensor, Water Pump, Fluid Injection System in the hospital, and the like for various purposes. These IO devices are always connected with the MCU through some kind of "interface controllers/peripheral controllers/programmable peripheral interface controllers (PPI)". These interface controllers could be embedded within the MCU or be lying outside the MCU. A peripheral controller solves the incompatibility problem (between MCU and IO device) which exists due to mismatch in logic level, protocol level, and power ratings (voltage/current).
MCU like ATmega328P of the Arduino UNO Board is a low voltage (5v) and low power (an IO pin can deliver only 20 mA current) device; but in the industrial field, it might drive/control high power device like a 3-phase 3 kW induction motor (415 V/ line-to-line voltage and about 9 A line current at 0.8 pf). This example tells us how important it is (particularly for the EE Engineering students) to study the interfacing issues.
1. Peripheral Device (CC7SD Display Unit) and Embedded Peripheral Controller
Figure-11.1: Interfacing of multiplexed type "CC7SD display unit"
(1) In the diagram of Fig-11.1, the "LM35 Temp Sensor" is an "input device/peripheral device" and the 4-digit "cc-type multiplexed 7-segment display unit (CC7SD)" is an "output device/peripheral device".
(2) In Fig-11.1, the peripheral controllers are embedded within the MCU and these are:
(a) PORTB, PORTC, and PORTD.
The CC7SD unit is connected with MCU via these PPIs. The IO lines of these PPIs drive/control the ON/OFF conditions of the segments of the display unit.
(b) ADC.
The LM35 Temp Sensor is connected with MCU with the help of this PPI. This PPI helps the MCU to acquire the analog value of the temperature sensor and then convert it into digital form.
(3) Limitations of the CC7SD Unit of Fig-11.1.
(a) Because it is a multiplexed type display unit, the MCU must refresh it frequently; otherwise, the display will freeze to a single-digit. Here, the MCU is spending huge amount time which could be used in some other useful tasks.
(b) because the port pins have limited current source/sink capability, the brightness of the display unit is usually below standard.
(c) Because the display unit is being driven directly by the IO lines of the internal peripheral controllers, there are about 12 IO lines engaged with the display unit which is not affordable in the practical case as the MCU has to handle other peripheral devices using IO lines.
2. Peripheral Device (CC7SD Display Unit) and External Peripheral Controller
Figure-11.2: External peripheral controller MAX7219 based multiplexed display unit
(1) It is possible to overcome the limitations of the display system of Fig-11.1 with the help of the display system of Fig-11.2; where, an external peripheral controller (M2 : MAX7219) drives the "4-digit multiplexed CC7SD Unit".
(2) Now, the MAX7219 chip (U2 in Fig-11.2) has taken over the "display refreshing" job from the MCU. The MCU is free and it can do some other useful tasks. Whenever needed, the MCU just writes new data into the registers of the MAX7219 chip for the digits of the display unit. The MAX7219 has its own scanning circuit by virtue of which it refreshes the multiplexed display unit.
(3) In Fig-11.1, the MCU needed 12 IO lines to drive the display unit; whereas, in Fig-11.2, the MCU needs only 3 IO lines to drive the same display unit. There is a saving of 9 IO lines which could be used to drive some other IO devices.
(4) An IO line of MAX7219 chip has 100 mA regulate-able current driving capability than the IO line of the MCU which is only 20 mA. Thus, the brightness of the display unit could be adjusted at any desired level.
(5) The MCU uses standard SPI protocol to transfer data to MAX7219 chip in Fig-11.2; whereas, the MCU uses "bit-bang" tricks to send data to the display unit via the internal Ports/PPIs.
3. Peripheral Device (Parallel IO driven LCD) and Embedded Peripheral Controller
Figure-11.3: Embedded (internal) parallel IO (peripheral controller) driven LCD (PIOLCD)
4. Peripheral Device (I2C Bus driven LCD) and Embedded Peripheral Controller
Figure-11.4: External I2C based peripheral controller driven LCD (I2CLCD)
5. Peripheral Device (Bluetooth/Mobile Phone) and Embedded Peripheral Controller
Figure-11.5: Interfacing Mobile phone with UNO using "HC-05 Bluetooth" external controller
... to be continued