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.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

usb-6009 output 8-bit strobed word

Solved!
Go to solution

I need to generate an 8-bit word and a strobe pulse in Matlab through a usb-6009. How do I do that? Any help is appreciated!  

0 Kudos
Message 1 of 3
(2,919 Views)

Roland, 

 

Please make sure that you have the latest version of DAQmx installed.

DAQmx link

http://joule.ni.com/nidu/cds/view/p/id/2933/lang/en

 

Please test that the device functions properly using Measurement and Automation Explorer and the test panels. 

 

The usb-6009 is supported in the Data Acquisition Toolbox. 

 

It looks like they have quite a few demos available on their website to help with code development in MATLAB. There appears to be a few demos that involve signal generation.

http://www.mathworks.com/products/daq/demos.html

 

The MathWorks, Inc. MATLAB ® software

Kyle Hartley
Senior Embedded Software Engineer

0 Kudos
Message 2 of 3
(2,900 Views)
Solution
Accepted by topic author roland1

To answer my own question:

 

Connect wires to digital pins p0.0-0.7 (each represents one bit) and an additional one to p1.0 (the strobe bit).  

 

Matlab code: 

 

dio = digitalio('nidaq', 'Dev1');
addline(dio, 0:7, 0, 'Out');%8 lines on port 0

addline(dio, 0, 1, 'Out');%strobe on port 1

sendthisvalue=23;

binvec = [dec2binvec(sendthisvalue,8), 0];%the 8bit word plus the strobe bit first set to 0

putvalue(dio,binvec); 

binvec(9) = 1;%set strobe bit to 1

putvalue(dio,binvec);

 

Initially I used two separate 'putvalue' statements, one setting up the 8bit word and then another for the strobe bit, but the strobe was not received. What does seem to work is if I include both the 8bit word and the strobe bit value in each 'putvalue' statement, as in the code above. 






    

 

 

0 Kudos
Message 3 of 3
(2,892 Views)