I'm using the data acquisition card from National Instruments
(PCI-6023) together with MatLab. For my intended purpose I have to
create a TTL Pulse with a accuracy in timing of about 1 micro second. A
precise time period after this pulse I want to start the data
acquisition.
As the timing must be precise I want to use the two hardware
counter/timer on the DAQ card. Sadly MatLab doesn't support the
adressing of the counter/timer directly, but it should be possible
using "generic dll calling" and that's the point where I'm in need of
help.
I tried to figure out how this generic dll calling works but couldn't
get it running. In the following I describe what (I think) I've done:
1. loading the nidaq32.dll together with the header files nidaq.h and
nidaqcns.h
MatLabcode> addpath(['C:\Programme\National Instruments\NI-DAQ\Include'])
MatLabcode> loadlibrary 'C:\WINDOWS\system32\nidaq32.dll' 'nidaq.h' addheader nidaqcns
2. Calling the function "CTR_Pulse" which should generate after 4s a pulse with a duration of 2 s
MatLabcode> deviceNumber= 1;
MatLabcode> ctr= 0;
MatLabcode> timebase=5;
MatLabcode> delay= 400;
MatLabcode> pulseWidth=200;
MatLabcode> calllib ('mynidaq', 'CTR_Pulse', deviceNumber, ctr, timebase, delay, pulseWidth)
After calling the function I just get back a number (-10403), but
cannot meassure any voltage change on the counter 0 out. The voltage
stays around 5 V.
As I don't get any error message it's hard to solve this problem.
Did I miss calling some important function or where is my problem? I'm glad for any help!
Thanks and best regards
Frank Muehlbaue