LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to AO Square Wave Pulse with Different Amp and Freq after time T

Hi,

 

I am trying to AO a square wave pulse using DAQmx with USB-6002. The signal that I would like to generate is as follows:

 

For 1ms, generate 25 pulses of 5V amplitude @ 50% duty cycle. Then, 100ms after that, generate 1 pulse of 0.5V amplitude @ 50% duty cycle. Data is only acquired and logged during the 100ms duration. How to best implement this?

 

I started with a state machine in the test vi (see attached) with counters (might not be necessary) to monitor when the program should move to the next state. My goal is to later use such structure in my main QMH program for the signal generation and data acquisition loop. I understand that my timing and sampling information may be off. I am open to ideas and critiques! Thanks. 🙂

0 Kudos
Message 1 of 4
(2,737 Views)

Hi qtism,

 

why not measure your signal all the time and remove the (small part of) samples you aren't interested in in postprocessing?

According to your description you want to measure for 100ms, but signal generation takes just 1ms…

 

I started with a state machine in the test vi (see attached) with counters (might not be necessary) to monitor when the program should move to the next state.

Right now you try to output a very short pulse ("for 1ms generate 25 pulses") writing each pulse seperately to your rather slow USB device. Why not reduce the overhead by generating that 1ms signal of 25 pulses in one waveform and output the waveform for the whole 1ms?

 

Btw. your VI doesn't fit to your description:

- in "main pulse" you generate a waveform of 1s duration while in your message you take about just 1ms…

- in "main pulse" you set a sample rate of 50kHz, but your USB6002 is only able to output analog values at 5kHz. Read it's manual!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(2,696 Views)

Hi GerdW,

 

The pulse is essentially two different signals. For the first 1ms, it is 25 pulses of a square wave of 5V amp @ 50% duty cycle. That signal then stops and then run the next signal which is 1 pulse of a square wave of 0.5V amp @ 50% duty cycle. I do not need to record the results during the 1ms signal so I thought it would just be better to split the waveform generation into two different signals and only have DAQmx.read in the measure pulse state (have yet to be added).

 

I understand that there is still a lot that I don't know about LabView programming, but intuitively... I think my logic should work! Please advise me if there is a better approach. I will admit, I am not too experience in determining the sampling information. If USB-6002 really does not have the capability to generate these pulses, then I might have to reconsider a different DAQ!

0 Kudos
Message 3 of 4
(2,664 Views)

Hi qtism,

 

I understand that there is still a lot that I don't know about LabView programming, but intuitively...

Your problem is not (completely) LabVIEW-related, it's rather DAQ-hardware related!

Read the manual of your device!

 

For the first 1ms, it is 25 pulses of a square wave of 5V amp @ 50% duty cycle.

Some simple math:

- To generate such a waveform you will need to provide 50 samples: 0V, 5V, … (25 times)

- To output 50 samples within 1ms you need a hardware capable of a sample rate of (atleast) 50kHz.

- Your USB-6002 is rated with 5kHz for AO: this is 10 times slower than what you need.

 

When you need help with selecting suitable DAQ hardware you should call your local NI sales rep! (You will find phone numbers on the NI website.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 4
(2,656 Views)