ello,
I am trying to use the on-chip temperature sensor that is internally routed to the adc's channel 0. I found in the data sheet for the lpc54608 we must configure the ADC in single channel burst mode. I have used the adc driver example from the sdk version 2.6, called lpc_adc_burst.
the result after more than 9 conversions is 919. To determine what this equals in mV, i use the equation (Vref_p - Vref_n)/4095 * V_in *1000 = 2.5/4095 * 919*1000.
(with a Vrev_p = 2.5, and Vref_n = 0, and 12 bit resolution)
therefore, the input is 561mV.
Using the graph and tables from the data sheet, this can be fed into an equation based on LLS of:
mV = (-2.04)*temperature + 584 => temperature = (mV - 584)/(-2.04).
this means, in our case with 561mV we have:
temp = (561-584)/(-2.04) = 11.275°C
Considering this is sitting in ambient office temperature, I hardly think this is accurate.
again, please note, this is using the sdk 2.6 version of lpc_adc_burst with only modification to remove the getchar() to initiate the conversions
in main:
...
ADC_Configuration();
/* Enable the interrupt. */
ADC_EnableInterrupts(DEMO_ADC_BASE, kADC_ConvSeqAInterruptEnable);
NVIC_EnableIRQ(DEMO_ADC_IRQ_ID);
PRINTF("Configuration Done.\r\n");
#if defined(FSL_FEATURE_ADC_HAS_CTRL_RESOL) & FSL_FEATURE_ADC_HAS_CTRL_RESOL
PRINTF("ADC Full Range: %d\r\n", g_Adc_12bitFullRange);
#endif /* FSL_FEATURE_ADC_HAS_CTRL_RESOL */
while (1)
{
//GETCHAR();
gAdcConvSeqAIntFlag = false;
/* ADC_DoSoftwareTriggerConvSeqA(DEMO_ADC_BASE); */
/* Enable the burst mode and start the conversion. */
ADC_EnableConvSeqABurstMode(DEMO_ADC_BASE, true);
while (!gAdcConvSeqAIntFlag)
{
}
PRINTF("gAdcResultInfoStruct.result = %d\r\n", gAdcResultInfoStruct.result);
PRINTF("gAdcResultInfoStruct.channelNumber = %d\r\n", gAdcResultInfoStruct.channelNumber);
/* PRINTF("gAdcResultInfoStruct.overrunFlag = %d\r\n", gAdcResultInfoStruct.overrunFlag ? 1U : 0U); */
PRINTF("\r\n");
}
}