Documente Academic
Documente Profesional
Documente Cultură
16KB of Flash memory 1KB of SRAM 512 Bytes of EEPROM Available in 40-Pin DIP 8-Channel 10-bit ADC Two 8-bit Timers/Counters One 16-bit Timer/Counter 4 PWM Channels In System Programmer (ISP) Serial USART SPI Interface Digital to Analog Comparator.
Different compilers and burner software information: Compiler used are C-code converted to hex Hex code transferred to hardware programme Serial hardware programmer Parallel hardware programmer USB hardware programmer Serial software programmer Parallel software programmer USB software programmer
AVR studio,winAVR,CVAVR AVRGCC USBASP STK500 STK200 USBASP Siprog AVR Dude,ponyprog AVR Dude
Configuring I/O Ports :Every PORTX(A,B,C & D) have three registers associated with it to configure I/O Ports . These are DDRX PORTX PINX
Basic overview of program written for AVR Microcontroller i.e ATmega16
#include<avr.io.h> #include<util/delay.h> int main() { DDRA=0xff; PORTA=0xff; written in this register// } //header files //header files
LCD DISPLAY
9
0 * #
852
941 941 941
1477
1336 1209 1477
DTMF IC CM8870
INTRODUCTION TO RELAYS
ULN2803
16*2 LCD
VSS: power supply(GND) VCC: power supply(+5v) VEE: contrast adjust RS : 0=Instruction input 1=Data input R/W: 0=write to LCD module 1=read from LCD module EN : enable signal D0 : Data bus line 0 D1 : Data bus line 1 D2 : Data bus line 2 D3 : Data bus line 3 D4 : Data bus line 4 D5 : Data bus line 5 D6 : Data bus line 6 D7 : Data bus line 7
For initializing of LCD in 4-bit mode logic will be void LCD_init() //function to initialize { dis_cmd(0x02); //to initialize LCD in 4-bit mode dis_cmd(0x28); //to initialize LCD in 2 lines,5*7 dots dis_cmd(0x0c); //display on cursor on dis_cmd(0x06); //for autoincrement mode }
For instructions masking logic will be void dis_cmd(unsigned char item) //function to send instructions { unsigned int value; value=item & 0xf0; LCD_cmd(value); item=((item<<4)&0xf0); LCD_cmd(item); }
For data masking logic will be void dis_data(unsigned char item) //function to send data { unsigned int value; value=item & 0xf0; LCD_data(value); item=((item<<4)&0xf0); LCD_data(item); }
while(1) { if((PINA & 0b00001111)==1) //connect dtmf pins to porta { PORTB|=0x01; // lcd to portc dis_cmd(0x83); LCD_string("relay1"); //relay to portb } if((PINA & 0b00001111)==2) { PORTB|=0x02; dis_cmd(0x83); LCD_string("relay2"); } if((PINA & 0b00001111)==3) { PORTB &=0xfe; } if((PINA & 0b00001111)==4) { PORTB|=0x04; dis_cmd(0x83); LCD_string("relay3"); }
if((PINA & 0b00001111)==5) { PORTB &=0xfd; } if((PINA & 0b00001111)==6) { PORTB &=0xfb; }
if((PINA & 0b00001111)==8) { PORTB|=0x08; dis_cmd(0x83); LCD_string("relay4"); } if((PINA & 0b00001111)==9) { PORTB &=0xf7; } } return 0; } void LCD_cmd(unsigned char item) { LCD_port=item; LCD_port|=(0<<RS)|(0<<RW)|(1<<EN); _delay_ms(1); LCD_port|=(0<<RS)|(0<<RW)|(0<<EN); _delay_ms(1); }
void LCD_data(unsigned char item) { LCD_port=item; LCD_port|=(1<<RS)|(0<<RW)|(1<<EN); _delay_ms(1); LCD_port|=(1<<RS)|(0<<RW)|(0<<EN); _delay_ms(1); } void dis_cmd(unsigned char item) { unsigned int value1; value1=item & 0xf0; LCD_cmd(value1); item=(item<<4) & 0xf0; LCD_cmd(item); } void dis_data(unsigned char item) { unsigned int value1; value1=item & 0xf0; LCD_data(value1); item=(item<<4) & 0xf0; LCD_data(item); }
dis_cmd(0x06); _delay_ms(1);
dis_cmd(0x0c); _delay_ms(1);
dis_cmd(0x80); _delay_ms(1);
} void LCD_string(unsigned char str[]) { unsigned int i=0; while(str[i]!='\0') { dis_data(str[i]); _delay_ms(1); i++; } }
Hardware Details
clk();
void ssd_number(int x,int y) { if(y==1){PORTB=0x01;display(x);} if(y==2){PORTB=0x02;display(x);} if(y==3){PORTB=0x04;display(x);} if(y==4){PORTB=0x08;display(x);} if(y==5){PORTB=0x10;display(x);} if(y==6){PORTB=0x20;display(x);} } void clk(void) { for(int b=0;b<3;b++) { for(int a=0;a<10;a++) {for(int i=0;i<6;i++) { for(int j=0;j<10;j++) { for(int k=0;k<6;k++) { for(int l=0;l<10;l++) {
for(int p=0;p<10;p++)
{
ssd_number((l%10),1); _delay_ms(5); ssd_number((k%10),2); _delay_ms(5); ssd_number((j%10),3); _delay_ms(5); ssd_number((i%10),4); _delay_ms(5); ssd_number((a%10),5); _delay_ms(5); ssd_number((b%10),6); _delay_ms(5); } }} }} }} }
Apart from the project what I have learnt during Summer Training in I3 Indya are:-
Interfacing of LEDS with ATmega16 Displaying digits using 7 segment display Motor Interfacing with ATmega16 Interfacing of keypad with ATmega16 Introduction to ADC Introduction to Sensors Introduction to Interrupts Introduction to Touch Screen Introduction to RF Communication Introduction to Serial Communication