Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

parallel port output question..

Status
Not open for further replies.

Guest
I've connected a led to my parallel port and programmed it to turn on and off.. but how do I do if I want to send say 0xff to pin nr 8 and no more?
Because when I turn on the led with outportb(0x378,0xff) I guess that the port starts to output a stream with 1 untill i turn it of.. or?
 
Replies continue below

Recommended for you

You can think of all parallel port outputs (data & control bits) as latched values. Once you write a value to it, it will not change until you write a different value.
 
yes.. I got that but how do i do if I want to send say 0xff and no more?(in c)
 
if you write a value to the parallel port, then it will never change unless you change it. Are you looking for the actaul C command?
 
I know the command but I got a unit that needs a specific hex as a handshake... and when It got that it sends a signal back.
and the problem I have is to send that command to a specific I dont realy get it...
I use the command outportb(0x378,?) but what should I place on the ? if I like to send say 33h to pin 8?
 
"send the command to a specific pin." should it be..
 
Hi vm01bjni,
Pin 8 is related to bit 6 of the data register. As the name said, it is a bit not a byte. So if you want to send 33h to this pin outportb(0x378, 0x80), you must send it one bit per one bit or in other words serially, of course with delay time between bit. But if you really want to do so, then why you do not use the serial port??!

cheers
 
ok i get it.. is it possible to connect say pin 8 to pin 10 and make a loopback to monitor what you send?
would it work to send a bit with outbportb and then recieve it with inportb?
 
theoritically it should work, but first you must be sure, that your parallel port support read & write, but normally all modern computers support this capability (find the discussion about this in : thread233-20414 ). You should set a bit to toggle the write and read modus.
You should make this step :
- set the write modus
- send data to pin 8 = outportb(0x378, 0x80)
- set the read modus (this doesn't change the status of
the data registers)
- read data from pin 6 = inportb(0x378, 0x20)
recall, pin 10 is conducted to status register !!

regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor