基于51单片机的MODBUS通信C语言程序(从机)
typedef unsigned char uint8;
typedef unsigned int uint16;
typedef unsigned long uint32;
#define TIMER_HIGHT 0xf8
#define TIMER_LOW 0xcd
sbit bRun
LED=P3^4; //运行指示灯
sbit bWatchDog
=P1^7; //看门狗复位
sbit b
485Send= P1^3; //75LBC184 发送接收控制
uint32
dwTickCount,dwIntTick;
//时钟
uint8
idata sendBuf[16],receBuf[16]; //发送接收缓冲区
uint8
idata checkoutError;
// ==2 偶校验错
uint8
idata receTimeOut;
//接收超时
uint8
idata c10ms;
//10ms 计时
bit
b1ms,bt1ms,b10ms,bt10ms,b100ms,bt100ms; //定时标志位
// 串行中断程序
void commIntProc()
interrupt4
{
}
// void CommIntProc()
//定时器0 1ms 中断
void timer0IntProc() interrupt 1
{
}
// void Timer0IntProc()
//外部中断0
void intEx0Proc(void) interrupt 0
{
}
//计数器1中断
void counter1IntProc(void) interrupt 3 using 1
{
}
//定时处理
void timeProc(void)
{
}
// void TimerProc(void)
//初始化串口
void initUart(void)
{
}//void initUart(void)
//初始化中断
void initInt(void)
{
}
// void initInt(void)
//初始化
void initProg(void)
{
}
void main(void)
{
}
评论