Hello Every one.
It is very simple to control the parallel port in linux in c. Just run this c program. Make sure you are logged in as a root.
This program is for blinking a LED on any data bit of parallel port.
U can change the delay by changing the for loop conditions.
If some one is new to linux then here is some help, how to add root user...
type ' sudo passwd root ' on terminal then hit enter. it will ask password for root user two times, give the password and then login as a root.
enjoy...
It is very simple to control the parallel port in linux in c. Just run this c program. Make sure you are logged in as a root.
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/io.h> #define pport 0x378 main(int argc,char **argv) { unsigned long int i; if (ioperm(pport,1,1)) printf("Error: Couldn't get the port at %x\n", pport); while(1){ for(i=0;i<99999999;i++); outb(0xFF,pport); printf("\nON"); for(i=0;i<99999999;i++); outb(0x00,pport); printf("OFF"); } }
This program is for blinking a LED on any data bit of parallel port.
U can change the delay by changing the for loop conditions.
If some one is new to linux then here is some help, how to add root user...
type ' sudo passwd root ' on terminal then hit enter. it will ask password for root user two times, give the password and then login as a root.
enjoy...
No comments:
Post a Comment