High-Speed Digitizers

cancel
Showing results for 
Search instead for 
Did you mean: 

Using external trigger to start acquisition by NI USB 5133 digizer using Matlab

I  am a novice in programming NI USB 5133.

Aim is to acqurie the desired number of sample using desire sample rate when an external trigger is supplied to the Digitizer.

I am trying to externally trigger using a function generator on CH1 which will start acquisition through CH0 of 5133 using Matlab. The trigger configuration that i want to setup is the rising edge of about 3.3V which i am not able to configure but was able to control the sample rate and number of sample to acquire using the 'read' function without the trigger.

I understand that i have to use 'initiate acquistion' to start the acquisition and then use 'fetch' to start acquire the data but couldn't able to program it using Matlab with the desired configuration.

 

I have a vague idea of what commands to use to configure the trigger such as configure trigger edge and cofigure trigger histeresis but haven't abel to figure out the arguments to pass to it like for the positive slope- is it 1, 'POSITIVE' or something else. It would be help if i get the exact arguments representing the desired configuration and hope to get idea on acquring signal using external trigger

 

0 Kudos
Message 1 of 4
(6,714 Views)

Hi jay_kand,

 

How are you communicating to the device through Matlab? Are you using some toolbox or are you using a DLL to call into the driver? Or are you using IVI calls?

 

Thanks!

Chris T.
0 Kudos
Message 2 of 4
(6,704 Views)

Hello Chris,

 

 

 

well here is how i connect to driver

 

%% Convert native driver to MATLAB format

 

Name_of_Driver = makemid(Name_of_Driver);

 

 

 

%% Create Device Object

 

'niscope';%Convert driver to MATLAB instrument driver format

MATLAB_instrument_driver = 'niscope.mdd';

 

 

VISA_ResourceName = 'DAQ::Dev2';

 

niScopeObj = icdevice(MATLAB_instrument_driver, VISA_ResourceName);

 

 

well i connect to the niscope later.

 

 

0 Kudos
Message 3 of 4
(6,694 Views)

Hi jay_kand,

 

Unfortunately, I am not entirely familiar with the specific functions that Matlab uses to communicate with niScope, but I would assume they would be pretty similar to the C API function calls and attributes. There is a reference guide for each function and the required attributes in the help manual for High-Speed Digitizers. Specifically, the help gives the following information for niScope_ConfigureTriggerEdge (NI High-Speed Digitizers Help » Programming » Reference » NI-SCOPE Function Reference Help » Functions » Configuration Functions » Trigger):

 

niScope_ConfigureTriggerEdge

C Function Prototype

ViStatus niScope_ConfigureTriggerEdge (ViSession vi, ViConstString triggerSource, ViReal64 level, ViInt32 slope, ViInt32 triggerCoupling, ViReal64 holdoff, ViReal64 delay);

Parameters

Input
Name Type Description
vi ViSession The instrument handle you obtain from niScope_init that identifies a particular instrument session.
triggerSource ViConstString Specifies the trigger source. Refer to NISCOPE_ATTR_TRIGGER_SOURCE for defined values.
level ViReal64 The voltage threshold for the trigger. Refer to NISCOPE_ATTR_TRIGGER_LEVEL for more information.
slope ViInt32 Specifies whether you want a rising edge or a falling edge to trigger the digitizer. Refer to NISCOPE_ATTR_TRIGGER_SLOPE for more information.
triggerCoupling ViInt32 Applies coupling and filtering options to the trigger signal. Refer to NISCOPE_ATTR_TRIGGER_COUPLING for more information.
holdoff ViReal64 The length of time the digitizer waits after detecting a trigger before enabling NI-SCOPE to detect another trigger. Refer to NISCOPE_ATTR_TRIGGER_HOLDOFF for more information.
delay ViReal64

How long the digitizer waits after receiving the trigger to start acquiring data. Refer to NISCOPE_ATTR_TRIGGER_DELAY_TIME for more information.

 

 

As you can see, there are links to each specific attribute with specific information. For example, NISCOPE_ATTR_TRIGGER_SLOPE gives the following information:

 

NISCOPE_ATTR_TRIGGER_SLOPE

Specific Attribute

Data
type
Access Applies to Coercion High Level Functions
ViInt32 R/W N/A None niScope_ConfigureTriggerDigital
niScope_ConfigureTriggerEdge
niScope_ConfigureTriggerHysteresis

Description

Specifies whether rising or a falling edge triggers the digitizer. This attribute affects instrument operation only when NISCOPE_ATTR_TRIGGER_TYPE is set to NISCOPE_VAL_EDGE, NISCOPE_VAL_HYSTERESIS, or NISCOPE_VAL_WINDOW.

Defined Values

NISCOPE_VAL_POSITIVE

NISCOPE_VAL_NEGATIVE 

 

 

In general, each of the different attributes has specific information in the function reference help that I mentioned above (NI High-Speed Digitizers Help » Programming » Reference » NI-SCOPE Function Reference Help » Attributes). Hope this helps!

 

Daniel S.
National Instruments
0 Kudos
Message 4 of 4
(6,679 Views)