【文件属性】:
文件名称:aduc831 AD测试
文件大小:13KB
文件格式:UVPROJ
更新时间:2014-04-18 05:22:28
aduc831
Ad测试代码
#include
#include
#include
#define uchar unsigned char
/*Set up UART */
/*系列初始化*/
void serial_initial(void)
{
aduPLLCON=0X00;
// T3CON = 0x085;//831,晶振11.0592M,波特率9600
T3CON = 0x086;//841
T3FD = 0x2D;
SCON = 0x052;
}
void DELAY(int length) //延时程序
{
while (length >=0)
length--;
}
/*AD中断程序,输出10进制AD采样值 */
void adc_int() interrupt 6
{
unsigned int out=0;
unsigned int channel;
channel=ADCDATAH>>4;//ADCDATAH高四位为通道号
printf("\n%u ",channel);//输出通道号
out=ADCDATAH&0x0F;
out=out*256+ADCDATAL;
printf("\n%u ",out);//输出采样值
// Uart_write(ADCDATAH); //显示原始数据
// Uart_write(ADCDATAL);
return;
网友评论
- 不错,问题已经解决。
- 不错的资料,哟帮助,问题解决了。
- 代码能够实现功能。也没什么特别的