5.0

5.0 | 1 rating Rate this file 12 Downloads (last 30 days) File Size: 1.64 KB File ID: #26319
image thumbnail

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

by Data Acquisition Team

 

08 Jan 2010 (Updated 08 Jan 2010)

Controlling Digital Output from MATLAB

| Watch this File

File Information
Description

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

Required Products Data Acquisition Toolbox
MATLAB release MATLAB 7.9 (2009b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
27 Jul 2010 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

Please login to add a comment or rating.
Updates
08 Jan 2010

Updated description.

Tag Activity for this File
Tag Applied By Date/Time
code example Data Acquisition Team 08 Jan 2010 10:21:28
digital ouput Data Acquisition Team 08 Jan 2010 10:21:28
ni usb6501 Data Acquisition Team 08 Jan 2010 10:21:28
ni usb6255 Data Acquisition Team 08 Jan 2010 10:21:28
usb6255 The Instrument Control Team 01 Feb 2010 10:24:36
ni usb6501 aplha zeta 27 Jul 2010 15:51:30

Contact us at files@mathworks.com