Hello from Germany,
I hope this is the appropriate Forum for this.
I'm trying to read the Temperature measured by the PIC16F15376 onboard Temperature Indicator Module, but I don't really know how to handle the measured values. I use XC8 pro Version...
FVR is set to 2,048 V. FVRCON is set to 0xAA
After the initialisations in my main.c I'm calling the function
if(FVR_IsOutputReady()){
convertedValue = ADC_GetConversion(channel_Temp);
}
The adc.c looks like this:
void ADC_Initialize(void)
{
// set the ADC to the options selected in the User Interface
// GO stop; ADON enabled; CHS ANA0;
ADCON0 = 0x01;
// Acquisition time delay
ADC_TemperatureAcquisitionDelay();
// Start the conversion
ADCON0bits.GO = 1;
// Wait for the conversion to finish
while (ADCON0bits.GO)
{
}
// Conversion finished, return the result
HIGHbyte = ADRESH;
LOWbyte = ADRESL;
EUSART2_Write(0xAF); //This Byte indicates, that the next Bytes are High and Low- Temperature Bytes
__delay_ms(50);
EUSART2_Write(HIGHbyte);
__delay_ms(50);
EUSART2_Write(LOWbyte);
return ((adc_result_t)((ADRESH << 8) + ADRESL));
}
void ADC_TemperatureAcquisitionDelay(void)
{
__delay_ms(200);
}
The result is often 0x01 (Highbyte) and 0x00 (Lowbyte), or just 0x00 (High) and 0x00 (Low)...
In just some Cases the Lowbytevalue differs from 0x00...
I'm reading the serial Data via Labview and want to do the math in Labview. But with these Values, I am not even able to determine the Offset...
I'm no expert and would really appreciate some help. Does anybody know some good Tutorials or Examples for this? Couldn't find them....