12-11-2007 04:53 AM
12-11-2007 08:39 AM
12-11-2007 09:33 AM
Hey,
Thanks for the reply. I'm still trying to grasp how to use the functions and communicate to the card, but I've made a note of the pointers you've given so I can use it when I'm more proficient in using it. In the mean time I was having a play with MATLAB and the card but I keep getting a negative return value when trying to initiate the generation session. And I can't seem to input a device name as a parameter for that function (niHSDIO_InitGeneratioSession). I think it might be something to do with the visession as well? I've had a look into the include files and found variables like VI_NULL, VISESSION vi, but can't figure out how to use it. Do you have any idea about visession and the device id?
Thanks a heap again!
12-11-2007 10:36 AM
To understand the programming flow for the HSDIO driver, I'd recommend utilizing the Programming section of the NI Digital Waveform Generator/Analyzer Help, located in the Start menu:
Start >> Programs >> National Instruments >> NI-HSDIO >> Documentation
niHSDIO_InitGeneratioSession takes a Device Name as an input parameter and ouputs a VISESSION. This VISESSION is then used by the other driver functions. The device name can be found in the NI Measurement and Automation Explorer (MAX) tool found on your desktop. Device Names are typically of the form Dev1.
It may be helpful for you to look at some examples that ship with the HSDIO driver. While we do not ship Matlab examples, there are C example that may be helpful for you to understand how to program the device:
C:\Program Files\IVI\Drivers\niHSDIO\Examples\c\
Hope this helps.
12-11-2007 11:25 AM
12-11-2007 01:24 PM
12-12-2007 08:49 AM - edited 12-12-2007 08:51 AM
12-12-2007 09:17 AM
The NI-HSDIO driver is actually an IVI-C driver, not IVI-COM. It seems that your issue is with sending string arguments to the DLL within MATLAB. Perhaps, The Mathworks can assist you with this as I don't have much experience with that.
12-14-2007 05:02 AM
12-14-2007 07:34 AM
name =
'a';name2 =
'';name4 =
'';b = [10101010,01010101'];
name5 =
'myWmf';name6= 100;
clock = libpointer(
'int8Ptr',int8(51));sampleClockRate =(double(10));
pname = libpointer(
'int8Ptr',int8(name));pname2 = libpointer(
'int8Ptr',int8(name2));pname3 = libpointer(
'uint32Ptr',0);pname4 = libpointer(
'int8Ptr',int8(name4)); p = libpointer('int8Ptr',int8('t'));waveformdata = libpointer(
'uint32Ptr',uint32(''));[errgen pname pname2 pname3] = calllib(
'niHSDIO','niHSDIO_InitGenerationSession',pname,1,1,pname2,pname3)[errass pname4] = calllib(
'niHSDIO','niHSDIO_AssignDynamicChannels',pname3,pname4)[errcon clock] = calllib(
'niHSDIO','niHSDIO_ConfigureSampleClock',uint32(pname3),clock,sampleClockRate)errmode = calllib(
'niHSDIO','niHSDIO_ConfigureGenerationMode',uint32(pname3),14)calllib('niHSDIO','niHSDIO_WriteNamedWaveformU32',pname3,p,32,waveformdata)
errint = calllib('niHSDIO','niHSDIO_Initiate',pname3)
And the output throws an error for write and initiate:
ans =
-1.0741e+009
errint =
-1.0741e+009
im running out of ideas on what could be wrong.
Any suggestions?