eecs-bsp-test-code-2/1/main.c

33 lines
734 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// This project is used for demonstrating digital tubes of BSP library.
#include "STC15F2K60S2.H"
#include "sys.h"
#include "uart1.h"
code unsigned long SysClock = 11059200; //必须。定义系统工作时钟频率(Hz),用户必须修改成与实际工作频率(下载时选择的)一致
char buffer[10],*match;
void sendBack()
{
char temp;
int i;
for(i=0;i<5;i++)
{
temp=buffer[i];
buffer[i]=buffer[9-i];
buffer[9-i]=temp;
}
Uart1Print(buffer,10);
}
void main()
{
Uart1Init(2400); //初始化串口1波特率为2400
SetUart1Rxd(buffer,10,match,0);
SetEventCallBack(enumEventUart1Rxd,sendBack);
MySTC_Init();
while (1)
{
MySTC_OS();
}
}