I am using MK61FN1M0VMJ12 microcontroller. I am trying to read it's temperature with built in sensor with ADC CH 26. But I get constant reading of 64875(ADC0_RA) in differential and value 64 when in single ended mode. Same behavior is seen on CH 30. Same piece of code I tested on my K60 Tower Kit and it is working there properly. Can u please tell me what I'm doing wrong. Here is the initialization code:
void init_adc(){
}
void adc0_isr(void){ if (( ADC0_SC1A & ADC_SC1_COCO_MASK ) == ADC_SC1_COCO_MASK) {
} else if (( ADC0_SC1B & ADC_SC1_COCO_MASK ) == ADC_SC1_COCO_MASK) {
}}
Hi prashantdev,
The temperature sensor should be only in the AD26 only and the AD31 mention that disable the module, if you want to do it single ended disable the SC1n[DIFF].
Also, for more information, check the following document that explains how to convert the measurement to temperature.
Let me know if this helps you.
Best Regards,
Alexis Andalon
Thnx Alexis for ur reply.
I'm disabling the channel before calibration. After calibration I've enabled it again.
Thanks for ur effort. Can u tell me if I'm doing something wrong in above posted code ? Because I've tested same code on different K61 microcontroller and behavior is same. Though when I run this code on my K60 tower kit it works. I don't know what I'm doing wrong.
Hello Prashant,
Could you try other ADC modules (ADC1 / ADC2 / ADC3) or other channels to check if this behavior is the same?
Best Regards,
Alexis Andalon
Yes it is same with all channels
Hello Prashant,
Which voltage does it have VREFH and VREFL? Also do you have other MCU where you could test this?
Best Regards,
Alexis Andalon
It shows same value (64875) while reading VREFH and VREFL channel. My code works properly on K60N512VMD100 tower kit.
Hello Prashant,
Since this is in your development board
Best Regards,
Alexis Andalon