?? adcuart.c
字號:
//********************************************************************
//
// Author : ADI - Apps www.analog.com/MicroConverter
//
// Date : 16 October 2003
//
// File : 845uart.c 由此文件改成848的格式。
//
// Hardware : ADuC845-----ADUC848
//
// Description : sample program that performs ADC conversions in
// continuous mode and sends results to a PC via the
// UART.
//
//********************************************************************
#include <stdio.h>
#include <ADuC845.h>
sbit LED = 0x084; //P0^4
void ADC_int () interrupt 6
{
// LED ^= 1;
// printf("\n\n");
printf("%bX%bX",ADC0H,ADC0L);
RDY0 = 0;
}
void delay()
{ unsigned int i,j;
for(i=0;i<300;i++)
for(j=0;j<100;j++)
{;}
}
void main (void)
{
PLLCON=0x50;
//Configure UART
T3CON = 0x83; //9600 Baud rate
T3FD = 0x12;
SCON = 0x52;
//CONFIGURE ADC AND START CONVERTING....
SF = 0x200;
ADC0CON1 = 0x07; //Full Buffer, Bipolar, +/-2.56V range.
ADC0CON2 = 0x4A; //Refin+/-, Ain1->Ain2
EADC = 1; //Enable ADC Interrupt
EA = 1; //Enable Global Interrupts
ADCMODE = 0x23; // continuous conversion on Main channel on main channel
//WAIT FOR INTERRUPTS....
while(1)
{ delay();
P0^= 0x11;
};
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -