Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Ni-DAQ digital output with matlab

120 views
Skip to first unread message

Jeremy

unread,
Apr 18, 2009, 4:24:01 PM4/18/09
to
Hello all :) I have a National Instruments NI-DAQ USB 6008. I have the data acquisition toolbox, and I've used this device to capture and analyze analog inputs. Now, I would like to use it for digital outputs. In the simplest terms, I'm just writing a function that will set one of its digital outputs to high or low. Can somebody please explain to me the functions/code that I need to accomplish this? I'm having trouble finding the information.

Thanks!
Jeremy

Gus Lott

unread,
Apr 19, 2009, 8:47:52 AM4/19/09
to
You want the following functions:

digitalio
addline
putvalue

The example from the putvalue help file is:
dio = digitalio('nidaq', 'Dev1');
hline = addline(dio, 0:3, 'out');
putvalue(dio, 8)
putvalue(dio, [0 0 0 0])
putvalue(dio.Line(1:4), [0 1 0 1])

In your case, you'd just add one line instead of 4.

Jeremy

unread,
Apr 19, 2009, 1:53:01 PM4/19/09
to
Thanks! That helps.

I'm also trying to use getvalue to determine the current state. It returns the correct value when I run it in the matlab command line, but not when used in an m file. Any idea why this would be happening?


"Gus Lott" <lottg....@janelia.hhmi.org> wrote in message <gsf6ho$d9n$1...@fred.mathworks.com>...

0 new messages