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.
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.
05-12-2009 08:49 AM
I'm new to Labview and I can't figure out how to do this.
I want to continuous generate a square waveform 1kHz and then digital output it with Digital I/O functions (Traditional DAQ). I can generate the square wave but don't know how to digital output it. Can anyone help with this?? I'm using Labview 7.0.
05-13-2009 03:48 AM
Hi,
Thanks for posting on our forum.
Are you trying to do an "hardware timed" or a "software timed" digital output.
Hardware timed generation: uses an hardware clock on the board, with this method you will have a better speed and accuracy, but not all the board are able to do that. For example, you won't be able to do that with an E-Serie Board.
Software timed generation: you are using a software loop. The accuracy and the speed are not as good as with the hardware timed generation.
I attach an example VI for a software timed DO.
You will find other examples here:
C:\Program Files\National Instruments\LabVIEW 8.6\examples\daq\digital
Best regards,
05-13-2009 04:01 PM
Thanks for the help Thomas B.
I'm using PCI-6024E Board. I have tested your example and in the output (line0) the signal isn't at 1kHz. The frequency is very important to me, how can I force the frequency in the signal??
I have made a small change in your example.
05-14-2009 01:40 AM - last edited on 02-19-2024 03:29 PM by migration-bot
Hi,
First of all, if you want, you can speak french.
PCI-6024e cannot do hardware timed Digital Output.
(see attached picture)
You will only be able to do a software timed generation.It means that you will have a while (or for) loop, and at each iteration of the loop, you will update the state of your digital output.
The VI "Write to digital port.vi" allows you to set the state of a port.
For example, if the width of the port is 8 bits, and the data ("pattern" input of this VI) is 255, all the output will be at "True" (255 in decimal = 11111111 in binary).
Please find attached a slightly modified version of my VI. It toggles (=revert state) a port at a desired frequency.
At an iteration of the loop, the port is at 255, so all the lines are at true, at the next iteration of the loop, the port is at 0, so all the lines are at false.
However, the while loop will not be able to run as fast as we want and the loop duration might change slightly as the processor is used by other programs (Internet explorer, anti-virus...) on the computer. The duration of one iteration of the loop might be a few millisecond less or more than the desired value.
So if you want to generate a square wave that is precisely at 1KHz, you will have to use another board (for example this one: https://www.ni.com/en-us/support/model.pci-6220.html , if you look at the specifications for the Digital I/O, you will see that the DIO can be hardware clocked ).
Best regards,
05-19-2009 07:59 PM
Thanks again!
I'm don't speak French. LoL
Would this be possible to do with DAQmx functions?
05-19-2009 11:34 PM
It does not matter what driver you use. The limitation is the hardware as already mentioned.
Your board does have a counter/timer and you can use that to generate a square wave.
05-20-2009 07:18 PM
05-20-2009 10:05 PM