LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write to/read from digital port_DAQmx

I want to use a USB-6009 DAQ to control two stepper motors concurrently. The speed of these two motors change during the time.

I have problem with writting the digital output to my DAQ. I've searched through the examples and tutorials in the ni website and on the web; but I haven't find a good tutorial about how to write on the digital output of DAQ. Specifically, because the digital output part in DAQ Assistant is too general and doesn't give me the option of programming, I need to know more in detail about DAQmx pallete parts rather than just the DAQ Assistant.

I also want to read from the same ports on the DAQ to check if my code does the digital output writing correctly. 

Could you please help me with a good tutorial about how to make a vi using DAQ-mx pallete?

Your any kind of help in this regard is so appreciated. 

 

 

0 Kudos
Message 1 of 7
(4,937 Views)

This tutorial should help you:

Getting Started with NI-DAQmx

 

There is a section for Basic Programming with DAQmx that shows how to use the native DAQmx VIs.

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 2 of 7
(4,930 Views)
you can also call LabVIEW examples. Go to Help->Find examples->Hardware Input and Output->DAQmx
0 Kudos
Message 3 of 7
(4,905 Views)

uci wrote:

I also want to read from the same ports on the DAQ to check if my code does the digital output writing correctly. 

 

 


You cannot read from the same port that you use to write.  With DAQ, you use either an AI (analog input) to read or an AO (analog output) to write.  So you must first use a multifunction DAQ, one that has AIs and AOs on them.  Wire an AI channel to the same place as your AO channel.  Then you can write to the AO and then read the AI to confirm that the AO has done its job.

 

 

Ooops, I just noticed that you said "digital output".  Same principle, just substitute AI with DI and AO with DO.  I think some digital cards will allow you to read from a DO after it has been written.  Then you would only need one wire and one channel.  But not all cards do this.  You will have to search for one that has this capability.

 

Message Edited by tbob on 06-09-2010 10:23 AM
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 7
(4,883 Views)

Thank you so much for your help.

Finally, I could write what I want on the DAQ card digital port. Now, the problem is that this output doesn't run my stepper motor. That's while exactly the same output runs the motor via parallel port. I think the problem is that the the digital output voltage of the DAQ card is about 5V while the parallel port's digital outpot is about 2V. And possibly the input voltage for my stepper motor driver should be around 5V. Do you know how I can change the voltage of the digital output from 2V to 5V? I didn't find any port for setting that in the DAQmx Write vi.  

0 Kudos
Message 5 of 7
(4,836 Views)

uci wrote:

I think the problem is that the the digital output voltage of the DAQ card is about 5V while the parallel port's digital outpot is about 2V. ..... Do you know how I can change the voltage of the digital output from 2V to 5V? 


Conflicting statements.  The digital output should be about 5v.  Parallel port output should also be about 5v.  Typically the output will be between 4 and 5v.  If the digital output is less than 4v, this means that it cannot produce enough current to drive the stepper motor.  You will need some sort of driver circuit to produce the current necessary to drive the motor.  Typically, most digital outptus will not be able to drive stepper motors.  However, there is some DAQ cards with high current digital outputs, at least high enough to drive stepper motors.  You could search NI site for them.  Look at the specs for your stepper motor, find how much current it draws.  Then look for a Digital Out card that can drive this current.

 

The other alternative is to build a driver circuit using a transistor.  The digital out can turn on the transistor which will be able to drive more current (depending upon the transistor chosen).  NPN transistors will invert the signal, so you could use two of them (invert then invert again), or a Darlington pair, to properly drive the motor.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 7
(4,823 Views)

Hi uci,

 

Tbob is correct.  The USB-6009 can source up to 5V with a maximum of 8.5mA.  The USB-6509 can source 100mA from one port with an external power supply.  The Motion product line is completely devoted to driving motors and may have something to suit your needs.  Hopefully this helps!

Regards,


h_baker
National Instruments
Applications Engineer
0 Kudos
Message 7 of 7
(4,802 Views)