3BSE023675R1控制模块,AI845使用产品
编程时使用SM0.1—调用子程序MBUS_INIT进行初始化,使用SM0.0—调用研究MBUS_SLAVE,并指定相应参数。关于参数的详细说明,可在子程序的局部变量表中找到。 示例参见图2:
图2 调用MODBUS通讯指令库 图2中参数意义如下: ●模式选择:启动/停止MODBUS,1=启动;0=停止; ● 从站地址:MODBUS从站地址,取值1~247; ● 波特率:可选1200,2400,4800,9600,19200,38400,57600; ● 奇偶校验:0=无校验;1=奇校验;2=偶校验; ● 延时:附加字符间延时,缺省值为0;
3BSE023675R1控制模块,AI845使用产品●最大I/Q位:参与通讯的最大I/O点数,GForce-200的I/O映像区为128/128,缺省值为128; ●最大AI字数:参与通讯的最大AI通道数,可为16或32; ●最大保持寄存器区:参与通讯的V存储区字(VW); ● 保持寄存器区起始地址:以&VBx指定(间接寻址方式); ● 初始化完成标志:成功初始化后置1; ● 错误代码:0=无错误。 (4) 注意的问题 调用Step7-Mciro/WIN32 V3.2 Instruction Library(指令库)需要分配库指令数据区(Library Memory)。库指令数据区是相应库的子程序和中断程序所要用到的变量存储空间。如果在编程时不分配库指令数据区,编译时会产生许多相同的错误。 由子程序参数HoldStart和MaxHold指定的保持寄存器区,是在GForce-200 CPU的V数据存储区中分配,此数据区不能和库指令数据区有任何重叠,否则在运行时会产生错误,不能正常通讯。注意Modbus 中的保持寄存器区按“字”寻址,即MaxHold规定的是VW而不是VB的个数。
3 Modbus RTU协议测试 包含Modbus RTU从站指令库的项目编译、下载到CPU中后,在编程计算机(PG/PC)上运行一些Modbus测试软件可以检验GForce-200的Modbus RTU通讯是否正常,这对查找故障点很有用。测试软件通过计算机串口(RS-232)和PC/PPI电缆连接CPU。 (以ModScan32测试软件为例作以检测说明) 3.1 测试软件 测试软件ModScan32如图3所示。
图3 Modbus RTU测试软件:ModScan32 图3中,ModScan32测试软件的画面中相关参数意义如下: Address:ModBus中存储区的起始地址; Device Id:PLC ModBus的端口地址; Length:参与通讯的V存储区字的长度。 3.2 参数设置 对ModScan32测试软件的通讯参数进行相关设置,要与GForce-200的Modbus RTU指令库MBUS_INIT中所设定的参数相统一,这样即可进行通讯检测。
Short term fault means that the cause of the fault occurs for a short time (especially an occasional short-term fault). For example, the signal line of a sensor is loose, the equipment vibrates, and the signal is intermittent, even once every ten days and a half months. Or, there is interference in the system, and a signal occasionally reverses abnormally. Short term fault also refers to the situation that the status of those faults can only appear in a short time (the situation described in the previous paragraph). For short-term faults, especially those with many possible causes, it is impossible to rely on the naked eye to track them for a long time. A better means is signal recording. Basic idea: record the abnormal output and possible causes (PLC variables) continuously. When a fault occurs, look back at the state records of each variable at the time of the fault, and combined with the program logic, you can judge the fault point or fault range, and then narrow the range and continue to record waves until the fault point is located.
Common wave recording means include: variable recording of HMI Software,