Microcontrollers are simply microprocessors that include program and data memory and peripherals such as general-purpose input/output ports, timers, serial communications controllers, analog-to-digital converter, etc.
The purpose of this course is to describe a portion of the architecture of a simple microcontroller (namely the Atmel ATtiny2313A microcontroller) and to provide simple examples written in the C programming language that use an LED and a pushbutton. The examples utilize the timer circuit and the port registers and incorporate a timer interrupt and an external interrupt.
Learning Objective
At the conclusion of this course the student will learn:
• the significance of a vector table
• the function of an interrupt controller
• how to use a timer interrupt
• how to use an external interrupt for a pushbutton event
• the difference between a timer overflow and a timer compare match
• how to configure a port pin as either an input or an output
Intended Audience
This course is intended for all engineers.
Course Introduction
In my course entitled "Microcontrollers: an Introduction" I discussed the architecture of microcontrollers. I showed how the central processing unit fetches instructions (or a program) from memory and decomposes the instructions into components that the control unit and the arithmetic logic unit can use to perform the desired operation or function. Here I will discuss how to design a simple circuit incorporating a microcontroller with a small footprint, small pin count, and a small amount of internal memory (both program and data memory). I will give program examples using the C programming language.
Microcontrollers are simply microprocessors that include program and data memory and peripherals such as general-purpose input/output ports, timers, serial communications controllers, analog-to-digital converter, etc.
Course Summary
The Atmel ATtiny2313A microcontroller used for these exercises is packaged in a 20-pin DIP package. It is small compared with other microprocessors available, but there are other smaller devices available. For example the Atmel ATtiny10 is packaged in a 6-pin SOT-23 package, making this device ideal for small projects such as an electronic candle to simulate the flicker of the flame or a child's shoe that has LEDs that light up when he or she walks.
Although the Atmel AVR series of microcontrollers is a great product offering many features with a powerful core, this course is not meant to be an advertisement for the Atmel AVR series of microcontrollers. There are many similar microcontrollers available on the market, such as the Microchip PIC, Texas Instruments MSP430, Intel 8051, STMicroelectronics STM8, Freescale 68HC11, and multiple versions of the ARM core from many vendors.
Microcontrollers today can be designed and programmed to control and monitor almost anything. They have become an integrated part of our society, industry and culture.