File Exchange

image thumbnail

MATLAB Code Example- 24 bit Digital Output using NI USB-6501

version 1.1.0.1 (1.64 KB) by MathWorks Data Acquisition Toolbox Team
Controlling Digital Output from MATLAB

5 Downloads

Updated 01 Sep 2016

View Version History

View License

MATLAB supports digital input/output devices with the Data Acquisition Toolbox.
This MATLAB code example shows you how to set the output voltages of a data acquisition device capable of digital output.
This example was tested on National Instruments™ USB-6255 device. The example also applies to NI USB-6501 and other devices. This example assumes that the vendor board driver (NI-DAQmx ) is installed.

For a complete list of supported boards:
http://www.mathworks.com/products/daq/supportedio.html

Learn more about using the Data Acquistion Toolbox:
http://www.mathworks.com/products/daq

Cite As

MathWorks Data Acquisition Toolbox Team (2021). MATLAB Code Example- 24 bit Digital Output using NI USB-6501 (https://www.mathworks.com/matlabcentral/fileexchange/26319-matlab-code-example-24-bit-digital-output-using-ni-usb-6501), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)

aplha zeta

I Am Using NI-USB6501.

I am trying to get an output pulse of 100Hz and 5V form USB-6501.
The maximum I am getting is 10Hz.

I changed the output of a pin in a continuous for loop from 0 to 5v (without any delays) and the maximum freq I get is 10Hz.

I tried precise timming by using the timer function and I toggeled the output pin after every 0.001 sec and still the output was 10Hz. Even if I decrease the time period for the timer fcn still I dont get above 10.5Hz.

the code is:

dio=digitalio('nidaq', 'Dev1');
addline(dio, 0:23, 'out');

for i=0:500
putvalue(dio.Line(9:16), [1 1 1 1 1 1 1 0])
putvalue(dio.Line(9:16), [1 1 1 1 1 1 1 1])
end

and by using other method i.e timers

t = timer('TimerFcn',{@abctimer, dio}, 'Period', 0.001,'TasksToExecute', 500,'ExecutionMode', 'fixedRate');

and I toggle the pin in abctimer fcn.
its the same...doesn't go above 10Hz..
I tried both fixedrate and fixeddelay...but no change

MATLAB Release Compatibility
Created with R2009b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!