Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

DIO control (6602-2121) via matlab

Hello,
I would like to use matlab to trigger a TTL via the NI-6602 (and BNC 2121 accessory).
 
My code:
 
dio=digitalio('nidaq',2);
hwlines=addline(dio,0,'out');
data=1;
putvalue(dio,data);
start(dio);
getvalue(dio)
 
I'm having two problems:
1) The output does not look like a square wave on a scope.
2) I can't use the same line (zero in the above code) to send the output twice in a row. I have to keep switching it between line 0 and one for it to work consecutively.
 
Can anyone advise?
 
May thanks in advance,
Gene
 
0 Kudos
Message 1 of 2
(3,209 Views)
Hello Gene,
I'm not familiar with the Matlab syntax, but it looks like you are doing static digital output, and expecting to see a square wave.  With static digital, when you write one value to a digital line, it will stay at that value until you write a different value to it.  Beyond that, I'm afraid I can't help with with the syntax.....you might have to probe Matlab support for that.  I can tell you that this stuff is extremely easy with LabVIEW, and there are bunches of people on these forums that can help with LabVIEW programming.Smiley Wink
-Alan A.
 
0 Kudos
Message 2 of 2
(3,199 Views)