AB developed RSLink is to read the data on the remote AB PLC good tool, it can achieve read the name of species AB PLC requirements. But in the actual system integration, due to many different types of remote PLC, so, I received a task, self-development program to read a variety of PLC. In our use of the remote device, there are AB s PLC, Siemens PLC, LG s PLC, there are many of the RTU, but there is a common characteristic: through the serial port access, but different data protocols to identify the parties data protocol, it all OK. To this end, I was a study of the AB PLC. AB provides software, its data a bit evasive, I had to use statistics monitor serial port monitoring technology to obtain information more intuitive. 1, serial port monitor I used to listen PORTMON.EXE serial, the following is run RSLink when I listen to the data: IRP_MJ_WRITE 41 54 5A 0D IRP_MJ_READ 41 54 5A 0D IRP_MJ_WRITE 10 02 01 00 06 00 01 08 03 10 03 01 65 IRP_MJ_READ 10 06 10 02 00 01 46 00 01 08 00 EE 34 49 64 35 2F 30 33 20 20 20 20 20 20 20 00 00 86 10 10 8D A3 10 10 FC 10 03 18 55 IRP_MJ_WRITE 10 06 IRP_MJ_WRITE 100201000F002704A1C80789001003A3F3 IRP_MJ_READ 10 06 10 02 00 01 4F 00 27 04 00 00 C7 0C CF 0C C8 0C C6 0C 88 0C EC 0C AA 0C 00 00 00 00 00 00 00 00 0,000,000,000,000,000 0,000,000,000,000,000 F3 FF 0D 00 0D 00 00 00 00 00 4C 04 52 03 20 04 8B 03 84 03 00 00 00 00 0,000,000,000,000,000 0,600,000,000,000,000 00 00 00 00 02 00 00 00 00 00 00 00 1F 00 00 00 00 00 00 00 00 00 00 00 0,100,020,000,000,000 0,000,010,002,000,300 04 00 05 00 06 00 07 00 00 00 00 00 00 00 00 00 C8 00 00 00 C2 01 00 00 00 00 76 02 B6 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 CF 03 00 00 00 00 00 00 00 00 5D 00 C7 0C CF 0C C8 0C C6 0C 86 0C EC 0C AA 0C 00 00 00 00 10 03 8D D8 IRP_MJ_WRITE 10 06 It can be seen, RSLink run when three steps: 1, initialize MODEM: send ATZ, confirmed the existence MODEM. 2, see PLC s data structures, 1006 to confirm receipt issued 3, view the N7 data, 1006 to confirm receipt issued Steps to do now is very clear, the following is issued with the understanding of the meaning of the data returned. String 4
Second, the format of the request to send data PLC data structure for the query, each time the same request, there is no need to spend time. We focus on the N7 to read the data processing: The data issued by the meaning of: * 10 * 02 01 00 0F 00 27 04 A1 C8 07 89 00 * 10 03 A3 F3 Start bit Start bit Purpose of site Purpose of site Reading data Reservation ID No. ID No. Number of words Region Integer Start word Mark the end of Mark the end of Parity Parity String 6 *: Added * CRC32 operation does not participate. CRC32 is calculated: VB code is as follows:
String 7
Function CalcCRC (DATA (), Arraylen) As Long Dim I, J, K, H As Integer For I = 0 To Arraylen J = J Xor DATA (I) For K = 1 To 8
% E5% AD% 97% E4% B8% B21 Private Sub Command1_Click () Dim I, J As Long Length = (Len (Text3.Text)) / 2 - 1 ReDim Init (Length) For I = 0 To Length Init (I) = Val ("& H" + mi * d (Text3.Text, 2 * I + 1, 2)) Next I J = CalcCRC (Init (), Length) Text2.Text = Hex (J Mod 256) Text1.Text = Hex (Int (J / 256)) End Sub
% E5% 8F% 91% E9% 80% 81% E8% BF% 99% E4% B8% B2% E5% AD% 97% E7% AC% A6% E5% B0% 86% E4% BC% 9A% E8 % 83% BD% E5% BE% 97% E5% 88% B0% E5% BE% 97% E5% 88% B0N7% E7% 9A% 84% E6% 95% B0% E6% 8D% AE% E8% BF % 94% E5% 9B% 9E% EF% BC% 8C% E8% BF% 94% E5% 9B% 9E% E7% 9A% 84% E6% 95% B0% E6% 8D% AE% E4% BB% A5 % E5% AD% 97% E4% B8% BA% E5% 8D% 95% E4% BD% 8D% EF% BC% 8C% E5% BC% 80% E5% A7% 8B% E5% AD% 97% E4 % B8% 8E% E5% AD% 97% E4% B8% AA% E6% 95% B0% E5% 86% B3% E5% AE% 9A% E8% BF% 94% E5% 9B% 9E% E7% 9A % 84% E5% 86% 85% E5% AE% B9% E3% 80% 82 % E4% B8% 89% E3% 80% 81% E6% 8E% A5% E6% 94% B6% E5% 88% B0% E7% 9A% 84% E6% 95% B0% E6% 8D% AE % E5% A6% 82% E4% B8% 8A% E6% 8E% A5% E6% 94% B6% E5% 88% B0% E7% 9A% 84% E6% 95% B0% E6% 8D% AE% EF % BC% 8C% E4% BB% A5 10 06 10 02% E5% BC% 80% E5% A7% 8B% EF% BC% 8C00 01 4F 00 27 04% E4% B8% BA% E7% 9B% AE% E7% 9A% 84% E5% 9D% 80% E4% B8% 8EID% E5% 8F% B7% EF% BC% 8C% E7% 8E% B0% E5% 86% 8D% E6% 8E% A5% E7% 9D% 80% E6% 98% AF% E8% BF% 94% E5% 9B% 9E% E7% 9A% 84% E6% 95% B0% E6% 8D% AE% EF% BC% 8C% E6% AF% 8F% E4% B8% A4% E4% B8% AA% E5% AD% 97% E8% 8A% 82% E6% 98% AF% E4% B8% 80% E7% BB% 84% E6% 95% B0% E6% 8D% AE% EF% BC% 9A% E5% A6% 82% E6% 88% 91% E7% 9A% 84PLC% E4% B8% AD% E7% 9A% 84% E5% AE% 9A% E4% B9% 89% E5% A6% 82% E4% B8% 8B% EF% BC% 9A
Tagname address des * ri ption Compressure n7: 68 % E6% 8E% A7% E5% 88% B6% E6% B5% 81% E9% 87% 8F flue_1 n7: 33 1 #% E7% 9E% AC% E6% 97% B6% E6% B5% 81% E9% 87% 8F flue_2 n7: 34 AB PLC% E7% 9A% 84% E6% 95% B0% E6% 8D% AE% E4% BA% 86% E3% 80% 82 % E7% BB% 93% E8% AF% AD % E8% BF% 99% E5% B0% B1% E6% 98% AFAB PLC% E7% 9A% 84% E6% 95% B0% E6% 8D% AE% E5% 8D% 8F% E8% AE% AE% EF% BC% 8C% E7% 94% B1% E4% BA% 8EAB% E7% 9A% 84% E8% AF% B4% E6% 98% 8E% E4% B9% A6% E4% B8% AD% E6% 89% 80% E8% A8% 80% E4% B8% 8D% E8% AF% A6% EF% BC% 8C% E8% 80% 8C% E6% 88% 91% E8% AF% BB% E5% 8F% 96% E7% 9A% 84PLC% E6% 98% AF% E5% 8F% A6% E4% B8% 80% E4% B8% AA% E5% 85% AC% E5% 8F% B8% E5% BC% 80% E5% 8F% 91% E7% 9A% 84% E7% A8% 8B% E5% BA% 8F% EF% BC% 8C% E6% 89% 80% E4% BB% A5% E5% 9C% A8% E6% 95% B0% E6% 8D% AE% E7% 9A% 84% E5% 90% AB% E4% B9% 89% E6% 96% B9% E9% 9D% A2% E8% 8A% B1% E8% B4% B9% E4% BA% 86% E4% B8% 8D% E5% B0% 91% E6% 97% B6% E9% 97% B4% EF% BC% 8C% E8% 80% 8C% E5% 9C% A8% E7% BC% 96% E7% A8% 8B% E6% 96% B9% E9% 9D% A2% E7% 9A% 84% E6% 97% B6% E9% 97% B4% E5% 80% 92% E6% 97% B6% E4% B8% 8D% E5% A4% 9A% E3% 80% 82% E8% BF% 99% E6% AC% A1% E6% 80% BB% E7% BB% 93% E5% 87% BA% E6% 9D% A5% E4% B8% 8E% E5% A4% A7% E5% AE% B6% E5% 85% B1% E4% BA% AB% EF% BC% 8C% E5% BA% 94% E8% 83% BD% E4% BD% BF% E5% A4% A7% E5% AE% B6% E5% 85% 8D% E5% 8E% BB% E6% 91% B8% E7% B4% A2% E4% B9% 8B% E8% 8B% A6% E3% 80% 82