ADC with MPC5748G

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

ADC with MPC5748G

跳至解决方案
1,458 次查看
Elsa_24
Contributor II
Hi, I would like to know how to read for example the voltage across a pin using the ADC. I have already activated the PI[11] pin corresponding to Standard Channel 19 of the ADC0 and I would like to read the voltage across this pin. And the ADC component has already been added to the project Thanks
0 项奖励
1 解答
1,390 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

see Table 32-4. ADC channel mapping of the RM.

ADC1_P[0] is mapped to the channel 9 of the ADC1

PetrS_0-1616660993164.png

 

BR, Petr

在原帖中查看解决方案

0 项奖励
6 回复数
913 次查看
SAchary11
Contributor I

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?

0 项奖励
1,453 次查看
PetrS
NXP TechSupport
NXP TechSupport

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

1,441 次查看
Elsa_24
Contributor II

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

0 项奖励
1,427 次查看
PetrS
NXP TechSupport
NXP TechSupport

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

1,414 次查看
Elsa_24
Contributor II

 

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

0 项奖励
1,391 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

see Table 32-4. ADC channel mapping of the RM.

ADC1_P[0] is mapped to the channel 9 of the ADC1

PetrS_0-1616660993164.png

 

BR, Petr

0 项奖励