题目内容
输入电压在0-1.8V,利用Exynos4412的ADC_IN3对它进行采样,ADC的分辨率为12位,使用预分频。Exynos4412与ADC相关的寄存器地址已经给出,试:1)解释以下代码(在“//?”处解答):#defineADC_PRSCVL65 //转换时钟预分频因子#defineADC_BASE0x126C0000#defineADCCON(*((volatile unsigned long *)(ADC_BASE +0x0)) )#defineADCDLY(*((volatile unsigned long *)(ADC_BASE +0x8)) )#defineADCDAT(*((volatile unsigned long *)(ADC_BASE +0xc)) )#defineCLRINTADC(*((volatile unsigned long *)(ADC_BASE +0x18)) )#defineADCMUX(*((volatile unsigned long *)(ADC_BASE +0x1c))Void delay (insigned long count){unsigned long i = count;while (i --);}int read_adc(int ch) //?{ADCCON &= (~(0x1 << 16) | ~(0x1 << 14) | ~(0xFF << 6));ADCCON |= (0x1 << 16) | (0x1 << 14) | (0x41 << 6)); //?以上两句ADCCON &= ~(0x3<< 1); //?ADCMUX = ch; //?ADCCON |= 0x1; //?while (ADCCON & 0x01); //?while (!(ADCCON & (1 << 15))); //?return (ADCDAT & 0xfff); //?}//测试程序void adc_test (void) /*可用main()程序名*/{printf(“*** test ADC ***\n”);while (1){printf(“ADC = %d\r\n”, read_adc(3));delay (0x100000);}}2)编写同样功能的代码,改用6818芯片完成
查看答案
搜索结果不匹配?点我反馈