Switch Hardware and Software

Showing results for 
Search instead for 
Did you mean: 

control relay

I try to control 3 relay by using NI-DAQ (USB 6009) but i can only determine one port for one relay, i don't know how to determine 3 ports for 3 relay.....

could anybody tell me how to do that?

appreciate your help......  

0 Kudos
Message 1 of 7

Your question has nothing to do with NI Switches. It should have been posted to the multifunction DAQ or digital I/O board.


A port of the USB-6009 consists of  multiple lines and you can easily write to all lines if you are configured for port access. For example, if you write a binary 001 to the port, you output a 0 on lines 1 and 2 and a 1 on line 0. Writing a binary 100 will write a 1 to line 2 and a 0 to lines 0 and 1. Instead of port mode, you can use line mode and either use one task for all three lines or a separate task for each line.


You have not mentioned which language you are using. If LabVIEW, open the example finder. You will find some simple examples of line and port mode. The DAQ Assistant can also be used. This is a very simple task to code. If you continue to have problems, post the code you've writte. You should also review the information on the DAQmx Getting Started page.

Message Edited by Dennis Knutson on 06-24-2009 09:47 PM
0 Kudos
Message 2 of 7

Sorry, I'm using the LabVIEW language, I done as shown below, can it becomes more simple?



0 Kudos
Message 3 of 7

Sure, you can simplify it. Look at the example program called Write Dig Chan.


p.s. when you have a while loop, you should place a wait function inside. No need to spin the loop so fast. It will just cause your cpu usage to climb for no reason.

0 Kudos
Message 4 of 7

how to place the wait function? could u show me?

 Thanks a lot..........

0 Kudos
Message 5 of 7

Right click to get the functions palette. Set one of the wait functions on the timing palette.


LabVIEW tutorials

0 Kudos
Message 6 of 7
ok, thanks:smileyhappy:
0 Kudos
Message 7 of 7