Hi to everybody,
I'm using a Kinetis MK10DX128VLH7 uC and would like to monitore an ADC value in bachground.
If the value is not in the calculated area, I would like to generate an interrupt.
To do this, I initialised the internal ADC0 with continous mode and the specific sample parameters.
Well, the initialisation and the interrupt works but I can only generate an interrupt when the calculated
value is reached, NOT if the value is beyond my calculated borders. (The datasheet says the same)
//Now I generate an interrupt when my calculated value is reached
ADC0_CV1 = 0x6000;
ADC0_CV2 = 0x5000;
So, am I right just to switch the two values like this??
//Now I would like to generate an interrupt only when the ADC value is beyond my calculated area
ADC0_CV2 = 0x6000;
ADC0_CV1 = 0x5000;
That seems to work but I'm not able to verify it in the moment...
Maybe someone can say me the rules for generating an interrupt
based on the two CV values.
Thanks :smileyhappy:
Pascal
Solved! Go to Solution.
If you are using the range comparison you have 2 different modes:
When using the inside/outside range comparison you will have two different settings:
I would instead use the Greater than or equal to threshold function to generate an interrupt when the analog input reaches your threshold value; for the range comparison I would use the Outside range, inclusive function instead of changing the compare threshold (ADC0_CV1, ADC0_CV2).
Thanks for your answer!
I'm not sure, if I understand the text in the data sheet right:
http://cache.freescale.com/files/32bit/doc/ref_manual/K10P64M72SF1RM.pdf
Refer to page 704:
Configures less than threshold, outside range not inclusive and inside range not inclusive; functionality based on the values placed in CV1 and CV2.
Does it means that I only generate an interrupt, if my measured value is
1. smaller than the CV1 value or
2. taller than the CV2 value??
I can't find this meaning in the text....
Thanks
Pascal
If you are using the range comparison you have 2 different modes:
When using the inside/outside range comparison you will have two different settings:
Hi,
okay thanks for your explanation! Now, it's clear!
I have probably skiped page 728 :smileywink:
Thanks a lot!
Pascal