Atmega 328
Atmega 328
The Atmel ATmega328/P is a low-power CMOS 8-bit microcontroller based on the AVR
enhanced RISC architecture. By executing powerful instructions in a single clock cycle, the
ATmega328/P achieves throughputs close to 1MIPS per MHz. This empowers system
designer to optimize the device for power consumption versus processing speed.
Description:
The Atmel AVR core combines a rich instruction set with 32 general purpose working
registers. All the 32 registers are directly connected to the Arithmetic Logic Unit (ALU),
allowing two independent registers to be accessed in a single instruction executed in one
clock cycle. The resulting architecture is more code efficient while achieving throughputs up
to ten times faster than conventional CISC microcontrollers. The ATmega328/P provides the
following features: 32Kbytes of In-System Programmable Flash with Read-While-Write
capabilities, 1Kbytes EEPROM, 2Kbytes SRAM, 23 general purpose I/O lines, 32 general
purpose working registers, Real Time Counter (RTC), three flexible Timer/Counters with
compare modes and PWM, 1 serial programmable USARTs , 1 byte-oriented 2-wire Serial
Interface (I2C), a 6- channel 10-bit ADC (8 channels in TQFP and QFN/MLF packages) , a
programmable Watchdog Timer with internal Oscillator, an SPI serial port, and six software
selectable power saving modes. The Idle mode stops the CPU while allowing the SRAM,
Timer/Counters, SPI port, and interrupt system to continue functioning. The Power-down
mode saves the register contents but freezes the Oscillator, disabling all other chip functions
until the next interrupt or hardware reset. In Power-save mode, the asynchronous timer
continues to run, allowing the user to maintain a timer base while the rest of the device is
sleeping. The ADC Noise Reduction mode stops the CPU and all I/O modules except
asynchronous timer and ADC to minimize switching noise during ADC conversions. In
Standby mode, the crystal/resonator oscillator is running while the rest of the device is
sleeping. This allows very fast start-up combined with low power consumption. In Extended
Standby mode, both the main oscillator and the asynchronous timer continue to run.
Atmel offers the Q Touch library for embedding capacitive touch buttons, sliders and wheels
functionality into AVR microcontrollers. The patented charge-transfer signal acquisition
offers robust sensing and includes fully de bounced reporting of touch keys and includes
Adjacent Key Suppression technology for unambiguous detection of key events. The easy-to-
use Q Touch Suite toolchain allows you to explore, develop and debug your own touch
applications.
The device is manufactured using Atmel’s high density non-volatile memory technology. The
On-chip ISP Flash allows the program memory to be reprogrammed In-System through an
SPI serial interface, by a conventional nonvolatile memory programmer, or by an On-chip
Boot program running on the AVR core. The Boot program can use any interface to
download the application program in the Application Flash memory. Software in the Boot
Flash section will continue to run while the Application Flash section is updated, providing
true Read-While-Write operation. By combining an 8-bit RISC CPU with In-System Self-
Programmable Flash on a monolithic chip, the Atmel ATmega328/P is a powerful
microcontroller that provides a highly flexible and cost effective solution to many embedded
control applications. The ATmega328/P is supported with a full suite of program and system
development tools including: C Compilers, Macro Assemblers, Program
Debugger/Simulators, In-Circuit Emulators, and Evaluation kits.
Configuration summary
Features Atmega328/p
Pin count 28/32
Flash (bytes) 32k
SRAM(bytes) 2k
EEPROM(bytes) 1k
General purpose I/O lines 23
SPI 2
TWI(i2c) 1
USART 1
ADC 10 bit 15Ksps
ADC Channels 8
8-bite Timer counter 2
16 bite Timer counter 1
Atmega 328 architecture:
Basically, the processor of the Arduino board uses the Harvard architecture where the
program code and program data have separate memory. It consists of two memories such as
program memory and data memory. Wherein the data is stored in data memory and the code
is stored in the flash program memory. The Atmega328 microcontroller has 32kb of flash
memory, 2kb of SRAM 1kb of EPROM and operates with a 16MHz clock speed.
Serial 0(Rx), 1(Tx) Used to receive and transmit TTL serial data.
External
2, 3 To trigger an interrupt.
Interrupts
10 (SS), 11
(MOSI), 12
SPI Used for SPI communication.
(MISO) and 13
(SCK)
A4 (SDA), A5
TWI Used for TWI communication.
(SCA)
Arduino Technology
The pin configuration of the Arduino Uno board is shown in the above. It consists of
14-digital i/o pins. Wherein 6 pins are used as pulse width modulation o/ps and 6
analog i/ps, a USB connection, a power jack, a 16MHz crystal oscillator, a reset
button, and an ICSP header. Arduino board can be powered either from the personal
computer through a USB or external source like a battery or an adaptor. This board
can operate with an external supply of 7-12V by giving voltage reference through the
IORef pin or through the pin Vin.
Digital I/Ps
It comprises of 14-digital I/O pins, each pin take up and provides 40mA current.
Some of the pins have special functions like pins 0 & 1, which acts as a transmitter
and receiver respectively. For serial communication, pins-2 & 3 are external
interrupts, 3,5,6,9,11 pins delivers PWM o/p and pin-13 is used to connect LED.
The main advantage of the Arduino technology is, you can directly load the programs
into the device without the need of a hardware programmer to burn the program. This
is done because of the presence of the 0.5KB of boot loader, that allows the program
to be dumped into the circuit. The Arduino tool window contains a toolbar with a
various buttons like new, open, verify, upload and serial monitor. And additionally it
comprises of a text editor (employed to write the code), a message space (displays the
feedback) like showing the errors, the text console, that displays the o/p & a series of
menus just like the file, tool menu & edit.
Arduino Program
Programming into the Arduino board is called as sketches. Each sketch contains of
three parts such as Variables Declaration, Initialization and Control code. Where,
Initialization is written in the setup function and Control code is written in the loop
function.
The sketch is saved with .ino and any operation like opening a sketch, verifying and
saving can be done using the tool menu.
The sketch must be stored in the sketchbook directory.
Select the suitable board from the serial port numbers and tools menu.
Select the tools menu and click on the upload button, then the boot loader uploads the
code on the microcontroller.
Digital read pin reads the digital value of the given pin.
Digital write pin is used to write the digital value of the given pin.
Serial. Begins pin sets the beginning of serial communication by setting the rate of bit.
It is cheap
It comes with an open supply hardware feature that permits users to develop their own kit
The software of the Arduino is well-suited with all kinds of in operation systems like Linux,
Windows, and Macintosh, etc.
It also comes with open supply software system feature that permits tough software system
developers to use the Arduino code to merge with the prevailing programing language
libraries and may be extended and changed.