LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Square wave generation using NI USB-6008

Solved!
Go to solution

Hello,

             How to generate square wave using NI USB-6008 in LabVIEW.

 

Thanks,

Shini K N

0 Kudos
Message 1 of 7
(3,257 Views)

Hi sk,

 

just switch on and off a digital output!

Or output 2 voltage levels alternatingly on an AO pin…

 

For more help you should provide more information! Which frequencies we are talking about? Which voltage levels?

Best regards,
GerdW


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

Thanks for the reply.I have done for single output channel. How to proceed with multiple channels with frequencies and duty cycle?

Frequency range 100 to 500Hz

 

Thanks

0 Kudos
Message 3 of 7
(3,214 Views)
Solution
Accepted by sk29

Hi sk,

 

How to proceed with multiple channels with frequencies and duty cycle?

Then you need to generate those "multiple channels" at desired freq/duty and output them using DAQmx… (It's not a big deal to go from "1 channel" to "n channels"!)

 

Frequency range 100 to 500Hz

Here you are lost: get a better hardware suited to your requirements! Please read the user manual to learn about the specs/limits of the cheap USB6008 hardware…

With your USB6008 both AO and DO are just "software timed", so you are limited to <=100Hz output rate. As I said: it's cheap hardware…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 7
(3,210 Views)

Hi,

 

    I tried to solve this problem to output (AO) an array of a pulse (0 to 5 volts) of 200, 500, and 2000 msec at a frequency of 1 KHz and succeeded (feeding 200 samples for 200 msec, 500 samples for 500 msec, and 2000 samples for 2000 msec). The way I did it was to save a copy of the DAQMx vi (DAQmx Write (Analog 1D DBL 1Chan NSamp).vi) with an other name, set its execution propriety to "Critical (highest)" and make my program call this vi. I checked the result by acquiring the signal in another DAQ card and the timing was perfect. Maybe this is the case because the only change in the signal is at the beginning and at the end (transition going from 5 to 0 volt and vice-versa). Everything else seemed to work without problem.

0 Kudos
Message 5 of 7
(3,087 Views)

Hi exovede,

 

what's the point in outputting 2000 samples when you only need 2 of them?

(And why don't you use a DO for this purpose?)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 7
(3,074 Views)

Hi Gerd,

 

    It is a question of precise (sort of) timing of duration of activating a device (on/off) and I had only this card (USB-6008) on hand for it until I realized it couldn't do "standard" output buffering. Because some other tasks are running I didn't want to do a polled loop for that since the execution of the sub-vi which sends the command is asynchronous (timing between 2 calls IS different). So, once I send the command I don't have to deal with it furthermore. I know there's many ways to skin a cat but the solution I implemented for THIS project was the least invasive.  😉

0 Kudos
Message 7 of 7
(3,068 Views)