Cerf
05-17-2004, 11:09 PM
Yo yo yo,
This is probably going to turn into me blowing off some steem, and I am sorry to all you out there, especially those of you who have tried to help me.
But what I am trying to do is, make the parallel port control some leds. its been 2 weeks since I started this 'project' and Ive gone no where. Ive read about it (it didnt look too hard), ive seen demoes, but whatever I do - it doesnt work. even parapin doesnt work for me.
Here is the code I have,
#include <stdio.h>
#include <unistd.h> /* needed for ioperm() */
#include <sys/io.h> /* for outb() and inb() */
#include <iostream.h>
#define DATA 0x378 //lp0
#define STATUS DATA+1
#define CONTROL DATA+2
int main(void)
{
if (ioperm(DATA,3,1)) {
printf("Sorry, you were not able to gain access to the ports\n");
printf("You must be root to run this program\n");
outb(DATA, x); /* Sends 0011 0010 to the Data Port */
return 0; /*make pin 0 LO, pin 2 LO, pin 3 & 4 HI, ... */
}
Does anyone have an suggestions, a code example would be very helpful.
Thankyou (sorry for the rant)
This is probably going to turn into me blowing off some steem, and I am sorry to all you out there, especially those of you who have tried to help me.
But what I am trying to do is, make the parallel port control some leds. its been 2 weeks since I started this 'project' and Ive gone no where. Ive read about it (it didnt look too hard), ive seen demoes, but whatever I do - it doesnt work. even parapin doesnt work for me.
Here is the code I have,
#include <stdio.h>
#include <unistd.h> /* needed for ioperm() */
#include <sys/io.h> /* for outb() and inb() */
#include <iostream.h>
#define DATA 0x378 //lp0
#define STATUS DATA+1
#define CONTROL DATA+2
int main(void)
{
if (ioperm(DATA,3,1)) {
printf("Sorry, you were not able to gain access to the ports\n");
printf("You must be root to run this program\n");
outb(DATA, x); /* Sends 0011 0010 to the Data Port */
return 0; /*make pin 0 LO, pin 2 LO, pin 3 & 4 HI, ... */
}
Does anyone have an suggestions, a code example would be very helpful.
Thankyou (sorry for the rant)