
Transcription
AVR BASICSDatasheetA datasheet of any electronic item/component/device is a document in which the manufacturer gives informationregarding the product to its users. The data given in it is in detail. All the features, technical specs, design, registerSummary, expected usage, troubleshooting, pin details, etc, everything is given in detail. It is the best source of infofor that particular device!! All electronic components have a datasheet published by the manufacturers. You canGoogle them out!! They are free. Check out the datasheet of the following AVR 68Pin ConfigurationThe pin configurations of an ATMEGA8 and ATMEGA16/32 MCU are shown below.
ATMEGA8 Pin ConfigurationATMEGA16/32 Pin Configuration
Please note that we will be dealing with DIP packages. For more information of types of IC Packages, visit this site.Now, let’s analyze the pin configuration of ATMEGA16/32. First of all, note that the ATMEGA16 andATMEGA32 MCUs are completely similar, except the fact that ATMEGA16 has 16KB Flash, 1KB RAM and 512BEEPROM whereas ATMEGA32 has 32KB Flash, 2KB RAM and 1KB EEPROM.Hey, don’t get scared after looking at the pin configurations. The MCU has 40 pins. It’s not that complicated. Here,let me simplify it as follows.ATMEGA32 Pin Configuration SimplifiedSo here, as you can see, I have split the pins into four major parts. Remember about ports? I said that ports containthe pins of a MCU. ATMEGA32 has four ports, PORTA, PORTB, PORTC and PORTD, each one having 8 pins.Don’t worry about the other details, we will discuss them as and when needed. Right now, concentrate onPA0 PA7, PB0 PB7, PC0 PC7 and PD0 PD7. These are the four ports that make up the GPIO pins (GeneralPurpose Input Output). These concepts are discusses in my previous post, Basics of Microcontroller.So, how many pins over? 4 8 32. How many remain? 40 – 32 8! The remaining 8 are mostly consumed bysupply pins (VCC, AVCC), ground (GND), reset, XTAL pins, and other minor stuffs. So, all the 40 pins over, isn’tit? ;)
P.S. Every MCU has an internal oscillator which determines its frequency of oscillator. But we need not stick to it.We can connect an external crystal oscillator to generate higher frequencies and clock pulses. This externaloscillator is connected across the XTAL pins (XTAL1 and XTAL2).AVR PeripheralsOkay, now have a look again at the pin configuration of ATMEGA32. Have a look at all the GPIO pins of all theports. Can you see some things written in the brackets? Like PA0 (ADC0), PB5 (MOSI), PC2 (TCK), PD1 (TXD),etc. Well, these are the extra features that the MCU can offer you apart from GPIO. In other words, these pins showdual behavior. If nothing is specified, they act as GPIO pins. The secondary features of these pins become activeonly if you enable certain bits of some registers. These are called peripherals. There are several peripherals thatAVR offers in ATMEGA32, some are as follows:oADC – Analog to Digital Converter – usually 10-12 bitoTimers – 8 bit and 16 bit timersoJTAG – Joint Test Action GroupoTWI – Two Wire Interface (or) I2C – Inter-Integrated CircuitoUSART – Universal Synchronous Asynchronous Receiver TransmitteroUART – Universal Asynchronous Receiver TransmitteroSPI – Serial Peripheral InterfaceoWDT– Watchdog Timer and many more!You can get a complete list from the datasheet. Let me give you brief idea regarding them. Detailed information willbe given in later posts. For now, the following is enough.ADC stands for Analog to Digital Conversion. The term is self-explaining. This feature converts Analog signals intoDigital signals.
Timers are something which are a consequence of clock frequency. We can manipulate the clock pulses in order togenerate timers of required resolution.JTAG corresponds to testing of the circuit. When we make a circuit and fix the MCU onto it, we use JTAG to verifywhether our connection, soldering, circuit design, etc is correct or not.TWI/I2C (its actually I-square-C) is a revolutionary technology by Philips, in which two devices are connected andcommunicate by using two wires! USART/UART is related to serial communication in which the MCU sends andreceives signals from another device based on serial protocol. SPI is something which helps to interface I2C, UART,etc. The adjoining figure showing SPI Communication using UART is just for representation purpose.WDT (Watch Dog Timer) is something interesting it seems. The name is also quite interesting. Just like a watchdogalways keeps an eye on it’s master to protect him from any harm, WDT keeps an eye on the execution of the code toprotect the MCU from any harm. A WDT is a computer hardware or software timer that triggers a system reset orother corrective action if the main program, due to some fault condition, such as a hang, neglects to regularly servicethe watchdog (writing a “service pulse” to it, also referred to as “kicking the dog”, “petting the dog”, “feeding thewatchdog” or “waking the watchdog”). The intention is to bring the system back from the unresponsive state intonormal 2011/06/09/avrbasics/
AVR BASICS Datasheet A datasheet of any electronic item/component/device is a document in which the manufacturer gives information regarding the product to its users. The data given in it is in detail. All the features, technical specs, design, register Summary, expected usage, troubles