Introduction To ATMega32 AVR
ATMega32 is an 8-bit general purpose microcontroller bases on RISC architecture. It has 32 KBytes of flash memory for storing the program. The SRAM of 2 KBytes uses for temporary data storage during program execution. EEPROM store the permanent data up to 1024 Bytes.The CPU could clock up to 16 MHz, giving the instruction execution speed 16 MIPS.
There are features in this device. In this section we get started with basic digital input output programming.
ATMega32 come with 40 pins DIP Package easing the developer to prototype the project on breadboard. It also come with SMD package.
A DIP package ATMEGA32 IC Pin Diagram |
Basic ATMega32 Programming |
It has for 8-bit ports.
- PA (PORTA)
- PB (PORTB)
- PC (PORTC)
- and PD (PORTD)
Each port has its own internal weak pull ups resistors. Each port direction is controlled by its own DDRx register. For example, PORTA input output direction is controlled by DDRA register.
Giving a '1' to any DDRx, make the corresponding PORTx as output, otherwise input.
In the example below, we want to read the digital input from PORTB and output to PORTD.
Programming Using C In Atmel Studio 7
ATMega32 Hardware/Software Simulation Proteus 8 The Clock is not necessary run at 16 MHz. The supply Voltage is normally +5 V. The reset pin must pull High to make the program execute. |
/*
* inputoutput_1.c
*
* Created: 4/25/2020 8:33:59 AM
* Author : Admin
*/
#include <avr/io.h>
int main(void)
{
DDRB=0x00;
DDRD=0xFF;
PORTB=0xFF;
/* Replace with your application code */
while (1)
{
PORTD=PINB;
}
}
Back to main tutorial page ATMega32 tutorials in C with Atmel Studio 7.
wow, great, I was wondering how to cure acne naturally. and found your site by google, learned a lot, now i’m a bit clear. I’ve bookmark your site and also add rss. keep us updated.Regularly scheduled programming
ReplyDeleteHi, Thanks for visiting my blog.
ReplyDelete