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.

Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

MyDAQ - Generating a digital signal and displaying it on an analog waveform graph

Solved!
Go to solution

Hi,

I am using the NI MyDAQ to generate a digital waveform with an adjustable frequnecy. This is being implemented into a program I have already written which generates a TTL "like" pulse out of the sound card. I am displaying the output on an analog waveform graph, and I'd like to be able to display the digital waveform generated by the myDAQ on the same graph. (Not at the same time, either one or the other, toggled by a button). I've been messing with arrays and conversions but I cant seem to really get anywhere with it all.

 

This is the vi I have made to generate the adjustable frequency digital signal with MyDAQ. Any suggestions on the proper way to do this if the following is wrong would be great too as I just got the MyDAQ a few days ago. I would think there must be a better way but this is the best I could come up with so far.

dig waveform.PNG

 

 

0 Kudos
Message 1 of 2
(8,142 Views)
Solution
Accepted by topic author JonnyRandall

Hi Jonny,

 

The general logic you are using to create a digital pulse train is fine. This VI you've written should work and will create the pulse train based on software timing (which is fine because you don't have hardware-timed DIO on the myDAQ anyway). However, it is usually good practice to start the DAQmx task just before your while loop and then clear the task after the while loop when you press stop.

 

For reference, there are some pretty good LV examples that I recommend looking at for this application too. If you are just trying to create a digital pulse train, the example Gen Dig Pulse Train-Continuous.vi is a good example that uses a counter to create a digital pulse train of your desired frequency. This is generally the prefered method to create a pulse train if you have the hardware available to do so (the myDAQ does have a counter). Alternatively, there are some DIO examples that continuously write to a digital line/port.

 

If you're not familiar, you can find the examples by going to Help >> Find Examples... in LV. Then, navigate to Hardware Input and Output >> DAQmx >> Generating Digital Pulses or Digital Generation.

 

Also, here is some additional information about the myDAQ and its counters:

 

myDAQ Counters 

myDAQ Manual 

 

Hopefully this helps.

 

Chris G

Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(8,128 Views)