Hi all
One of my teachers was trying to use C programs in order to access the
parallel port and ligh some leds in a proto board. To do this, he used a
library called "dos.h" so that he could use the OUTPORTB() and INPORTB()
functions. I asked him about what should I do if I had a Linux machine,
and he couldn't answer me. Can you guys help me? Here goes the program:
#include <stdio.h>
#include <dos.h>
#define DATA 0x378
#define STATUS 0x379
#define CONTROL 0x37A
void main (void)
{
int Option;
do
{
printf ("\n\n\n\n\n");
printf ("Options:\n");
printf ("\n[1]-Led1\n[2]-Led2\n[3]-Led3\n[4]-Led4");
printf ("\n[5]-Led5\n[6]-Led6\n[7]-Led7\n[8]-Led8\n");
printf ("\nChoose:");
fflush (stdin);
scanf ("%d",&Option);
fflush (stdin);
switch (Option)
{
case 0: printf ("End Program");
break;
case 1: outport(DATA,0x01);
break;
case 2: outport(DATA,0x02);
break;
case 3: outport(DATA,0x04);
break;
case 4: outport(DATA,0x08);
break;
case 5: outport(DATA,0x10);
break;
case 6: outport(DATA,0x20);
break;
case 7: outport(DATA,0x40);
break;
case 8: outport(DATA,0x80);
break;
default:printf ("Invalid Option!");
}
} while (Option !=0 );
}
-- To unsubscribe, send mail to: linux-parport-request@torque.net --
-- with the single word "unsubscribe" in the body of the message. --
This archive was generated by hypermail 2b29 : Fri Dec 01 2000 - 09:30:54 EST