《modbusASCII模式源代码》由会员分享,可在线阅读,更多相关《modbusASCII模式源代码(36页珍藏版)》请在人人文库网上搜索。
1、include main.h#include intrins.h#include nokia_5110.h#include ds18b20.h #include EEPROM.h/*modbus ASSCII 的C51程序 单片机STC89C52通信波特率 9600 8位数据 1位停止位 232通位接口*/uint8sendBuf_12435,receBuf_12435; /发送接收缓冲区uint16 reg_1245; /寄存器uint16 wendu_124; /温度值unsigned int zhengshu_124,xiaoshu_124;char temperature_124= .。
2、 ;uint8 code table_124= /数码管码0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e;uint8receTimeOut_124;/接收超时bit f1ms_124=0,f10ms_124=0,f100ms_124=0;/定时标志位uint8 c10ms_124,c100ms_124; /定时计数/*/ /*函数名称: commIntProc() *输入参数: 共 0 个参数; *输出参数: 共 0 个参数; *返回值: *需储存的参数: 共 0 个参数; *功能介。
3、绍:串口中断函数 *修改日志: *2010-12-14 Ver. 1.00 开始编写;2010-12-7 完成; 2010-12-7 /* */ /*/ void commIntProc_124() interrupt 4 / 串行中断程序if(TI)TI = 0; if(sendPosi_124 =10)c10ms_124 = 0; /10ms计时器清零f10ms_124=1; / void Timer0IntProc()/*/ /*函数名称: save_124(void) *输入参数: 共 0 个参数; *输出参数: 共 0 个参数; *返回值: *需储存的参数: 共 0 个参数; *功能。
4、介绍:保存掉电寄存器数据 *修改日志: *2010-12-14 Ver. 1.00 开始编写;2010-12-14 完成; 2010-12-14 /* */ /*/ void save_124(void) /保存掉电寄存器数据uint8 tempdata_124;tempdata_124=P1;IapEraseSector_124(0x2000);IapProgramByte_124(0x2000,reg_1240);IapProgramByte_124(0x2001,reg_1241);IapProgramByte_124(0x2002,reg_1242);IapProgramByte_12。
5、4(0x2003,reg_1243);IapProgramByte_124(0x2004,reg_1244);IapProgramByte_124(0x2005,tempdata_124);/*/ /*函数名称: read_124(void) *输入参数: 共 0 个参数; *输出参数: 共 0 个参数; *返回值: *需储存的参数: 共 0 个参数; *功能介绍:开机读取掉电时的寄存器数据 *修改日志: *2010-12-14 Ver. 1.00 开始编写;2010-12-14 完成; 2010-12-14 /* */ /*/ void read_124(void) /