How to read the pic32mz core temperature?

mikroC, mikroBasic and mikroPascal PRO for Microchip’s 32-bit PIC MCUs
Post Reply
Author
Message
malugu
Posts: 2
Joined: 04 Jul 2019 07:48

How to read the pic32mz core temperature?

#1 Post by malugu » 08 Jul 2019 05:06

Help me connect the dots in the documentation to read the PIC32 core temperature sensor and interpret the result.

I see that it's AN44 and it's connected to the shared high-speed ADC 7. I see symbols like AN44 (part of AN_SELECT) and ADCHS_AN44 (enum ADCHS_AN_INPUT_ID) but haven't yet seen the APIs to use them with.

I've configured the first three external ADC inputs using Harmony and operate them like this:
void ADC_Initialize(void)
{
memset(&adcData, 0, sizeof adcData);
}

void ADC_Init(void)
{
// calLED once at app init state
DRV_ADC0_Open();
DRV_ADC1_Open();
DRV_ADC2_Open();
// use the 256 oversampling filter
DRV_ADC_DigitalFilter0_Open();
DRV_ADC_DigitalFilter1_Open();
DRV_ADC_DigitalFilter2_Open();
DRV_ADC_Start();
}

void ADC_Task(void)
{
// when all are ready, read them and start another sample
IF ( DRV_ADC_DigitalFilter0_DataIsReady() &&
DRV_ADC_DigitalFilter1_DataIsReady() &&
DRV_ADC_DigitalFilter2_DataIsReady() )
{
adcData.reading[0] = DRV_ADC_DigitalFilter0_DataRead();
adcData.reading[1] = DRV_ADC_DigitalFilter1_DataRead();
adcData.reading[2] = DRV_ADC_DigitalFilter2_DataRead();
DRV_ADC_Start();
}
}


Once I've gotten the core temp back as a number, how do I interpret it?

User avatar
petar.suknjaja
mikroElektronika team
Posts: 683
Joined: 05 Mar 2018 09:44
Location: Belgrade

Re: How to read the pic32mz core temperature?

#2 Post by petar.suknjaja » 09 Jul 2019 08:16

Hi,
This topic requires reading through PIC32MZ reference manuals,erratas as well as the topics on the Microchip's site that deal with this matter.
We haven't done something similar to this, so if anyone has any useful information to add, I'm calling them to write in this topic.
Kind regards,
Petar

hexreader
Posts: 1785
Joined: 27 Jun 2010 12:07
Location: England

Re: How to read the pic32mz core temperature?

#3 Post by hexreader » 09 Jul 2019 12:47

Exactly which PIC32MZ are you using?
Start every day with a smile...... (get it over with) :)

Post Reply

Return to “PIC32 PRO Compilers”