⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adcuart.c

📁 基于单片机AUC848与DSP 5410的HPI通讯程序
💻 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 + -