Interfacing microcontrollers to external devices
There can be any external device that may be connected(interfaced) to the microcontroller. They may be for control input like buttons, keypads, touch, or information output, e.g., display, sound, motor, relay, and modem. Also, output devices may be further chips like transmitters, frequency generators, memory. Interfacing with chips is not that hard because most of all (especially digital ones) are TTL level compliant that allows connecting chips one to another directly. Otherwise, there are TTL level converter chips if needed – like RS232 to TTL converter MAX232 chip. Let’s take a simple device LED. Probably many of you are thinking that there is nothing easier than connecting LED to the microcontroller. Yes, it’s true. Considering AVR microcontrollers, Led can be connected directly to port pin via limiting resistor either as a source either as drain because the chip can provide enough current to light diode without damaging the port. But what if you need to connect like 10 LEDs when each requires, let’s say 20mA. The total current would be 200mA. No tall microcontrollers can provide such power directly without damaging the port. The simplest way to avoid this problem is to use LED via amplifying transistor.