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.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate 1KHz Sin Wave ditigal values using USB 6501?

Hello,
 
We are trying to use USB 6501 as a digital function generator. In LabView,
I use vi "Basic Function Generator" to generate a sin wave(freq: 1Hz-1Khz)
and use vi "WDT Get Y value" to get the Y value of the sin wave as the voltage
output(digital values) for USB 6501. Then USB 6501 will output the digital
values to our own electrical optical board which will create the actual
voltage.

The problem is that the actual created output voltage signal frequency is
very low(can only reach about 2Hz) and does not match the input signal.(0-1K)
I don't know it is because of the 6501 speed limit or my programming.
 
Note:In ADOut subvi, I send converted digital signals to USB 6501.

Thank you very much!
 
Attached is my whole Vi.

0 Kudos
Message 1 of 4
(3,662 Views)
Bill,
 
The USB-6501 has static digital I/O lines, which means you cannot output clocked data. All digital I/O is software-timed, so the speed of the digital input/output is system-dependent/non-deterministic. Examples "Write Dig Chan.vi" and "Write Dig Port.vi" show how to output data with the 6501.
 
That being said, there are many ways to optimize your application to run more quickly. On page four of the LabVIEW Bookshelf PDF (Help>>Search the LabVIEW Bookshelf...) there is a link to the application note "LabVIEW Performance and Memory Management". This gives several ways you can improve LabVIEW code.
 
One thing I would recommend is to do the DAQmx Create Channel and the DAQmx Start Task only once, then do multiple DAQmx Writes, then one DAQmx Clear. This will only reserve the resource once, which is a big time saver.
 
--
Michael P
National Instruments
0 Kudos
Message 2 of 4
(3,653 Views)
Hello,

I too am seeing low output rate on the 6501 using NIDAQmxBase.
I started with writeDigPort.c and only saw about 10Hz output so I
thought after StartTask I could do multiple writes via the loop below.
I now get the error
DAQmxBase Error -200170: Physical channel specified does not exist on this device.

Refer to the documentation for channels available on this device.

So I guess it is looking for 256 channels which of course I don't have.
What is the correct way of doing multiple writes within one task(is this possible?)
Thanks much,

Doug Taylor

   // Create Digital Output (DO) Task and Channel
   DAQmxErrChk (DAQmxBaseCreateTask ("", &taskHandle));
   DAQmxErrChk (DAQmxBaseCreateDOChan(taskHandle,chan,"",DAQmx_Val_ChanForAllLines));
   handle = taskHandle;
  
   // Start Task (configure port)
   DAQmxErrChk (DAQmxBaseStartTask (taskHandle));

   //  Write 0x55 to port(s)
   //  Only 1 sample per channel supported for static DIO
   //  Autostart ON

   for(i=0;i<255;i++) w_data[i] = i;
   w_data[255] = (uInt8)input1;

   //printf("Data to write: 0x%X\n", w_data[0]);
   //getchar();

    for(i=0;i<256;i++) {
        wr_data[0] = w_data[i];
        DAQmxErrChk (DAQmxBaseWriteDigitalU8(taskHandle,1,1,10.0,DAQmx_Val_GroupByChannel,wr_data,&written,NULL));
    }

0 Kudos
Message 3 of 4
(3,513 Views)
It's both. In your USBDOUT VI, you have 100 msec delays in each and you call the VI 4 times. In each one, you also create the channel, start the task, the stop the task. This also takes quite a bit of time. The way you're getting the Y value doesn't seem efficinet at all. It would be simpler to just take the entire Y array and convert all at once instead calling WDT Get Y Value. Then there's the limitation of the the USB6501. It is software timed. That means that the digital I/I update is dependent on the program speed and you have no way of precisely controlling that to any degree of accuracy on a Windows platform. You need much better hardware and better software techniques to reliably output a digital pattern at a specific frequency.
0 Kudos
Message 4 of 4
(3,508 Views)