新闻  |   论坛  |   博客  |   在线研讨会
YLP2440 DAC测试
mayer | 2009-05-23 14:07:23    阅读:1585   发布文章

YLP2440 DAC测试

rar


1.设置ADCCON
enable A/D converter prescaler,即往[14](PRSCEN)置一,设置 A/D converter prescaler value,[13:6](PRSCVL),并选择Analog input channel select,[5:3](SEL_MUX)。
其中A/D converter freq. = GCLK/(prescaler+1) = 1MHz
rADCCON = (1<<14)| (preScaler << 6) | ((ch&0x7) << 3);
2.Start ADC and check if ENABLE_START is low
ENABLE_START([0]),A/D conversion starts by enable. If READ_START is enabled, this value is not valid.
0 = No operation
1 = A/D conversion starts and this bit is cleared after the start-up.
    rADCCON |= 0x1;
    while (rADCCON & 0x1);        //check if ENABLE_START is low
3.Check if ECFLG(End of Conversion flag) is high
ECFLG([15])——End of conversion flag(Read only)
0 = A/D conversion in process
1 = End of A/D conversion
    while (! (rADCCON & 0x8000) );    //check ECFLG
4.返回结果
ADCDAT0/1([9:0]),XPDATA(Normal ADC)/YPDATA
return ((int)rADCDAT0 & 0x3ff);

*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。

参与讨论
登录后参与讨论
推荐文章
最近访客