S32K116EVB 's ADC code of 0xFFF

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

S32K116EVB 's ADC code of 0xFFF

2,107 次查看
D_pengF
Contributor II

Hello, in S32K116EVB  example of ADC project,how is algorithm bellow come from?especially why is 0xFFF,not 0xFFF0?
code:

uint32_t read_adc_chx(void)
{
uint16_t adc_result=0;
adc_result=ADC0->R[0]; /* For SW trigger mode, R[0] is used */
return (uint32_t) ((5000*adc_result)/0xFFF); /* Convert result to mv for 0-5V range */
}

0 项奖励
回复
4 回复数

1,886 次查看
D_pengF
Contributor II

Dear Robin
thank you very much !
new EVB no program, firmware could not work.

0 项奖励
回复

2,047 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi

Seems that you are referring to AN5413. It initialize ADC resolution 12 bit(2^12=4096 levels). So you need to /0xFFF.

Have a look at Resolution of AN12217 S32K1xx ADC guidelines, spec and configuration.


Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

1,963 次查看
D_pengF
Contributor II

Dear Robin
thank you very much !
another question I want to ask
recently ,I got   S32K116EVB board, it shows"NO board  detected on any of specified UART communication ", I also do a connnection according to the S32K116-EVB_QSG_REV0 - QucikStartGuide, eveything seem to be ok, When EVB is powered from USB, LEDs D2 and D3 light become green. but RGB LED colors periodically between RED-GREEN-BLUE can not light, it is off.
computer's COM already  set 11520b,
how can I figure out this problem, please do me a favor!
thanks a lot

0 项奖励
回复

1,932 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Please refer to the discussion in S32K116EVB FreeMaster Connection Failure

Maybe S32K116_EVB_JumpStart_Firmware.srec is not programmed into S32K116 at the factory. Download the S32K116EVB Evaluation Board – Software for FreeMASTER and find the ...\S32K116EVB_JumpStart_FreeMaster\S32K116_EVB_JumpStart_Firmware\Debug\S32K116_EVB_JumpStart_Firmware.srec