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

39 lines
741 B
C
Raw Normal View History

2022-08-22 14:51:00 +08:00
// receiver
#include "STC15F2K60S2.H"
#include "sys.h"
#include "uart2.h"
code unsigned long SysClock = 11059200; //必须。定义系统工作时钟频率(Hz),用户必须修改成与实际工作频率(下载时选择的)一致
char num[5]={0x01,0x03,0x05,0x07,0x09};
int countdown=10;
void sendData()
{
int i;
if(countdown)
{
countdown--;
}
countdown=10;
Uart2Print(num,5);
for(i=0;i<5;i++)
{
num[i]++;
if(num[i]>0x09)
{
num[i]=0x01;
}
}
}
void main()
{
Uart2Init(1200,Uart2Usedfor485); //初始化串口2波特率为2400
SetEventCallBack(enumEventSys1S,sendData);
MySTC_Init();
while (1)
{
MySTC_OS();
}
}