Overview of ATmega328P

While reading about the ATmega328, I came a across a lot of stuff which I would like to share here. There is a humongous amount of information available in its datasheet.

Introduction
ATmega328 is a single chip micro-controller created by Atmel. It has a In-System Self-programmable Flash memory of 32 KB, SRAM of 2 KB (2048 bytes) and EEPROM of 1 KB (1024 bytes). It has a 8-bit AVR CPU type which means they can process data in 8-bit chunk as its data bus is 8-bit wide.   It contains 23 general purpose I/O pins and 32 general purpose working registers. It has 32 single-byte registers and 8-bit RISC (reduced instruction set computer) devices and hence the name 328. The P is for ' picoPower '.

It has 3 flexible timer/counter with compare modes, internal and external interupts , 6-channel 10-bit A/D converter , programmable watch dog timer with internal oscillator and 5 software selectable power saving modes. Digital communication peripherals include 1-USART, 2-SPI and 1-I2C. The device operates at 1.8-5.5 V. It can achieve throughputs close to 1MIPS ( millions of instructions per second ) per MHz.

Block Diagram
Block Diagram of ATmega328
AVR CPU : This is the place where all the instructions are executed. It has a direct connection to the flash and the SRAM. The flash is where the instructions are stored and the SRAM is where the temporary data is stored.

Power Supervision : It is the place where the micro-controller is given the power and it distributes it to the whole of the micro-controller. It has BOD (brown-out detection ) which detects when the voltage drops or increases out of the limits. The reset comes from Port C.

Oscillator : It is system clock of the micro-controller.

Watchdog Timer and Oscillator : If nothing happens for certain period of time or the system gets locked in a particular condition it will reset the micro-controller.

T/C : These are timer counters used to count either time or events. There are two 8-bit counters and one 16-bit counter.

Analog Comparator : It is used to compare the peripheral voltage to check whether it is higher or lesser than the specified voltage.

ADC : It is a analog to digital converter.

USART is a peripheral that allows us to communicate through serial with external devices. SPI (Serial programming interface) and TWI (Two wire interface) are other peripherals. 
There are three ports which are external pins to the micro-controller : Port B (8) , Port C (7) , Port D (8). These are bi-directional I/O port with internal pull-up resistor.

Pin Configuration 

Those labelled as PCINT from 0 to 23 except the number 15 are digital pins and AIN[0:1] and ADC[0:5] make up the analog pins. OC0A (12), OC0B (11), OC1A (15), OC1B (16), OC2A(17), OC2B (5) are the six pins giving PWM pulses. ( OC0A : PWM-Timer/Counter0 Output Compare Match A Output).

Pin 1 can be used as the reset pin by default. It can only be used as I/O pin when RSTDISBL fuse is programmed.

Pin 2 (RXD) is the data input pin for USART and Pin 3 (TXD) is the data output pin for USART.

Pin 4 (INT 0) and Pin 5 (INT 1) are external interrupts used when any external event is to be monitored by the micro-controller.

Pin 6 (T0) and Pin 11 (T1) are used as the external timer. Pin 6 (XCK) is also used for USART external clock I/O.

Pin 7 (VCC) is for digital voltage supply and Pin 8 (GND) is for ground.

Pin 9 and Pin 10 can also be used as the oscillator pins. XTAL for chip clock oscillator pin and OSC for timer oscillator pin.

Pin 12 (AIN 0) is used for Analog Comparator positive and Pin 13 (AIN 1) for Analog Comparator negative.

Pin 14 : ICP1 is for Timer/Counter 1 input counter pin and CLKO for clock 0 (divided system clock).

Pin 16,17,18,19 can be used for SPI communication. Pin 16 (SS) : SPI Slave Select. This pin is low when the controller acts as slave. Pin 17 (MOSI) : Master Output Slave Input . When the controller acts as slave, the data is received by this pin. Pin 18 (MISO) : Master Input Slave Output. When the controller acts as slave the data is sent to the master through this pin. Pin 18 (SCK) SPI Bus Serial Clock. This clock is shared between this controller and other system for accurate data transfer.

Pin 20 (AVCC) is used to for the power for internal ADC converter. Pin 21 (AREF) is the analog reference pin for ADC. Pin 22 (GND) is for ground.

Pin 23-28 act as the ADC Input Channels.

Pin 27 and Pin 28 are used for TWI (also called the I2C) communication. Pin 27 (SDA) : Two Wire Serial Bus Data I/O Line. Pin 28 (SCL) : Two Wire Serial Bus Clock Line.

Comments

Post a Comment

Popular posts from this blog

The move_base ROS node

Three Wheeled Omnidirectional Robot : Motion Analysis

Dijkstra`s Algorithm vs A* Algorithm