Today is...
Sunday, December 28, 2014
Welcome to, the global online
community of automation professionals.
Featured Video...
Featured Video
A quick introduction to EtherCAT for motion control and I/O...
Our Advertisers
Help keep our servers running...
Patronize our advertisers!
Visit our Post Archive
Interface using Parallel Port on Windows XP
I need to show what's on the 3 seven segment displays on a PC using parallel port and Visual Basic.Net

i need help here.

I need to show what's on the 3 seven segment displays on a PC using parallel port and Visual Basic.Net

For example, if the seven segment displays shows 100, then my program has to display 100 too. How do i achieve this? Whhat about making the displays realtime? As if when the seven segment display changes, the reading on the PC changes too without having to click anything.

I already know some basics, i just need some details. Thank You

By Ivan Sanchez on 17 October, 2003 - 12:31 pm

I imagine you can read information at your Parallel port (you can use "inpout32.dll" for Win NT. If it is try to make a multiplexer using control lines in P.port to select some buffers (like 74LS244) each one buffer output sholud be conected at data lines in P.port (of course, buffer input should be conected at your 7 segment display or binary output).

Once you can select each buffer (manually), make a program that make it itself at a good speed, read it and show it in the screen.

Iván Sánchez ITCH

Thanks for the information.

I just want to confirm a few things. After i connected the 74ls244's outputs to the datalines on the parallel port and the 74ls244's inputs to the 7 segment display, do i straight away write a program in visual basic to read the status lines of the parallel port?

do i have to make more connections? what about the control lines of the p.port?

By Joe Jansen/TECH/HQ/KEMET/US on 20 October, 2003 - 3:12 pm

What is the 7 segment display connected to? There are probably some very difficult and exotic methods of doing what you want (vision system looking at and reading the display, tap into the 7 segment driver lines with multiplexers, synchronized to the CS lines of the display digits, hold and forward to the PC via parallel port, etc). These would cost you way more than what they would be worth in hardware and in time expended.

Best bet is to try to communicate with whatever is driving the display. If a temp controller, look for a serial connection, or get some A/D hardware and pick off a 4-20mA signal, or something similar.

Let us know what you are trying to talk to, and maybe we can offer more assistance...

--Joe Jansen

The seven segment displays are connected to an IC called CA3161. It is a BCD to seven segment decoder/driver. This IC is used together with CA3162, and A/D converter for 3 digit display. You can refer to the datasheets for more information about this pair of ICs.

Thanks a lot for offering to help because i'm kinda stuck now.

I'm trying to communicate with A pair of IC's CA3161 & CA 3162. Check out their datasheets and you'll know what i'm talking about.

By Joe Jansen/TECH/HQ/KEMET/US on 23 October, 2003 - 11:05 pm

I would tap into the BCD output lines and the digit driver lines, put some opto-isolators on them, and drive your parallel port with the outputs of the opto's. You would get (obviously) a BCD value for each digit, and you would need to read the digit driver to know which you are looking at, then read the bcd value of that digit position.

Once you have the electronics done, writing the program should be almost a cut and paste project for reading the pins on the port. 7 inputs, so you shouldn't even have to multiplex anything!


Based on the discussion here's how I would approach it.

1. Read back the 7 bits from the CA3162 and not try to read back the 21+3 bits at the 7 segmebt display.

2. The quick and dirty way is to put the PPort into a mode through the BIOS that allows setting that data port of the PPort as input. Connect the 4 bits of display data and 3 bits of strobe information to the data pins of the PPort.

3. Start reading data. The data bits will only be valid for the digit that is being strobed at the time.

4. A more robust solution (that won't burn up the PPort on boot up etc) is to, as suggested, use a 74ls244 to buffer the 7 bits. The inputs of the 244 connect to the outputs of the CA3162. The outputs of the 244 connect to the data pins on the PPort. The output enable of the 244 get connected to a control pin on the PPort that will keep the 244 outputs disabled during boot, system initialization etc, i.e. check the pin definitions for polarity and check the pin state after windows is up and running. Then when your program is ready to read data, set the PPort so it reads data on the PPort and set the pin controlling the 244's output enable pin so the outputs are enabled.

By Joe Jansen/TECH/HQ/KEMET/US on 24 October, 2003 - 5:33 pm

Just another thought:

What if you went thru the opto-isopators on the 4 BCD plus 3 strobe lines as mentioned, but feed the data into a PIC microcontroller? That way you don't need to worry about problems with trying to capture the data during the strobe cycle with the PC. Something along the lines of a PIC18F242 with a 10Mhz xtal with PLL clock qudrupling enabled would be more than fast enough to catch all this data and organize it in the PIC's memory.

The 18F242 also has an onboard UART (actually USART) that you could use to send the data along to the PC at a relatively leisurely pace via RS-232.

The microcontroller costs all of about $12 from Digi-Key. Opto isolators, and misc parts (cable, RS-232 connectors, etc) could have you up and running for under $50. The only caveat would be needing the ability to program the chip. I could help with that if you need, contact me offlist at if interested.

--Joe Jansen

Thanks for all the information.

Now i just need some help on the programming section.

1.I can't seem to get the datapins of the parallel port to read data instead of outputting data.

2.How do i write the command that will enable the computer to read data from specific datapins of the parallel port? For example, i want pins 2, 3, 4, 5 and 7 being read. How do i do that?

By Richard Mahn on 28 October, 2003 - 11:50 pm

Check out
You need to set bit 5 in the control register (base + 2) for a SPP to allow the 8 data bits to be used for input.

By Régis METTRAUX on 29 October, 2003 - 10:56 pm

Have a look to the following article.

"Controlling LEDs (Light Emiting Diodes) with Parallel Port".

Well, as I see in your text I can't exactly know ur problem is in software or hardware, but it's so simple in both cases. for the hardware just use 3 TriState buffer X 8 with a multiplexer, connect the Multiplexer to control lines of the parallel port & connect the TriStates to the data lines. set the bit number 6 in the control Register of parallel port to 1 in order to enable reading through data bits, then connect each 7-segment lines to the triState. then connect the output of the multiplexer to the CS of triState. now you can enable reading one of the triSatates into ur Parallel port data bits, according to the address on your Control Bits, then write a simple code to convert the bits into a number. it will simply be a lookup table program.

By Anonymous on 25 July, 2004 - 2:54 pm

ifu u want to take input use this code of c language
void main()
{int a;
goto back;
this works on bidirectional mode and just attach the binary or coded BCD coming to led display to parallel port

and this loop is infinity

CANNOT work: on 32 bit systems, (NT/2000/XP) usual OLD 16 bits code (as inportb) cannot work.

Read and download from here.

Hope this helps!