I'm running Matlab 2015b (32-bit) on Windows 7 (32-bit) using Data Acquisition Toolbox. I have a National Instruments USB-6501 Digital I/O Device, and a unipolar stepper motor that receives 2 bits, one for creating the square waves and one for direction.
Currently, my motor moves too slowly and I do not know how to shorten the period of my square waves. Using an oscilloscope, the measured period of my square waves is 18ms. I need to lower this to ~2.5ms to move at the speed I require. My code looks like this: (Note that this is an indefinite while loop–in my finalized code I have already figured out how to exit the loop by reading inputs)
d = daq.getDevices;
s = daq.createSession('ni');
addDigitalChannel(s,'Dev1','port0/line0:1','OutputOnly');
signal1 = [1 0];
signal2 = [0 0];
door_switch = 0;
while door_switch == 0
outputSingleScan(s,signal1);
outputSingleScan(s,signal2);
end
There are no issues with the motor as I have tested it with an ePrime program and it generates the required square waves and motor speed (although with a PCI digital I/O device). I'm unsure if this is a problem with my code, a limitation of the NI USB-6501, or if there is a maximum "speed" that a while loop can execute at. If you have any suggestions or ideas, I would greatly appreciate it. Thanks in advance.