set up a pulse width trigger

Post discussions on applications you are writing
Post Reply
francisco.dutra
Newbie
Posts: 0
Joined: Fri Mar 10, 2023 1:06 pm

set up a pulse width trigger

Post by francisco.dutra »

I am writing a python code that will record data that will go to channel A. The signal in A is either high or low (0 or 1).
I just want the data when the signal is high so I think pulse width trigger with rapid block mode will do the job, because I do not know the time that is going to be high and I need to capture multiple signals. I am not sure about this so I am open to other suggestions. The high state of the signal in A will have a duration no more than 5s and it will repeat for 5-10 times.

Here is the trigger code

Code: Select all

triggerConditions = ps.PS5000A_CONDITION(ps.PS5000A_CHANNEL["PS5000A_CHANNEL_A"],
                                                           ps.PS5000A_TRIGGER_STATE["PS5000A_CONDITION_TRUE"])

clear = 1
add = 2
                                                                    
self._status["setTriggerChannelConditions"] = ps.ps5000aSetPulseWidthQualifierConditions(self._chandle, ctypes.byref(triggerConditions), 1, (clear + add))
assert_pico_ok(self._status["setTriggerChannelConditions"])

triggerDirections = ps.PS5000A_DIRECTION(ps.PS5000A_CHANNEL["PS5000A_CHANNEL_A"], 
                                                    ps.PS5000A_THRESHOLD_DIRECTION["PS5000A_INSIDE"], 
                                                    ps.PS5000A_THRESHOLD_MODE["PS5000A_WINDOW"])

self._status["setTriggerChannelDirections"] = ps.ps5000aSetPulseWidthQualifierDirections(self._chandle, ctypes.byref(triggerDirections), 1)
assert_pico_ok(self._status["setTriggerChannelDirections"])

upper = 2000
lower = 2000
            
self._status["setPulseWidthQualifierProperties"] = ps.ps5000aSetPulseWidthQualifierProperties(self._chandle, lower, upper, ps.PS5000A_PULSE_WIDTH_TYPE["PSXXXX_PW_TYPE_GREATER_THAN"])
assert_pico_ok(self._status["setPulseWidthQualifierProperties"])

I have an error in ps.PS5000A_PULSE_WIDTH_TYPE["PSXXXX_PW_TYPE_GREATER_THAN"] and I try multiple things but it did not work.

Post Reply