As a matter of fact, this is a developer forum, not a support team.
I cannot find at first sight a bug in your code, but will you please post your complete project, so that we all can have a look at all of your settings? To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
Here is the bundle file. Please have a look and let me know why is the interrupt firing every time even though the ADC threshold limit is not matching.
Any help would be much appreciated.
You used a
intr_status = ADC_SAR_SEQ_SAR_INTR_MASKED_REG;
while in the Cypress example in ADC datasheet you find
intr_status = ADC_SAR_SEQ_SAR_INTR_REG;
I am not concerned with what we are doing inside the interrupt function. All I want to know is that why that interrupt function is firing/hitting in first place if ADC threshold criteria is not satisfied. Or there is no way to stop that interrupt function from firing?
I hope you understand what I am trying to say.
And moreover the bundle project I uploaded is from Cypress sample projects.
Can somebody please shed some light on the issue?
Would be much appreciated!!
I am having the same issue...can someone please give an answer to why is the interrupt keep firing for the limit range even if the conditions are not met.
If Pin_Vin is floating, then it could be that it is floating above the threshold causing the interrupt.
ADC_SAR_INTR_MASK_REG &= ~ADC_EOS_MASK;
ADC_SAR_RANGE_INTR_MASK_REG = 0x0001; // Canal 0
you need to enable interrupt for the SAR, then disable the EOC conversion interrupt on the INTR_MASK Register and finally enable the Range Interrupt for the desired chanel in the register RANGE_INTR_MASK (if you didn't activated it en the graphical configuration)
check the example.
Hope it helps
Hi mromero, Many thanks for your reply. Once I get time, I'll give this a try.