This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to used hardware interrupt for AD sample?

Other Parts Discussed in Thread: CC2541

I want to use CC2541 control a dust sensor, the sensor has an input pulse drive signal like this:

  

 

The drive signal with a high level about 0.32ms, how can I generate it in the OSAL?

The analog output from dust sensor is valid after rising edge of drive signal about 0.28ms,like picture below:(Iled is drive signal, output pulse is analog output signal)

 

 

How can I use AD to match this sampling timing?

  • Hi Denzel, 

    For the pulse-driven waveform, I would use the PWM output of one of the Timer1/3/4. Use the prescaler to get the long period. 

    For the sampling, I would set up an interrupt on the rising edge of the drive signal. The OSAL timer resolution is 1 ms, so I would not use that to set up the ADC read task. I would rather set up Timer 1 CH0 to start the conversion after the desired amount of time after the interrupt. Please see the description in ADCCON1.STSEL register in the user guide. 

    Peder