LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LPT port / Single bit control?

Hi ALL
 
It is possible to control the 8-bit LPT port (parallel port) by Single bit control (.??
 
Regards,
Steve
Message 1 of 9
(5,444 Views)

Hi If you mean by single bit control you can always use a read modify write of the parrallel data.  i.e if you want to modify bit 3 then you read the LPT port (8 bits) then Exclusively OR it with 8'b00001000.  That would then flip bit 3.  Or if you want to read a specific bit just mask it with the appropriate number etc.

Craig

LabVIEW 2012
Message 2 of 9
(5,440 Views)
Hi craigc,
 
You are right but it always need to send the 8 bit pattern comand to device. (i.e. 0000 1000). Since i will use the LPT port to control my relay board. My purpose is control the individual bit without affect other bit status. For example, like PCI-6503 or USB 6501 DIO devices, if i open the 2 program and the line(bit) can be selected , i can share the same port under running 2 individual program without affect each other. (Since the pattern is not 8 bit pattern to be send). 
 
Thanks your help.
 
Regards,
Steve  
0 Kudos
Message 3 of 9
(5,430 Views)

OOPS:  I just re-read your post and noticed the following:  i can share the same port under running 2 individual program without affect each other.

What you can do if you are running two seperate VI's that need to communicate with the one parallel port is to create a sub-vi that will be called by both.  The sub-vi would take care of the actual transactions to the parallel port. You would need to read the status (bits) of the port to know what pattern you can write to it before actually doing so.  Additionally, you may need to implement a semaphore to prevent the other program from accessing the port while the first one is doing a transaction.  An Action Engine may be a good approach to implement the solution.

R

PS:  I will leave the original reply although it may not be helpful..  But contains good info..

 

Original reply:

Yes it is possible to control a single bit, because I had to implement something similar to your project back in 2003..

You didn't mention that you were familiar with the Parallel Port and LabVIEW, so you may want to have a look at the parallel port examples.

Open LV, Under "Help", select "Find Examples", and do a search under parallel (search tab & enter "parallel").

You will find 2 examples (maybe you already did this..)

1. Parallel Port Additional Data Register
2. Parallel Port Read & Write Loop.

Run either one. You should be able to set and read the port. There is a description in the example how to do this. Look at the "LEDs".

If you look at the first example, under the "IO connector Status" tab, you will find the D-sub pinout. If you run it, it will give you the present status of your pins.

They recommend using the Standard mode (SPP) setting in your PC's BIOS.

If you run the 2nd example, you can write & readback your parallel port. Try this FIRST before attempting to communicate with your relays.  The examples can help to determine which bits to read and write so that only one bit gets affected when setting the relay.

Hope this helps,

R

 



Message Edited by JoeLabView on 08-11-2008 08:28 AM
Message 4 of 9
(5,418 Views)
I am pretty sure that there is no way to control individual bits of the parrallel port.  As I said before the read modify write is the only way to set 1 bit, but as you correctly stated, this involves reading and writing the whole port.  However this is still a valid approach as Joe says, LabVIEW can handle the timing as long as you take care in programming your sub-vi.  If you use the same Sub-vi for both data lines / bits (Mayby even make a sub-vi which can change all 8 individually as it may come in handy later) LabVIEW should police the access for you.
LabVIEW 2012
Message 5 of 9
(5,403 Views)
I am pretty sure that there is no way to control individual bits of the parrallel port.  As I said before the read modify write is the only way to set 1 bit, but as you correctly stated, this involves reading and writing the whole port.  However this is still a valid approach as Joe says, LabVIEW can handle the timing as long as you take care in programming your sub-vi.  If you use the same Sub-vi for both data lines / bits (Mayby even make a sub-vi which can change all 8 individually as it may come in handy later) LabVIEW should police the access for you.
 
(Sorry for the double post)


Message Edited by craigc on 08-11-2008 08:52 AM
LabVIEW 2012
0 Kudos
Message 6 of 9
(5,401 Views)


craigc wrote:
I am pretty sure that there is no way to control individual bits of the parrallel port. 
You are correct.  As you mentionned, you need to read the current status and set the next bit(s) to change the single bit you are interested in.  😉
Message 7 of 9
(5,384 Views)

Hi Craigc & Joe,

Thanks for your great help. Overall, in parallel port, it cannot control the individual bit untiln now. BTW, if LabVIEW can be solved later on, It is the great improvement for all.Smiley Wink

Regards,

Steve

0 Kudos
Message 8 of 9
(5,366 Views)
LabVIEW cannot solve this. It is the way the pc's parallel port is designed.
Message 9 of 9
(5,353 Views)