Led Driving Using Parellel Port - Colour
Led Driving Using Parellel Port - Colour
Then you connect the circuit to the parallel port so that one end of the circuit goes
to one data pin (that one you with to use for controlling that LED) and another one
goes to any of the ground pins. Be sure to fit the circuit so that the LED positive
lead (the longer one) goes to the datapin. If you put
the led in the wrong way, it will not light in any
condition. You can connect one circuit to each of the
parallel port data pins. In this way you get eight
software controllable LEDs.
Here is the C program to on/off position of LED; n=1 for on, n=0 for off.
#include <stdio.h>
#include <dos.h>
#include <conio.h>
/********************************************/
/*This program set the parallel port outputs*/
/********************************************/
void main (void)
{
clrscr(); /* clear screen */
outportb(0x378,n); /* output the data to parallel port *///(0xff)
getch(); /* wait for keypress before exiting */
}
Article by Malay Majithia Ist IT, LDCE
[email protected]