Sunday, May 11, 2008

Robotics Step-1

Before going to robotics you should have a basic knowledge of microcontroller (I am using Atmel Atmega8,) and softwares to burn your code to atmega8. (i.e avr-gcc,avr-libc,uisp)

LED Blinking with atmega8

Before doing it with atmega8 its better to check your Parallel Port.

#include"avr/io.h"
main()
{
DDRC|=1PC2;
while(1)
{
PC2|=1PC2;
delay(10);
PC2|=~1PC2;
delay(10);
}
}

Before this you have to install avr-libc,gcc-avr,uisp.
Read the atmel atmega8 datasheet & avr-libc manual.


Code Explanation:
we have 3 ports PORTA,PORTB,PORTC these are bidirectional. It will act as output pin or inout pin based on DDR*(DDRA for PORTA likewise) register.When the value is 1 it will act as an output pin and 0 as input pin.We are connecting LED to PC2. So we will be making the pin high then a delay

Circuit:














comments to:

Ranjeeth PT
Govt Engg College
Sreekrishnapuram,Palakkad.

No comments: