Sunday, May 11, 2008

Checking Your Parallel Port

Parallel Port Description




For blinking LED you have to write a code. i.e. first you have to make the data pin high(pin no:2-9)
we will be writing a C code:


1. #include"stdio.h"
2. #include"sys/io.h" /*Header file for iopl(),outb()*/
3. main()
4. {
5. iopl(3);

6. while(1)
7. {
8. outb(0xff,0x378); /* it will make the pin 2-9 high(0xff eight 1's) & 0x378 is the port address*/
9. sleep(1);
10. outb(0x00,0x378);/*it will make the pin 2-9 low */
11. sleep(1);
12. }
13. }




Now comes your circuit. Here we have connected only 1 LED to pin2 and pin 19 is the ground.

You can connect LED to pin 2-9 with a resistor(1k) & control these pins in different way

















comments to:
Ranjeeth PT
Govt Engg College
Sreekrishnapuram,Palakkad.

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.