📄 main.c
字号:
//主函数
#include "main.h"
void main(void)
{
INT16U AdcData; //定义变量
INT8U keyvalue,UartData;
SLEEP &=~0x04;
while(!(SLEEP & 0x40)); //晶体振荡器开启且稳定
CLKCON &= ~0x47; //选择1-32MHz 晶体振荡器
SLEEP |= 0x04;
LcdInit(); //初始化
ClrScreen(0); //清屏
//InitKey(); //初始化键盘
UartInit(9600,ONE_STOP_BITS,NO_PARITY );
PutString(0,0,"power:",0);
PutString(2,0,"UART TEST :",0);
while(1)
{ //*********键盘************
// keyvalue=ScanKey();
// if(keyvalue!=K_NO)
// {
// PutEnChar(2,50,keyvalue,0);
//}
//*********采样*************
//AdcData = HalAdcSampleSingle(ADC_REF_AVDD,ADC_14_BIT,ADC_VDD_3);
//ValueTransformBcd(AdcData*9.9/8192);
//PutString(0,46,BcdData,0);
//************通信***********
UartData=Uart0Receive();
PutEnChar(6,0,UartData,0);
Uart0Send(0x31);
Uart0Send(0x32);
Uart0Send(0x33);
Uart0Send(0x34);
Uart0Send(0x35);
halWait(250);halWait(250);halWait(250);halWait(250);halWait(250);
halWait(250);halWait(250);halWait(250);halWait(250);halWait(250);
halWait(250);halWait(250);halWait(250);halWait(250);halWait(250);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -