01-03-2008 11:06 AM
loadlibrary (dllfile, hfile);
%define variables
name =
'a';channel = [0,1,0,1];
name2 =
'';name4 =
'';name5 =
'my';name6= int8(
'NIHSDIO_VAL_PFI2_STR');name7= int8(
'NIHSDIO_VAL_SCRIPT_TRIGGER2');triggerID = libpointer(
'int8Ptr',name7);rise = int8(12);
source = libpointer(
'int8Ptr',name6);Datastr = [1:10;1:10];
clock = libpointer(
'int8Ptr',int8(''));wait =(double(10.0e12));
sampleClockRate =(double(30.0e6));
pname = libpointer(
'int8Ptr',int8(name));pname2 = libpointer(
'int8Ptr',int8(name2));pname3 = libpointer(
'uint32Ptr',0);pname4 = libpointer(
'int8Ptr',int8(name4));pname5 = libpointer(
'int32Ptr',0);pname6 = libpointer(
'int8Ptr',0);waveformname = libpointer(
'int8Ptr',int8(name5));waveformdata = libpointer(
'uint32Ptr',uint32(channel));pname7 = libpointer(
'int8Ptr',int8('script myScript Repeat 1 Generate my end Repeat end script'));%initiate generation
[errint pname pname2 pname3] = calllib(
'niHSDIO','niHSDIO_InitGenerationSession',pname,0,0,pname2,pname3);%assign channels
[errchn pname4] = calllib(
'niHSDIO','niHSDIO_AssignDynamicChannels',uint32(pname3),pname4);%configure clock rate
[errclk clock] = calllib(
'niHSDIO','niHSDIO_ConfigureSampleClock',uint32(pname3),clock,sampleClockRate)%use named waveform
calllib(
'niHSDIO','niHSDIO_ConfigureGenerationMode',uint32(pname3),15)%External trigger
calllib(
'niHSDIO','niHSDIO_ConfigureDigitalEdgeScriptTrigger',uint32(pname3),triggerID,source,rise)%write waveform to device
calllib(
'niHSDIO','niHSDIO_WriteNamedWaveformU32',uint32(pname3),libpointer('int8Ptr',int8(name5)),10,libpointer('uint32Ptr',uint32(channel)))%Write script to device
calllib(
'niHSDIO','niHSDIO_WriteScript',uint32(pname3),pname7)%generate waveform
calllib(
'niHSDIO','niHSDIO_Initiate',uint32(pname3))so now it only fails at script trigger function. the script trigger fails with the error code -1074135008.
01-03-2008 11:22 AM
01-03-2008 11:24 AM
Hi,
ok - so I was writing that last reply as you submitted yours.
Bear with me!!!
Sacha Emery
National Instruments (UK)
ATE Systems Engineer
01-03-2008 11:36 AM
name6= int8(
'"PFI2"');source = libpointer('int8Ptr',name6);
that its failing on. Will have to double check with the measurement explorer
Thanks
01-03-2008 11:44 AM - edited 01-03-2008 11:46 AM
Hi,
OK - it looks fairly cool - I think what you need to do however is stop using the header defines as your string constants though.
i.e.
name6= int8('NIHSDIO_VAL_PFI2_STR');
so name6 is pointed to by source (as in source = libpointer('int8Ptr',name6);)
and then source is used at
calllib('niHSDIO','niHSDIO_ConfigureDigitalEdgeScriptTrigger',uint32(pname3),triggerID,source,rise)
whereas I believe that name6 should be
name6 = int8('PFI2');
and similarly for name 7
name7= int8('NIHSDIO_VAL_SCRIPT_TRIGGER2');
triggerID = libpointer('int8Ptr',name7);
so I believe name7 should be
name7 = int8('ScriptTrigger2');
Can you make the suggested changes to name6 and name7 and try the sript again?
Thanks
Sacha Emery
National Instruments (UK)
ATE Systems Engineer
01-03-2008 11:45 AM
Hi,
and again my reply comes just after your update!!!
Sacha Emery
National Instruments (UK)
ATE Systems Engineer
01-03-2008 12:06 PM
triggerID = libpointer(
'int8Ptr',int8('/a/do/ScriptTrigger0'));source = libpointer(
'int8Ptr',int8('/a/PFI2'));which has lead to another error code
-1074118654, which says something about repeated capability syntax is invalid, do you know what it could imply?
01-04-2008 04:50 AM
Hi
You have used the repeat syntax here:
pname7 = libpointer('int8Ptr',int8('script myScript Repeat 1 Generate my end Repeat end script'));
Try replacing this with:
pname7 = libpointer('int8Ptr',int8('script myScript Generate my end script'));
'Repeat 1' only performs 'Generate my' once, so you don't need the repeat syntax.
Thanks
Beejal
01-04-2008 05:44 AM
Hi Beejal,
The repeated capability error occurs when I try to configure the script trigger, but I changed the script anyway to work without the repeat instruction:
triggerID = libpointer('int8Ptr',int8('scriptTrigger0'));source = libpointer(
'int8Ptr',int8('PFI2'));pname7 = libpointer('int8Ptr',int8('script myScript Generate my end script'));
%External trigger
calllib(
'niHSDIO','niHSDIO_ConfigureDigitalEdgeScriptTrigger',uint32(pname3),triggerID,source,rise)And it is still throwing the error code -1074107489
I've tried the same script but leaving the source blank, i.e. :
source = libpointer(
'int8Ptr',int8(''));and all works fine, so I'm assuming it's something to do with the source name. I've tried the following arguments for the source:
source = libpointer(
'int8Ptr',int8('"PFI2"'));source = libpointer(
'int8Ptr',int8('NIHSDIO_VAL_PFI2_STR'));source = libpointer('int8Ptr',int8('/a/PFI2'));
source = libpointer('int8Ptr',int8('/a/NIHSDIO_VAL_PFI2_STR'));
And the error codes I've got are as follows:
-1074118654
-1074107489
-1074135008
-1074118641
-1074115608
And they all have a similar error description.
So I think I there is some problem with selecting the trigger source.
I've used measurement and automation explorer to get the device routes, i.e. '/a/PFI2'. I'm downloading the latest version for this board to see if that makes a difference. Also in the measurement explorer, when you right click the device, the option to see the device pinouts is not highlighted, is that normal?
Thanks!
01-04-2008 02:03 PM