Jump to content
  • 0

USB1808X - Pattern match trigger


krbvroc1

Question

I am unsure if what I am trying to do will work, though I feel that it should...

- I setup digital port to OUT direction and set value 0 - I am going to use use both DIO0 and DIO1

- I use set_trigger() with a pattern match of ABOVE 0 and MASK 3 so that the AIN is triggered when digital output DIO0 or DIO1 is HIGH. NOTE: I am using the DIO0 as an output.

- I setup background a_in_scan with EXTRIGGER option to capture 20000 data points.

- At this point I am ASSUMING a_in_scan() is waiting in the background for the pattern match on DIO0 / DIO1 values. I ASSUME the pulse I generate writes a high value to the port which triggers AIN.

- I perform d_out_scan() to generate a pulse waveform on DIO0 (verified on a scope as 50ms)

It seems the a_in_scan never triggers because when I call get_status(), its status is stuck as RUNNING.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hello,

For the digital pattern trigger to work, the program must be actively scanning the digital port. To read both analog and digital at the same time use the daq_in_scan function. When properly configured, it can simultaneously read analog + digital + counter. Take a look a the example daq_in_usb_1800.py.

To use pattern triggering add EXTTRIGGER to the daq_in_scan options (for example CONTINUOUS|BACKGROUND|EXTTRIGGER) and use set_trigger function to configure the pattern. The low threshold parameter is the digital pattern and the high threshold is the mask. For example set_trigger(board_num, TRIG_PATTERN_ABOVE, 3, 15)

Best regards,

John

Link to comment
Share on other sites

  • 0
55 minutes ago, JRys said:

For the digital pattern trigger to work, the program must be actively scanning the digital port. To read both analog and digital at the same time use the daq_in_scan function. When properly configured, it can simultaneously read analog + digital + counter. Take a look a the example daq_in_usb_1800.py.

To use pattern triggering add EXTTRIGGER to the daq_in_scan options (for example CONTINUOUS|BACKGROUND|EXTTRIGGER) and use set_trigger function to configure the pattern. The low threshold parameter is the digital pattern and the high threshold is the mask. For example set_trigger(board_num, TRIG_PATTERN_ABOVE, 3, 15)

 

 

Maybe I was not clear in my description. I am not trying to use daq_in_scan or to read analog and digital at the same time.

I am trying to use a_in_scan() with EXTTRIGGER. I wanted to trigger the ADC to start sampling based on me WRITING to the DIO OUTPUTS using d_out_scan(). I have a feeling this is a limitation or bug in the firmware. The documentation states that EXTTRIGGER digital pattern matching should work when a specific pattern is present on the DIO port. It does not state that pattern needs to be as result of input. I am creating that required pattern on the port as an OUTPUT.

I did work around this issue by adding an additional loopback wire from a DIO output to the ITRIG since pattern matching is not working. I tried to go the pattern matching route since the datasheet claims lower latency for that.

Link to comment
Share on other sites

  • 0

Hello,

It works the way you've described, but not with a_in_scan, but with daq_in_scan function. The state of the digital port must be read along with the analog data for the trigger mechanism to work. The same hold true for analog triggering, if you want channel 1 to be the trigger channel it must be in the scan list. With daq_in_scan, a loop-back wire from a DIO to the external trigger pin is unnecessary. When the output from d_out_scan reaches the target value, daq_in_scan function will begin to dump data to the acquisition buffer. If for some reason you need to stick with a_in_scan, then the workaround is a wire from a DIO to the external trigger must be used with an explicit write to set the DIO.

Best regards,
John

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...