LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-27-2008, 04:13 AM   #1
webquinty
Member
 
Registered: Apr 2008
Location: Espaņa
Distribution: Suse
Posts: 218

Rep: Reputation: 32
Send data using parallel port...


Hello,

I have some doubts about how to use parallel port to send data.

I have a program with easy code that I download.

#define base 0x378

// Access parallel port
//*************************************************
if (ioperm(base,5,1)){
fprintf(stderr, "Error open parallel port\n");
exit(0);
}
iopl(3);
//*************************************************

valor = 0;
outb(valor, direccion);
s_strobe = 1;
outb(s_strobe, direccion+2);
s_strobe = 0;
outb(s_strobe, direccion+2);

Well, with this easy code I can to send data using parallel port, but strobe signal does not change when I send data, so I use two more instruction to generate strobe impulse.

But, I am interesting in send data using parallel port and strobe signal change state automaticly. is there any mode that parallel port send data and strobe signal change state when I send data??

best regards
 
Old 06-27-2008, 08:23 AM   #2
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
What do you mean 'send data' - if you mean like TCP/IP packets, run a 'PLIP' daemon (parallel port IP).

If you mean you want to change the state of all the port's pins as you please, have a look at the kernel's parallel port code and the supported IOCTLs. Sending data is easy; you can do something as simple as: echo "blah" > /dev/lp0
If you want to check status lines, change state of status lines, etc, you will need to use the IOCTLs. Using 'ioperm' and so on as you are doing is non-portable.

If I recall correctly, there are several options for parallel port drivers - have a look at them all to see which is the most suitable for your purposes.
 
Old 06-27-2008, 09:20 AM   #3
webquinty
Member
 
Registered: Apr 2008
Location: Espaņa
Distribution: Suse
Posts: 218

Original Poster
Rep: Reputation: 32
Thanks a lot for you answer.

My idea is to send a "packet data" using parallel port.
I do not known PLIP.
I have supposed when I send data by parallel port, strobe signal change its state.

Well, I am going to look for information about PLIP.
Perhpas is better than other option.

Best regards.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Send Data To A Port On An IP? aaron4katie Programming 4 01-16-2007 04:58 AM
is there any shell command to read and write data from parallel and serial port? baosheng Linux - Hardware 2 01-13-2007 09:35 PM
Parallel Port & Serial Port device identification helpmeforlinux Linux - Hardware 3 01-02-2007 02:15 AM
Send HEX info to parallel port thebover Slackware 14 10-12-2004 04:53 PM
How to Send data to the parallel port lambada Programming 2 02-12-2003 10:30 AM


All times are GMT -5. The time now is 05:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration