2. ICC AVR ver 7.5 ICC AVR is a tool used to program Atmel microcontrollers. It uses a C compiler to compile the high level code into a low level code. ICC AVR then converts this low level code into HEX code. It also has built in tools to program the flash memory of the microcontroller.
4. ICC AVR ver 7.5 is not a freeware and thus you have to purchase it. But 45 days trial versions are available on the net and they give almost the same features. Thus download the setup of the trial version from the site : http://www.imagecraft.com/ Run the setup and install ICC AVR ver 7.5
25. Input Output PORTS • Four, 8 bit I/O ports- PORT A,B,C,D • All I/O ports pins are bidirectional and can be configured individually • Input pins can be configured to utilize internal pullups. • Data Direction Register , DDRn • Port Driver Register, PORTn • Port Pin Register, PINn
26. Data Direction Register, DDRn • Determines the direction of individual pins of ports • If the bit of the DDR is set the corresponding pin of the port is configured as output pin • If the bit of the DDR is cleared the corresponding pin of the port is configured as input pin • DDRA = 0xF0; • 4 MSB pins of PORTA are output pins • 4 LSB pins of PORTA are input pins
27. Port Pin Register, PINn • Reading the input pins of port is done by reading PIN register • Temp = PINA; • Read the PORTA input and store in temp variable
28. Port Drive Register, PORTn • For pins configured as input (DDRn[x] = 0) microcontroller connects a internal pull up register if the corresponding bit of PORTn is set • If the PORTn bit is cleared, pin is Tristated • DDRA = 0x00; • PORTA = 0xF0
29. Buzzer On / OFF • PORT B pin 7 • Pin is configured as output • DDRB= 0x80; • To turn on the buzzer output high • PORTB = 0x80; • To turn off the buzzer output low • PORTB = 0x00;
31. LED DISPLAY 8 bit LED display is connected to PORTD. To display any bit combination on the LED display, we use… PORTD=0xXX;
32. CODE FOR LED DISPLAY void main(void) { init_devices(); while(1) { PORTD=0xFF; } }
33. Analog To Digital Converter • 10 bit resolution • 8 channels • PORTA(0 – 7) • Disable internal pull up • ADCH & ADCL – Data Register • ADMUX- Channel Select Register • ADCSR – Control & Status Register
34.
35. unsigned char ADC_conversion (unsigned char ADC_channel_number) { unsigned inti = 0; ADCH = 0x00; i = ADC_channel_number & 0x0F; // keeping the loweatnibbel ADMUX = i | 0x20; //upper nibbel of 0x20 indicates the result is left adjusted (8 bit ADC conversion) ADCSR |= 0x40; for (i = 1; i < 255; i++); //delay of 93.2 uS i = ADCH; return (i); } void main(void) { unsigned char I, value[3];; for(i=0;i<3;i++) { value[i]=ADC_conversion(i); } }
53. After you program your robot, it is ready to run the code written onto the microcontroller. So just power on the microcontroller and it will start the execution of the code.