Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

Control over each pin of the printer port

Status
Not open for further replies.

AmeyaPurohit

Technical User
Mar 15, 2001
3
0
0
IN
thank tyou guys for ur valuable suggestions. But what i want is a program that will able me to control the individual pins of the RS-232C port.
what i mean to say is that the program will configure the keyboard such that 25 individual keys can used to control the output at the 25 pins of the port
Kindly tell me if such a thing is possible. Thank You.
 
I'm not sure if this is what you are looking for, but it is possible to control the stream of data going to the port in, I believe, 8 byte packets. In this case you can control each bit in the packet. As far as controlling each individual "pin", I'm not quite sure that is possible because the pins don't hold any information, they just transfer the data packets to the printer.
 
Hi AmeyaPurohit,

I would suggest you take a look at the RS232 spec (Kind of a misnomer because the "spec" is really about voltage\current levels and not pin outs). The port may have 25pins, but some of these are grounds, not used, inputs, etc. Take a look at the site below to see what I mean:


Note that the IO directions are kind od reversed on this page as it is looking from the perifials' <sp> point of view.
There are registers on all com ports that allow you to control some of the handshaking pins such as RTS, DTR etc.

Base Address + 4 (Or 3FC on COM1) bits 0 & 1 control DTR & RTS

Base Address + 6 (Or 3FE on COM1) can be read to determine the status of some of the input pins such as RI, DSR, CTS, etc....

I hope this helps you out.



Kim_Christensen@telus.net
 
The LPT port has 8 pin you can use (+ ground) the rest is signal for eg. Printer. These 8 pin can be used as a byte
and has 255 oppourtunitys. If you want to use the signal for controleing eg. a light pult like i do. You have to build a DA convertor (Digital to Analog) you can get the IC (Intern Circus) in most Elecktronic stores (part stores)
I use qbasic to programe the port I think I have the code for c but not here with me now.
Here is the qbasic code: OUT [port], [byte]
Eg.
here I use LPT1

OUT &H378, 20

the Printer LPT1 port vill now be:
(pin is the pin nr on printer port only the 8 posibel pin)
Pin: 1,2,3,4,5,6,7,8
value:0,0,0,1,0,1,0,0
you can also controle each pin:

OUT &H378, 2^n

n can be from 0 - 7
Here is the 8 posibel.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top