楼主最近还看过
回复内容:
对: 乖乖小笨熊 应该是2个串口访问了相同内存区,把该参数修改 内容的回复!
请教,如何修改?
参数设置如下:
//设置PLC1通讯参数
axHWPLCComm1.BaudRate = (HaiwellPLCcomm.fBaudRate)4; // 19200
axHWPLCComm1.CommPort = int.Parse(tboxComPort.Text.Trim());
axHWPLCComm1.SampleTime = 300; //范围100~30000毫秒
axHWPLCComm1.CommProtrol = (HaiwellPLCcomm.fProtrol)0; // [N,8,2,RTU]
//增加PLC连接
int iNO = int.Parse(tboxPLCNo.Text.Trim());
axHWPLCComm1.HWPLCs.AddPLC(iNO, iNO.ToString() + "号PLC");
//设置PLC2通讯参数
axHWPLCComm2.BaudRate = (HaiwellPLCcomm.fBaudRate)4; // 19200
axHWPLCComm2.CommPort = int.Parse(tboxPlc24ComPort.Text.Trim());
axHWPLCComm2.SampleTime = 300; //范围100~30000毫秒
axHWPLCComm2.CommProtrol = (HaiwellPLCcomm.fProtrol)0; // [N,8,2,RTU]
//增加PLC连接
int iNO = int.Parse(tboxPlc24No.Text.Trim());
axHWPLCComm2.HWPLCs.AddPLC(iNO, iNO.ToString() + "号PLC");