LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling relay board via printer cable

Hello all,
Please bear with me as I am an absolute beginner with LabVIEW, but want to learn.
My boss has asked me to try and write a program to control a PC relay driver board, which is here: http://www.quasarelectronics.com/3074.htm
According to the user manual "you can write your own programs in any language to output a byte to the printer port and the bits which are high will turn on the corresponding relay. The overlay on the PCB shows which bit in the output byte turns that particular relay on. For example, output 00010001, or 11 in hex turns on relays 1 & 5. Each relay number is also marked on the overlay for easy reference." Do I need a printer driver, do I need a DLL?
Could anybody show me where I should start, or lead me through some way? To me the problem sounds like it might be relatively easy, but too much for me

any help would be greatly appreciated
thanks,
Gwilym
LabVIEW 7.1 unfortunately
0 Kudos
Message 1 of 18
(3,401 Views)

This is quite easy actually.  I've done this type of relay control in the past... works well..

Do I need a printer driver, do I need a DLL?

No.  All you need is your PC and the Labview Development System.  You may have to change some settings in the PC's BIOS.  I'll look for the post I wrote on this.


Could anybody show me where I should start, or lead me through some way?

Yes.  Open LabVIEW

Under the Help menu, select >Find Examples

Do a search on "Parallel Port"  There are two examples that will be useful.  You will need to set the addres of your port, which you can find in the Control Panel > System >  Hardware Tab > Device Manager

Look under COM & LPT Port, and open the properties for the LPT port.  The resource address should be there.  Mine is : 0378

Follow the instructions in the example.  You can experiment a little and wtach how it controls the relays.

In the meantime, I will look for the thread & a document that discusses this subject.

R

Message 2 of 18
(3,398 Views)

Have a look at this thread.

And this post.

which has a .pdf document called: General Information on Parallel Ports.pdf

Let me know how it goes.

R



Message Edited by JoeLabView on 08-01-2008 11:41 AM
Message 3 of 18
(3,395 Views)
I'm afraid that the .pdf is at far too high a level for me, but I'm looking at the second example and trying to understand it by deleting things and seeing what happens.
thanks for such a quick response!
LabVIEW 7.1 unfortunately
0 Kudos
Message 4 of 18
(3,377 Views)
It's been working really well and I've been having a lot of fun, but I've come upon a problem that none of the tutorials I find seem to solve, probably because it is so basic that its obvious: I can't tunnel out of a For Loop.
I'm using a modified version of the "parallel read and write" example and am trying to send to the out port for a user selected number of cycles, then go on to send a different set of signals to the port.
I thought that I could use a For Loop to control how many times, and then put a Sequence Structure around all of that to cover what happens after the For Loop has run its course.
Eventually I'm aiming towards having a button that allows the user to just insert or put on the end another frame in said Sequence Structure should they wish to have more sets of cycles.
Could anybody put me right in my misunderstanding and put me back on track (again)?
thanks in advance!

Gwil

p.s. Our lab only has LabVIEW 7.1, is this a problem?


Message Edited by gwilbob on 08-06-2008 10:00 AM
LabVIEW 7.1 unfortunately
0 Kudos
Message 5 of 18
(3,337 Views)
You actually are tunneling out. The problem is that a for-loop will automatically try to auto-index on input and outputs. On outputs it will try to generate an array, which is what is happening on your "outbound" tunnels. If you have the Context Help window open and put the wiring tool on the wire it will tell you the problem. For the numeric wire you want to disable auto-indexing. To do so, right-click on the tunnel and select the "Disable Indexing". For the error wire you actually want that to be a shift register so the error is passed around each iteration so that if an error occurs in one iteration it doesn't get lost.

Auto-indexing and shift registers are explained in the LabVIEW Help and in the tutorials.

I didn't completely understand what you were describing with sequence frames and buttons.
Message 6 of 18
(3,326 Views)
To learn more about LabVIEW, I suggest you try looking at some of these tutorials.
Message 7 of 18
(3,313 Views)
I've looked at quite a few of the tutorial, but I can't solve what I imagine is a simple: how to do something for a specified time or number of cycles, then do something else for a different specified time or number of cycles, for example flash the boolean LED.
Is there a simple way of doing this that I've missed?
I've tried to do it by using two different For loops and local variables, but the local variable only gets sent and the beginning and end of the looping.
Sorry about this continued pestering, but I do seem to be getting somewhere, even if it doesn't look like it externally...
thanks!
LabVIEW 7.1 unfortunately
0 Kudos
Message 8 of 18
(3,292 Views)
There is no need to use a local variable to do that. Do you have a background in text-based languages? I ask because most people who have done text-based programming and start out programming in LabVIEW immediately start using local variables thinking that LabVIEW works the same way as text-based languages. A front panel control can be set to blink by simply setting the blinking property. The blinking rate is set in the LabVIEW options:

If you want to use a different blinking rate use a shift register in a loop:




Message Edited by smercurio_fc on 08-08-2008 09:35 AM
Download All
Message 9 of 18
(3,283 Views)
Yes, I only have experience from a small amount of text-based programming, you guessed correctly!
Either way, the blinking is not the important bit, it's just a test output.
Doing something for a period of time,  then doing something else is what I can't get a hold of. Can you help with that one?
thanks again!
Gwilym
LabVIEW 7.1 unfortunately
0 Kudos
Message 10 of 18
(3,277 Views)