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

39 lines
739 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.

// sender
#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();
}
}