13. Complier:For writing the code as per
• Requirement:
» WinAVR software:Open Source.
» Data Sheet of the Respective
Microntroller:Open source.
» Programmer:For embedding the hex file into the
MuC
» Serial or paralle Port Cable :For interfacing the
PC to Muc.
» Development Board :Which carry the
Supporting Component required by the MuC.
19. Sample Code for Line Follower:
• #include<avr/io.h>
• Void main()
• {
• DDRA=0x00; //declaring port A to an input port;
• DDRB=0xFF; //declaring port B to an output port
• PORTA=0xFF; //setting the default voltage of port A high(Pull up)
• Unsigned Char c;
• While(1)
• {
• c=PINA; //taking input from portA antd storing in variable C
• if(c==0b11111100) //if left sonsor =0 and right Sensor=0
• PORTB=0b00001010; //left motor =FWD and Right Motor=FWD
• if(c==0b1111101) //if left sensor=1 and right sensor=0
• PORTB=0b00001001; //left motor=BCK & Right motor=FWD
• if(c==0b11111110) //if left sensor=0 & right Sensor=1
• PORTB=0b00000110 //left motor=FWD & Right Motor=BCK
•
• }
• right sensor left Sensor
• } if (c==11111110)
• PORTB=0b000001 10 ;
• right motor left motor