3BSE023675R1控制模塊,AI845使用產(chǎn)品
編程時使用SM0.1—調(diào)用子程序MBUS_INIT進行初始化,使用SM0.0—調(diào)用研究MBUS_SLAVE,并指定相應(yīng)參數(shù)。關(guān)于參數(shù)的詳細說明,可在子程序的局部變量表中找到。 示例參見圖2:
圖2 調(diào)用MODBUS通訊指令庫 圖2中參數(shù)意義如下: ●模式選擇:啟動/停止MODBUS,1=啟動;0=停止; ● 從站地址:MODBUS從站地址,取值1~247; ● 波特率:可選1200,2400,4800,9600,19200,38400,57600; ● 奇偶校驗:0=無校驗;1=奇校驗;2=偶校驗; ● 延時:附加字符間延時,缺省值為0;
3BSE023675R1控制模塊,AI845使用產(chǎn)品●最大I/Q位:參與通訊的最大I/O點數(shù),GForce-200的I/O映像區(qū)為128/128,缺省值為128; ●最大AI字?jǐn)?shù):參與通訊的最大AI通道數(shù),可為16或32; ●最大保持寄存器區(qū):參與通訊的V存儲區(qū)字(VW); ● 保持寄存器區(qū)起始地址:以&VBx指定(間接尋址方式); ● 初始化完成標(biāo)志:成功初始化后置1; ● 錯誤代碼:0=無錯誤。 (4) 注意的問題 調(diào)用Step7-Mciro/WIN32 V3.2 Instruction Library(指令庫)需要分配庫指令數(shù)據(jù)區(qū)(Library Memory)。庫指令數(shù)據(jù)區(qū)是相應(yīng)庫的子程序和中斷程序所要用到的變量存儲空間。如果在編程時不分配庫指令數(shù)據(jù)區(qū),編譯時會產(chǎn)生許多相同的錯誤。 由子程序參數(shù)HoldStart和MaxHold指定的保持寄存器區(qū),是在GForce-200 CPU的V數(shù)據(jù)存儲區(qū)中分配,此數(shù)據(jù)區(qū)不能和庫指令數(shù)據(jù)區(qū)有任何重疊,否則在運行時會產(chǎn)生錯誤,不能正常通訊。注意Modbus 中的保持寄存器區(qū)按“字”尋址,即MaxHold規(guī)定的是VW而不是VB的個數(shù)。
3 Modbus RTU協(xié)議測試 包含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測試軟件的畫面中相關(guān)參數(shù)意義如下: Address:ModBus中存儲區(qū)的起始地址; Device Id:PLC ModBus的端口地址; Length:參與通訊的V存儲區(qū)字的長度。 3.2 參數(shù)設(shè)置 對ModScan32測試軟件的通訊參數(shù)進行相關(guān)設(shè)置,要與GForce-200的Modbus RTU指令庫MBUS_INIT中所設(shè)定的參數(shù)相統(tǒng)一,這樣即可進行通訊檢測。
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,