Basics of Microcontrollers
Hi everyone! Today we are going to talk about basics of microcontrollers. This guide is for those who want to learn AVR programming quickly. This guide only gives basic information about AVR programming. Those who want to learn more deep can use following websites.
- http://www.avr-tutorials.com
- https://www.sparkfun.com
- https://www.avrfreaks.net
- http://maxembedded.com
Ok. Enough intro. Let's get started with our lesson.
Basic Components
Basically, a microcontroller is a small computer on a chip which can perform input, output, storing, processing, interrupts etc. Microcontrollers atleast have following basic components.
- A processor - This refers to CPU (Central Processing Unit) of the microcontroller. Contains CU (Control Unit), ALU (Arithmetic Logic Unit), intruction decoders and some special registers (Program counter, Stack pointer, Status register).
- Volatile memory - Includes SRAM and DRAM, used to store data temporary.
- Non-volatile memory - Includes ROM, PROM, EPROM, EEPROM and FLASH, used to store programs in the microcontroller.
- Timer module - Used to perform timing or counting operations in the controller, include time stamping, measuring intervals, counting events, etc.
- Analog I/O module - Used for analog communication between microcontroller and outside world.
- Digital I/O module - Used for digital communication between microcontroller and outside world.
- Serial module - Used for serial communication with the external world. e.g. Using USART (Universal Synchronous/Asynchronous Receiver/Transmitter) device.
- Interrupt module - Interrupts used to perform some tasks in background by pausing main program if neccessary.
I/O Registers
Digital I/O
Each of the AVR Digital I/O ports is associated with three (3) I/O registers.
- DDRx (Data Direction Register) - DDRx is an 8-bit register, that is used to declare port as input or output. Writing 1 to a pin makes it an output pin and writing 0 makes it input.
- PINx (Pin Register) - PINx register is an 8-bit register, that is used to read logic values on the pins of Portx.
- PORTx (Port Register) - PORTx is an 8-bit register, that is used to output logic values to pins on Portx.
Analog I/O
AVR microncontroller's basically have two analog peripherals, Analog Comparator and ADC (Analog to Digital Converter). Analog Comparator can be used to compare two analog inputs. ADC is used to convert analog data into a digital value.
Comments
Post a Comment