在线时间21 小时
UID3615216
注册时间2020-1-10
NXP金币0
TA的每日心情 | 开心 2020-12-28 15:52 |
|---|
签到天数: 21 天 连续签到: 1 天 [LV.4]偶尔看看III
注册会员

- 积分
- 172
- 最后登录
- 2020-12-29
|
发表于 2020-1-10 13:48:20
|
显示全部楼层
附上我的代码:
/*******************************************************************************
* Definitions
******************************************************************************/
#define DEMO_ADC_BASE ADC0
#define DEMO_ADC_SAMPLE_CHANNEL_NUMBER 2U
#define DEMO_ADC_CLOCK_DIVIDER 0U
void ADC_InitPins(void)
{
const uint32_t port0_pin31_config = (
IOCON_PIO_FUNC0 | /* Pin is configured as ADC */
IOCON_PIO_MODE_INACT | /* No addition pin function */
IOCON_PIO_INV_DI | /* Input function is not inverted */
IOCON_PIO_DIGITAL_OFF | /* Disable digital function */
IOCON_PIO_INPFILT_OFF | /* Input filter disabled */
IOCON_PIO_SLEW_STANDARD | /* Standard mode, output slew rate control is enabled */
IOCON_PIO_OPENDRAIN_DI /* Open drain is disabled */
);
IOCON_PinMuxSet(IOCON, PORT0_IDX, PIN31_IDX, port0_pin31_config); /* PORT0 PIN31 (coords: 9 is configured as ADC */
}
void main()
{
ADC_DoSelfCalibration(DEMO_ADC_BASE);
ADC_DoSoftwareTriggerConvSeqA(DEMO_ADC_BASE); /* Trigger the ADC and start the conversion. */
/* Wait for the converter & transfer to be done. */
while (!ADC_GetChannelConversionResult(DEMO_ADC_BASE, DEMO_ADC_SAMPLE_CHANNEL_NUMBER, &adcResultInfoStruct))
{
}
DD=adcResultInfoStruct.result;
} |
|