Solved! Go to Solution.
Hi,
see Table 32-4. ADC channel mapping of the RM.
ADC1_P[0] is mapped to the channel 9 of the ADC1
BR, Petr
Hello Elsa,
I am also trying to measure the supply voltage or battery voltage in MPC5748G using ADC,
Can you please help me out how did you configure the ADC and also the propcedure you followed?
Hi,
if using the SDK you can refer to e.g. "adc_swtrigger_mpc5748g" demo example to know how ADC driver can be used.
BR, Petr
Hi PetrS,
Thanks for your Answer.
As you advised, I tried to understand the example "adc_swtrigger_mpc5748g"
As a small modification, I tried to display with the UART the value of the result on the Terminal. but I can't do it. I've been trying to figure out how to do this.
Here is the part of the code that I modified:
I just added the "LINFLEXD_UART_DRV_SendData" But it doesn't show me anything on the Terminal
if (result > ADC_THRESHOLD)
{
PINS_DRV_ClearPins(LED_PORT, (1 << LED));
LINFLEXD_UART_DRV_SendData(INST_LINFLEXD_UART1, result, 1u);
}
else
{
PINS_DRV_SetPins(LED_PORT, (1 << LED));
LINFLEXD_UART_DRV_SendData(INST_LINFLEXD_UART1, result, 1u);
}
Thanks
Hi,
the "result" is integer variable and LINFLEXD_UART_DRV_SendData expect char/string to send it through LINFlexD. You need to convert "result" to string.
BR, Petr
Hi PerS,
Another Question Please
Why, in the example, is number 9 assigned as the ADC_Channel_Number when PB[4] corresponds to precision channel 0 in the ADC1?
#define ADC_CHAN_NUM (9u) /* ADC1_P[0] corresponding to PB[4] */
Thanks
Hi,
see Table 32-4. ADC channel mapping of the RM.
ADC1_P[0] is mapped to the channel 9 of the ADC1
BR, Petr