Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

PXI 6541 MATLAB

You need to get the information associated with the error code.  This will help you debug the cause of the problem.  Try sending the error code to the GetError function, and look at the returned error message string.
0 Kudos
Message 11 of 30
(2,484 Views)
I've tried GetError which didn't give me a string but:
errget =
   158

error =
 -1074115999

rtn =
   68
 
and the error code : -1.0741e+009 is what I've got all the time there has been a problem with the code.
0 Kudos
Message 12 of 30
(2,483 Views)
From the header file:
ViStatus _VI_FUNC niHSDIO_GetError (
   ViSession vi,
   ViStatus* errorCode,
   ViInt32 errorDescriptionBufferSize,
   ViChar errorDescription[]);
 
You need to be able to return the errorDescription[] string.  I was able to send your error code -1074115999 to the niHSDIO_error_message function and get the following information:
DAQmx Error -200414 occurred:
Measurements: Requested sample clock source is invalid.
 
You will need to be able to access the error description strings to help you debug issues.  Hope this helps.
0 Kudos
Message 13 of 30
(2,472 Views)

Hi,

I've tried varying the sample clock rate which has made no difference, however I've used the same sample clock rate when doing a static generation and have no problems with it there. Also the c examples given use the same clock rate as I've used and it runs fine. Would you be able to tell me what arguments I have to pass and how I get them for the error message function and get error function? As it still won't give me a description. I got another error code -1074118626 when i changed some of the fields. If you could also tell me what arguments and format to pass the writenamedwaveform function. I've looked in the help menu, but it doesn't give much description on the parameters of errormessage. An error occurs at the writenamedwaveform function call not at the configure sample clock, so I don't understand why it would be a problem with the clock rate.

Thanks

0 Kudos
Message 14 of 30
(2,450 Views)

Oh another question, if i wanted to use the get function, niHSDIO_GetAttributeViReal64, one of the arguments is attribute ID, what is it or where would I get this from? and would i be able to get what the onboardclock is from this function? Cause I suspect that if it is the clock source that is the issue, maybe MATLAB is not picking up "OnBoardClock" from the header file when i pass it as an argument to configure the sample clock. and regarding the point I made about the clock configuration working with the static and not dynamic, I don't think static generation would use the clock, maybe that's why it isn't causing problems there?

0 Kudos
Message 15 of 30
(2,431 Views)
Attribute IDs are specified in niHSDIO.h.  You should be able to use NIHSDIO_ATTR_SAMPLE_CLOCK_SOURCE as the input argument to niHSDIO_GetAttributeViReal64.  If instead you need the value associated with this, from the header file it is IVI_SPECIFIC_PUBLIC_ATTR_BASE (defined in ivi.h) + 13L.
 
You may need to use the formal enum value names (NIHSDIO_VAL_ON_BOARD_CLOCK_STR) rather than the short names.  This mapping can be found in the header file.
 
Also, I looked up the the error using Error Message that you reported in the previous post.  It indates that you were attempting something from a generation session that is only allowed for acquisition (or vice versa).
0 Kudos
Message 16 of 30
(2,417 Views)
Hi Jason,
I've been looking into the clock configuration as you suggested, and found that matlab isn't picking up the define constants from the niHSDIO header file, therefore it's configuring it incorrectly, and hence can't be used for the dynamic generation. so I've left the argument blank so it defaults to the onboard clock. Not sure though if the lack of communication between matlab and the header files would be a problem at a later stage, do you have any experience in how I can get matlab to grab the define constants from the header files?
I've succesfully got the card to generate dynamically through a named waveform, and a script. Working on external triggering now. Will contact again if I get stuck again.
Thanks and Merry Christmas!
 
 
0 Kudos
Message 17 of 30
(2,394 Views)

Quick question, the niHSDIO_ConfigureDigitalEdgeStartTrigger function's source argument is what by default?

Thanks

 

0 Kudos
Message 18 of 30
(2,338 Views)

The driver defaults to no trigger by default.  You have to supply this value in the function call.  Valid values can be found in the NI Digital Waveform Generator/Analyzer Help file.  One option is to use PFI0: NIHSDIO_VAL_PFI0_STR.

0 Kudos
Message 19 of 30
(2,320 Views)
I was hoping that the board would default to PFI0 as there seems to be a problem with matlab and the define constants in the header niHSDIO.h file.

name6= int8(

'"/a/PFI0"');

name7= int8(

'"ScriptTrigger0"');

triggerID = libpointer(

'int8Ptr',name7);

source = libpointer(

'int8Ptr',name6);

pname3 = libpointer(

'uint32Ptr',0);

calllib(

'niHSDIO','niHSDIO_ConfigureDigitalEdgeScriptTrigger',uint32(pname3),triggerID,source,12)

Thats what I've done, but it still throws an error, ive even tried :

name6= int8('"PFI0"');

and I've tried them without the double quotes.

Any other suggestions on how I could get the trigger to work?

ans =

 -1.0741e+009

Thats the error that comes from the trigger function, however I can't get error message cause for some reason matlab doesn't like the geterror function so it crashes when i use it.

Thanks Jason

0 Kudos
Message 20 of 30
(2,310 Views)