Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PC Parrallel Port

Status
Not open for further replies.

demestav

Member
Hello. I want to use the Parrallel Port of the PC to operate an RF module. I looked at the Parallel Port specs and saw that DATA lines are both IN/OUT. My question:
Can the pins of the parallel port be adjusted (IN or OUT) individually? Or it needs the whole port to be IN or OUT

Thank you.
 
Whole port(8 bits) as far asI know. But you can use some of the other lines, /STROBE, PE, ERROR etc. as inputs or outputs. Not so easy with later MS operating systems, although there are apparently work-arounds.
 
demestav said:
Hello. I want to use the Parrallel Port of the PC to operate an RF module. I looked at the Parallel Port specs and saw that DATA lines are both IN/OUT. My question:
Can the pins of the parallel port be adjusted (IN or OUT) individually? Or it needs the whole port to be IN or OUT

A standard parallel port is output ONLY for the main pins, there are a number of handshake lines that are inputs though. Enhanced ports can be inputs as well, but there are a number of different standards used (EPP etc.), most modern ports can be set in the BIOS to be any of the port types.

As far as I'm aware, you can't set individual port pins as inputs, it has to be the entire port.

You would probably be better using the port in standard mode, and using the handshake lines - there is LOADS of data on using parallel ports on the net!.
 
Hello and thank you for your replies. Yes i have read the data on the net but i was wondering if there was something i did not get! Because i can see many applications implementing PC connection and i was wondering how it could be done, if pins cannot be set individually!

To clear it up in my mind, most ordinary people use the parallel port in standart mode for their applications, using the nine control and status lines for inputs?

Thank you for you help. :D
 
demestav said:
Hello and thank you for your replies. Yes i have read the data on the net but i was wondering if there was something i did not get! Because i can see many applications implementing PC connection and i was wondering how it could be done, if pins cannot be set individually!

To clear it up in my mind, most ordinary people use the parallel port in standart mode for their applications, using the nine control and status lines for inputs?

Yes, that way you are sure it will work on any PC parallel port, because all will work as standard ports.

The standard port has only five input handshake lines, the others are inputs. You should also be aware that some lines are inverted, and some not - there's also at least one which is open-collector!.

For an RF module presumably you only need one serial output pin, and one serial input pin?. You could use two of the handshake lines for that.
 
Well actually the RF module i am using needs 4 data lines which should be bi-directional, and also 2 output and 2 input control lines.

The problem is that in the datasheet of the RF module says that the data lines should be "directed" as input most of the time, and ONLY when data is transferred to the RF module should be "directed" as outputs.

I can understand that with the parallel port, you cant set the direction of the line (output/input) but only set if it will work both ways.
 
:lol:
The parallel port in SPP mode(standard) have 3 ports: data, status and control. The data port is only output(it can be switched in input only in Bidirectional mode, but many actual MB not suport Bidi mode). The status is only input. But the control port pins is open colector/drain and have internal pull-up resistors, so if you set these 4 lines to 1(at pin) the pull-down transistor is off and the lines can be used for input.
 
It may help us help you if you post a link to the RF module info. There is a good chance you may be able to adapt a simple EPP command control decoder to to your application. Port read/writes are a simple as reading and writing a PC internal hardware address (Port BaseAddress +3 & 4). The Parallel Port EPP Sequencer takes care of the actual data port switching and EPP command generation.
Dialtone
 
Dialtone, that would be perfect if it could be done automatic!!! The URL of the datasheet is http://www.radiometrix.co.uk/products/sp2.htm
Now the important part is at paragraph 2.THE HOST INTERFACE. The "problem" is here, from paragraph 2.2.1
The data bus must not be set to output until step 3. i.e. after the SP2 has accepted the request. The bus may be left as an output until the entire packet has been transferred to the SP2, it should then be set back to input (default state).

So it needs D0-D3 to be set as inputs(until data transfer) therefore having this lines setup 'bidirectional' should be a problem,right?

Thank you for your time.
 
Thank you Nigel, somehow i managed to miss that app note which completely solves the problem!
So to see if i got it right:

Please confirm that my steps are correct

(1) First of all i checked in the hardware devices of my PC and the Parallel port is set to ECP so i do not need to set anything in the BIOS

(2) I will set bit 5 of the control reg to 0 and 1 to control whether the data pins are input or output.

Also it would be nice if you could to tell me (guidelines) how i detect an interrupt of the parallel port. If you cant that is OK you already help me enough.

Thank you all.
 
demestav said:
Thank you Nigel, somehow i managed to miss that app note which completely solves the problem!
So to see if i got it right:

Please confirm that my steps are correct

(1) First of all i checked in the hardware devices of my PC and the Parallel port is set to ECP so i do not need to set anything in the BIOS

(2) I will set bit 5 of the control reg to 0 and 1 to control whether the data pins are input or output.

Also it would be nice if you could to tell me (guidelines) how i detect an interrupt of the parallel port. If you cant that is OK you already help me enough.

Sorry, I've no idea!.
 
After looking over the data transfer sequences, this device is not suited for EPP transfers. It is just too slow, and the handshaking is not EPP compliant.
It is well suited for standard parallel port bi-directional mode transfers, but will require your control program to to be structured properly to administer it.
To answer some of your questions:
1. I have had some considerable experience in this area and can tell you selecting a Bios settig of ECP only can cause some trouble. Although you can set the ECR mode bits to any supported state, you may find that it does not operate in the selected state on all machines. If you have a Bios setting of ECP+EPP or Normal, use that instead. I find the ECP+EPP works well on almost any machine that supports this selection.
2. You are correct that bit 5 of the control register is the data port directional control bit. Make sure your program sets it to the correct state on the initial entry.
3. The wiring setup does not support interrupt detection, so your control program will need to constantly read the status register bits 0-1 to detect the transfer request singal from device to host, and transfer ACK signal from device to host.

Depending on the Operating system of your PC, and what you use to write your control program, you may need to download some free program modules to get direct access to the PC printer port hardware addresses. One I use is called InPout32.dll Do a google search for the location of the downloads. The latest version works on both Win95-ME or NT/2000/XP based OS's.

Dialtone
 
Dialtone thank you for your reply. I have downloaded the drivers and make a very basic VC++ program and it seems to work. Therefore...here we go again back the struggle!!! Thanks. :D
 
As i was testing the port on my pc i noticed something which i dont quite get. The pin 13 of the port is the input to the PC. Well when it is connected on the pc it shows 3.36Volt. First of all, since it is input shouldn't it be 0V??? I noticed that as soon as i connected it with GROUND i detected through the pc that it was low. Well, remember that through this pin THE LOW STATE of the RF MODULE will be detected. So when the RF MODULE STATE is low, this doesnt mean that it will be connected to ground(right?), it will just be low voltage close to zero, so it will not be detected by the PC. Am i right? :roll:
Thank you.
 
Most likely, the reading of 3.3v on the pin is due to a pull up resistor. Any standard logic low should be able to override the pull up battery and register the proper reading in the status register bits.
One thing to make sure of, is to tie parallel port pins 18-25 (Data returns) to the ground source that feeds the rf module power. This will make the ground refrences between the 2 devices the same, and allow proper detection of high/low logic levels.
Good luck and keep us posted with the results.
Dialtone
 
Well i guess i have to test it with the RF Module altogether and see what happens! Something else. The voltage of the SP2 are CMOS (that means 5V right?) but the PC is 3.~V. Before i knew that you do that conversion using a RS232. But after reading a bit about RS232, i read that is used only for serial communication!?!?! RS232 is just to convert the voltage isnt?
 
demestav said:
Well i guess i have to test it with the RF Module altogether and see what happens! Something else. The voltage of the SP2 are CMOS (that means 5V right?) but the PC is 3.~V. Before i knew that you do that conversion using a RS232. But after reading a bit about RS232, i read that is used only for serial communication!?!?! RS232 is just to convert the voltage isnt?

RS232 refers 'mostly' to the voltages used, which is +/-12V.

The PC uses 5V logic for the ports (0-5V), you should have no problem connecting external 5V logic to the port. Because the port is 5V logic, it doesn't mean it outputs 5V, only that it switches from LOW to HIGH at the correct level for 5V logic (which isn't at all critical).

In case no one else has mentioned it?, you should be VERY!! careful - it's easy to blow your parallel port, which usually means you have to replace your motherboard these days!.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top