cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC Creator & Designer Software

dhum
New Contributor

Information on the use of the ADC range/limit interrupt is pretty sparse for PSOC4.2 BLE. Does anyone know how to:

1. Create an interrupt handler that functions e.g reads and clears the appropriate range registers.

2. Initialise the interrupt handler e.g ...startEx(range_handler) or some other mechanism?

Thanks,

Dave

0 Likes
1 Solution
LinglingG_46
Moderator
Moderator

Hi,

I give you a code example here, please refer.

 

Thanks,

View solution in original post

0 Likes
4 Replies
LinglingG_46
Moderator
Moderator

Hi,

I give you a code example here, please refer.

 

Thanks,

View solution in original post

0 Likes
dhum
New Contributor

Thanks for the code sample LinglingG_46,

I have a quick look at the sample and have a couple of questions:

The code:

intr_status = ADC_SAR_Seq_SAR_RANGE_INTR_REG;

if((intr_status & 0x0001) == 1)

 

Suggests that ADC_SAR_Seq_SAR_RANGE_INTR_REG may have more bits set than just the range bit for the configured channel, is that likely?

Was the opamp buffer purely to manage the output impedance of what may  be connected to pin1 and is that necessary if the pin is HiZ analog?

Thanks,

0 Likes
LinglingG_46
Moderator
Moderator

Suggests that ADC_SAR_Seq_SAR_RANGE_INTR_REG may have more bits set than just the range bit for the configured channel, is that likely?
Yes, more details, please refer to the register TRM: https://www.cypress.com/file/135861/download

Was the opamp buffer purely to manage the output impedance of what may be connected to pin1 and is that necessary if the pin is HiZ analog?

Not necessary.

0 Likes
dhum
New Contributor

Thanks for the help and references LingLingG_46.

A little further information for anyone reading this post:

  1.  The ADC_SAR_IRQ handler handles all the ADC_SAR interrupts (there are 10 interrupt sources see the register TRM reference (linked above), you can use ADC_SAR_Seq_SAR_INTR_CAUSE_REG to work out which one.
  2. With only the channel_0 low limit interrupt set the interrupt sequence in the handler seems to be an End of Scan (EOS) interrupt first then the next interrupt will be a Range interrupt ORed with an EOS interrupt. This cycle repeats for every range interrupt.
0 Likes