//使用请声明代码来源
/*****************************************************************************
函数:ADCInitial(unsigned char chanal,unsigned char speed)
出口参数:无
入口参数:chanal(转换通道),speed(转换速度)
日期:2007.11.06
编者:zhangfazhong
状态:已测通过
*****************************************************************************/
void ADCInitial(unsigned char chanal,unsigned char speed)
{
switch (chanal)
{
case 0:
ADC_CONTR = ADC_CONTR & 0xf8;
break;
case 1:
ADC_CONTR = ADC_CONTR | 0x01;
ADC_CONTR = ADC_CONTR & 0xf9;
break;
case 2:
ADC_CONTR = ADC_CONTR | 0x02;
ADC_CONTR = ADC_CONTR & 0xfa;
break;
case 3:
ADC_CONTR = ADC_CONTR | 0x03;
ADC_CONTR = ADC_CONTR & 0xfb;
break;
case 4:
ADC_CONTR = ADC_CONTR | 0x04;
ADC_CONTR = ADC_CONTR & 0xfc;
break;
case 5:
ADC_CONTR = ADC_CONTR | 0x05;
ADC_CONTR = ADC_CONTR & 0xfd;
break;
case 6:
ADC_CONTR = ADC_CONTR | 0x06;
ADC_CONTR = ADC_CONTR & 0xfe;
break;
case 7:
ADC_CONTR = ADC_CONTR | 0x07;
break;
default : break;
}
switch (speed)
{
case 0x11:
ADC_CONTR = ADC_CONTR | 0x60;
break;
case 0x10:
ADC_CONTR = ADC_CONTR | 0x40;
ADC_CONTR = ADC_CONTR | 0xdf;
break;
case 0x01:
ADC_CONTR = ADC_CONTR | 0x20;
ADC_CONTR = ADC_CONTR & 0xbf;
break;
case 0x00:
ADC_CONTR = ADC_CONTR & 0x9f;
break;
default : break;
}
}
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。