LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generating square wave using NI USB6211

Hi, 

 

I need to generate a simple square wave of a user defined frequency using NI USB6211 and labview for one of the requirements in my project. I tried simulating a square wave , and then generated a DAQmx block for Digital output signal and then gave the output of the simulated square wave to the DAQ assistant block. I wasnt able to connect them directly due to type mismatch, so i connected a conversion block in between to conver the dynamic data ( output of the simulated square wave) to T/F boolena format which was accepted by the DAQ assistant/. Attached is a picture of the same.However, I tried probing the output at the digital output port on the NI USB6211 and i see a square wave of completely different frequency i.e. 2Hz when i set it to 20Hz. I changed from square wave to sine wave and i still see a sine wave. Also, the frequency keeps on changing a bit. I can notice it on oscilloscope quite easily. Can you please help if i am doing something wrong here? Also, in the square wave simulator block, it kept on giving me errors ( mismatch in type of the source and sink data)  until i set the "number of samples" to 1. 

 

Appreciate any help on this one. 

 

Please note that i need to use the digital outputs only, since the analog outputs available are already occupied. 

Download All
0 Kudos
Message 1 of 2
(3,917 Views)

Hi

 

Do you have an available counter? I would recommend using a counter output task to generate the square wave pulse. To be able to change the frequency easily etc, you would be better off using the low level labview functions rather than the DAQ assistant. There are plenty of example programs, if you navigate to Help>>Find Examples. In the example finder, navigate to Hardware Input and Output>>DAQmx>>Counter Output, you may find that you don't have to change the code much to do what you are trying to do.

 

I'd think the reason it isn't working at the moment, is that the simulate signal VI is producing a wave as fast as it can, and outputs an array of data, but this data does not specify the speed at which the hardware will actually output it. The DAQ assistant should have a field to specify the write rate.

 

Ian S
Applications Engineer CLA
National Instruments UK&Ireland
0 Kudos
Message 2 of 2
(3,901 Views)