Parallel port programming

K

karan

I would like to know how one can use the parallel port through
c/c++.Also, how does one determine what port is
installed(EPP/ECP/SSP/PS2)?
What is the differnece between these?
What are the current sinking/drawing capacities of these ports?
If possible, please give examples in C/C++.
Thanks

I would be grateful if any ebooks/tutorials could be provided at
(e-mail address removed)
 
J

Joona I Palaste

karan said:
I would like to know how one can use the parallel port through
c/c++.Also, how does one determine what port is
installed(EPP/ECP/SSP/PS2)?
What is the differnece between these?
What are the current sinking/drawing capacities of these ports?
If possible, please give examples in C/C++.
Thanks

Neither C or C++ defines parallel ports, or any other hardware for that
matter. Please ask in a newsgroup dedicated to your own operating
system.

--
/-- Joona Palaste ([email protected]) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"When a man talks dirty to a woman, that's sexual harassment. When a woman talks
dirty to a man, that's 14.99 per minute + local telephone charges!"
- Ruben Stiller
 
K

karan

I guess you were in a hurry that you misinterpreted my post.
- I simply want some code in C(and this is the C Newsgroup) to
write/read my parallel port.

Hope this clarifies and please read the message completely.
 
J

Joona I Palaste

karan said:
I guess you were in a hurry that you misinterpreted my post.
- I simply want some code in C(and this is the C Newsgroup) to
write/read my parallel port.
Hope this clarifies and please read the message completely.

I understand you want to write C code to use the parallel port, but the
fact remains, it's impossible to write such code in standard C, and
standard C is the only thing this newsgroup discusses. I didn't make
this rule, it's been here years before I came here. If you don't believe
me, ask the other regulars.
 
C

Chris Torek

- I simply want some code in C(and this is the C Newsgroup) to
write/read my parallel port.

It might be something like:

fd = open("/dev/parallel", O_RDWR);

followed by ioctl()s and read()s and write()s.

Or, perhaps it might be something like:

volatile unsigned char *pport_data = (volatile unsigned char *)0xf00c3158;
volatile unsigned char *pport_ctl = (volatile unsigned char *)0x14;

followed by direct access to *pport_ctl and *pport_data.

Then again, it might be something like:

#define PPORT_CTL 0771410
#define PPORT_DATA 0771412
...
outb(PPORT_CTL, control_value);
data = inb(PPORT_DATA);

perhaps preceded by some operation to grant access to those ports.

It could be something different from all of these. The correct
answer depends on your platform.

*Because* the answer depends on your platform, you need to ask
elsewhere, such as in a newsgroup dedicated to your platform.

There may not be such a place -- in which case, you may be completely
stuck; or perhaps comp.arch.embedded might be helpful.
 
M

Mark McIntyre

I guess you were in a hurry that you misinterpreted my post.

- I simply want some code in C(and this is the C Newsgroup) to
write/read my parallel port.

Thats well understood. Joona's point is that this group discusses the C
Language, and the language doesn't define parallel ports which are hardware
devices managed by your OS. As you have already been told, please ask in a
group specialising in your operating system and possibly your compiler.
 
M

Mark McIntyre

I guess you were in a hurry that you misinterpreted my post.

- I simply want some code in C(and this is the C Newsgroup) to
write/read my parallel port.

Thats well understood. Joona's point is that this group discusses the C
Language, and the language doesn't define parallel ports which are hardware
devices managed by your OS. As you have already been told, please ask in a
group specialising in your operating system and possibly your compiler.
 
M

Mark McIntyre

I guess you were in a hurry that you misinterpreted my post.

- I simply want some code in C(and this is the C Newsgroup) to
write/read my parallel port.

Thats well understood. Joona's point is that this group discusses the C
Language, and the language doesn't define parallel ports which are hardware
devices managed by your OS. As you have already been told, please ask in a
group specialising in your operating system and possibly your compiler.
 
M

Mark McIntyre

I guess you were in a hurry that you misinterpreted my post.

- I simply want some code in C(and this is the C Newsgroup) to
write/read my parallel port.

Thats well understood. Joona's point is that this group discusses the C
Language, and the language doesn't define parallel ports which are hardware
devices managed by your OS. As you have already been told, please ask in a
group specialising in your operating system and possibly your compiler.
 
J

Jack Klein

I guess you were in a hurry that you misinterpreted my post.

- I simply want some code in C(and this is the C Newsgroup) to
write/read my parallel port.

Hope this clarifies and please read the message completely.

Don't top post.

All right, let's see if I remember...

unsigned char *parallel_port = (unsigned char *)0x3ff8;

Then just write to *parallel_port.

I could have the address wrong. It's a long time since I programmed
the parallel port on a TRS-80 Model 1.

Buy heck, it's C.
 
P

pete

Jack said:
On 18 Oct 2004 10:25:51 -0700, (e-mail address removed) (karan) wrote in
comp.lang.c:

Don't top post.

All right, let's see if I remember...

unsigned char *parallel_port = (unsigned char *)0x3ff8;

I think that should be my_parallel_port.
 
M

Mark McIntyre

I guess you were in a hurry that you misinterpreted my post.

- I simply want some code in C(and this is the C Newsgroup) to
write/read my parallel port.

Thats well understood. Joona's point is that this group discusses the C
Language, and the language doesn't define parallel ports which are hardware
devices managed by your OS. As you have already been told, please ask in a
group specialising in your operating system and possibly your compiler.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top