From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble with analog output using Matlab - voltage is not what I set it to be

I'm trying to create an analog output signal on a PCIe-6321 using Matlab (while simultaneously collecting data with analog inputs, but I've isolated the problem to the output). I can't get it to actually generate the voltages I set in the output signal. They're always +/- ~0.6 V or just 0. I've tested this both in Matlab and in NIMAX with a task. I put a DMM on the pins and I never see above or below ~0.6 V. The only thing I've noticed that is different from online is that the Matlab help pages have the output channel set as differential, but I get an error when I try that.

0 Kudos
Message 1 of 8
(3,328 Views)

Try running one of the LabVIEW shipping examples. You can find these in LabVIEW by navigating to Help > Find Examples > Hardware Input and Output > DAQmx > Analog Output. 

 

It would also be good to try another measuring device. Do you have an o-scope or other device you can use to confirm the measurement you are getting from the DMM?

Aaron Douglass
Applications Engineer
National Instruments
0 Kudos
Message 2 of 8
(3,268 Views)

I don't have LabVIEW to try that.

 

I can try an oscillascope or another DMM, but I've no reason to suspect that the DMM is wrong. It also happens to be brand new.

 

I'm using this to control a switch, so I can also tell by the fact that the switch is not switching since it requires 3.5 V to switch.

0 Kudos
Message 3 of 8
(3,262 Views)

Why are you using analog output rather than digital to control the switch? Could you try using a digital output instead? 

 

Have you ever had the analog output of this card working properly in the past? 

 

When you are using a task in MAX, does it appear to be outputting the proper voltage? Could you post a screenshot of your task as it is running in MAX?  

Aaron Douglass
Applications Engineer
National Instruments
0 Kudos
Message 4 of 8
(3,251 Views)

I was using a digital output, but I could never get past this error: http://forums.ni.com/t5/Multifunction-DAQ/Matlab-Error-Analog-Output-underflow-event-but-I-m-not-usi...

 

When I switched to analog output, I could at least run the Matlab script all the way through without error.

 

This is the first time I'm using this DAQ; it's new. Here's a screenshot of one task I've tried. No matter what the voltage is set to on the task (-10 to 10 or -1 to 1) or what shape (sine, square, or triangle), when I run it and put the DMM on the pins, I get +0.55 V for five seconds and -0.55 V for five seconds.

NIMAXAnalogOutputTask.PNG

0 Kudos
Message 5 of 8
(3,242 Views)

Are you using a mechanical relay?

 

My suspiscion is that you are seeing this voltage because of the added resistance of the relay. The card is not able to source enough current to provide more than about 0.6 volts to the relay. To test if the card is outputting voltage properly, please disconnect it from the relay and run your task in MAX. Does the DMM read the correct voltage if the card is not connected to the switch?

Aaron Douglass
Applications Engineer
National Instruments
0 Kudos
Message 6 of 8
(3,228 Views)

This is where I was headed too. I have gotten it to work with NIMAX without anything connected, but only once. After, even with everything still disconnected, it won't work again. I'm not sure if going between NIMAX and MATLAB creates an issue in which MATLAB is somehow holding the voltage even though the script is done running. I tried clearing MATLAB and even closing it, but still cannot get the task in NIMAX to work again. The switch appears to require ~0.12 A, and the card is rated for 5 mA, so that would explain things. I think I'll try a different switch and see if that fixes it. I wonder if that could have been the issue when I was trying digital output.

0 Kudos
Message 7 of 8
(3,225 Views)

Is your switch a relay?   (an inductive load?)

You might have blown the output, even 5mA can cause a high voltage peak on an inductor.

 

I don't have the schematics of the card, maybe the voltage supply for the AO is down, maybe only for one channel, maybe for all.....  can you check other AOs? (Without load)

The 0.6V you still get migth be a (protection) diode to the AO voltage rail witch is down to GND now 😞 ....

 

Inductive loads (like relays) want to keep their internal current... if you turn off the power, the current still wants to flow, with the result, that the voltage on the inductor increases. (For a ananlog EE that's 101). One common way to avaoid that voltage peaks is a 'free wheeling' diode at the inductor. ... 

 

There is at least one KB article on how to drive a relay with a DO (or AO) ...

 

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 8 of 8
(3,217 Views)