The original example's trigger is defined at line 46:
Code: Select all
rp_AcqSetTriggerSrc(RP_TRIG_SRC_NOW);
rp_acq_trig_state_t state = RP_TRIG_STATE_TRIGGERED;
while(1){
rp_AcqGetTriggerState(&state);
if(state == RP_TRIG_STATE_TRIGGERED){
sleep(1);
break;
}
}
Code: Select all
/**
* Type representing different trigger sources used at acquiring signal.
*/
typedef enum {
RP_TRIG_SRC_DISABLED = 0, //!< Trigger is disabled
RP_TRIG_SRC_NOW = 1, //!< Trigger triggered now (immediately)
RP_TRIG_SRC_CHA_PE = 2, //!< Trigger set to Channel A threshold positive edge
RP_TRIG_SRC_CHA_NE = 3, //!< Trigger set to Channel A threshold negative edge
RP_TRIG_SRC_CHB_PE = 4, //!< Trigger set to Channel B threshold positive edge
RP_TRIG_SRC_CHB_NE = 5, //!< Trigger set to Channel B threshold negative edge
RP_TRIG_SRC_EXT_PE = 6, //!< Trigger set to external trigger positive edge (DIO0_P pin)
RP_TRIG_SRC_EXT_NE = 7, //!< Trigger set to external trigger negative edge (DIO0_P pin)
RP_TRIG_SRC_AWG_PE = 8, //!< Trigger set to arbitrary wave generator application positive edge
RP_TRIG_SRC_AWG_NE = 9, //!< Trigger set to arbitrary wave generator application negative edge
RP_TRIG_SRC_CHC_PE = 10,//!< Trigger set to Channel B threshold positive edge
RP_TRIG_SRC_CHC_NE = 11,//!< Trigger set to Channel B threshold negative edge
RP_TRIG_SRC_CHD_PE = 12,//!< Trigger set to Channel B threshold positive edge
RP_TRIG_SRC_CHD_NE = 13 //!< Trigger set to Channel B threshold negative edge
} rp_acq_trig_src_t;
Code: Select all
/**
* Sets the trigger threshold value in volts. Makes the trigger when ADC value crosses this value.
* @param voltage Threshold value for the channel
* @return If the function is successful, the return value is RP_OK.
* If the function is unsuccessful, the return value is any of RP_E* values that indicate an error.
*/
int rp_AcqSetTriggerLevel(rp_channel_trigger_t channel, float voltage);
I have modified the original to try to implement a positive edge trigger:
Code: Select all
rp_AcqSetTriggerSrc(RP_TRIG_SRC_CHA_PE); // rp.h line 269
rp_AcqSetTriggerLevel(RP_T_CH_1, 0.05); // rp.h line 824
rp_acq_trig_state_t state = RP_TRIG_STATE_TRIGGERED;
while(1){
rp_AcqGetTriggerState(&state);
if(state == RP_TRIG_STATE_TRIGGERED){
sleep(1);
break;
}
}