LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

square wave analog out with DAQmx

hi all,
 
I'm still learning some of the features that labview has. But I'm having problems with my 6031e board when i am trying to output a square waveform to my AO0 channel.  I modified someone else's work by placing a square wave vi between the Damping multiplier the analog out.  please see picture attachment to where I placed the square wave vi.
 
The the output channel worked before without the square wave when the Damping multiplier was directly connected to Analog out line in the picture.  However, by adding a square wave voltage box in between it doesn't output the voltage anymore.
 
The labview block runs fine just that at the AO0 channel of my 6031 board shows 0 volts.  What do i need to change to get a square wave working?
 
 
Thanks for your help!
0 Kudos
Message 1 of 5
(6,377 Views)

Hi immortalc,

Usually it is easier to diagnose problems like these when the actual vi is posted or at least a similar code snipet the mimics that actual code (for codes that have IP issues etc.) At first glance, I must ask if you have looked at the analog out indicator and verified that the voltages you are sending to the analog out task make sense. For instance, it appears that the first sample in the damping magnification array is being wired to the duty cycle input of your square wave function. If this is true, could you be possibly wiring a 0 to the duty cycle, as this will give you 0 voltage readings for the entire array? Also, you haven't wired anything to the sampling info input of the squarewave function. By default, the sampling frequency and number of samples of the square wave will be 1000 samples at 1 kHz. I'm not sure how many samples you have configured for analog output and what the output sample rate is but you will want to make sure that your square wave matches these parameters. So, first things first, post your code and this should be an easy fix. Secondly, check the data that you are sending to the DAQmx write function to make sure it makes sense. For instance, your task may be configured to output 100 samples and the first 100 samples of your square wave may be all 0s based on the duty cycle and phase controls.

regards,

caz



Message Edited by caz on 01-30-2008 11:16 AM
0 Kudos
Message 2 of 5
(6,365 Views)
Hi Caz,
 
I guess when you mean if I had "verifed", I checked the line using a probe while running and I do see the value changing on the analog output line.  it just that my 6031e board doesn't send that information out to my Ao0 channel.  In labview I see the graph producing the waveform its just when I measure the actual out channel with my meter, It's still 0 volts.
 
I attached most of my program and the square wave vi is near the bottom of my loop.  My settings if you check out the DAQ is set to Continuous samples with a sampling rate of 120Hz.
 
It's probably something really simple... But thanks for your quick response and help!
 
 
0 Kudos
Message 3 of 5
(6,355 Views)

If, as you say, the AO works when the damping multiplier array (thick orange line) is wired directly to the DAQmx Write.vi, then the problem should only be in the data that the Square Wave.vi is sending. Without having your hardware to actually test your blockdiagram, I can only point out a few things to try. You should make the data the square wave.vi is generating match the same upper and lower limits as what is coming from the damping multiplier. For instance, set the offset to the same value as the amplitude to ensure that only positive values are being generated. If the multiplier array goes only from 0 to 5 V, set the amplitude to 2.5 and offset to 2.5. Also, verify that the duty cycle (stick a probe on this wire) is not 0. You may want to just hardwire a 50 to force this. To test how the square wave.vi works, make a new vi with just this function and wire its output to a waveform graph. Play with all the different inputs to get a square wave that looks like what the multiplier array looks like. Then duplicate these inputs in your real code. Last but not least, if nothing above works, write a new simple AO vi that only does analog output and uses the square wave.vi to generate data. If you can't get this to work, then there is something else that needs to be debugged. However, if the board works when using the damping multiplier array, I feel like it is just a problem with setting the parameters for the square wave.vi.

Let me know how everything works out,

caz

0 Kudos
Message 4 of 5
(6,344 Views)
hey caz,
 
thanks for your help.  But I found an example help vi that did the trick.   I think I need to use the search forums more often.  🙂
 
HELP >> Find examples >> Hardware Input & Output >> Voltage >> Cont Gen Voltage Wfm-Int Non Regeneration.vi
 
i changed my AO.dataXfermech to DMA at the DAQmx channel box and basically copied the sample vi.  everything works great except i'm trying to get the sampling rate to update more smoothly with a square wave output.  but increasing the sampling rate increase my write file size. But anyways thanks for your help and to the ni forums!
 
 
 
 
0 Kudos
Message 5 of 5
(6,333 Views)