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......
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.
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.