


通訊命令讀取數據的起始地址,占用四字節,由16位二進制代碼轉換而成,這16位被分成四組,并轉換成相應的ASCII碼,如讀取的起始地址為0100,則(6)為30H,(7)為31H,(8)為30H,(9)為30H;
f、 通訊中連續讀取數據的數量,占用一字節,表明上位機要連續讀取多少個參數,取值范圍為“0"(30H)~“9"(39H),多一次讀取10個數據;
g、 通訊數據,字節數量取決于寫數據的數量,數據總以“,"(2CH),數據項與數據項之間不需要任何分隔符,數據的長度主要取決于第(10)的數值,每一個數據項由16為二進制代碼組成(1個字),每4為被分成一個數據單元,同時每個數據單元又被轉換成ASCII數據,當(5)為“R"讀命令時,該項沒有;
h、 數據發送結束符,占用一字節,“:"(3AH),所有數據和命令在此位之前都已發送完成;
i、 BCC塊校驗,占用兩字節,這里采用Xor方式,BCC校驗數據被分成高4位和低4位,并被轉換成ASCII碼,當校驗碼錯誤,儀表將沒有響應,設有如下的發送數據,其BCC計算方式如下:
例:STX 0 2 1 R 0 1 0 0 0 EXT 6 A CR
(30H)?(32H)?(31H)?(52H)?(30H)?(31H)?(30H)?(30H)?(30H) =6AH
BCC校驗結果 ⒀:"6"=36H ⒁:"A"=41H
j、 回車符,一字節,CR(0DH)
B、 儀表應答格式從上面的通訊幀格式可以看出,與上位機發送幀基本一致,的區別在e、應答代碼,兩字節,由8位二進制代碼轉換而來,這8位被分成高4位和低4位,并轉換成相應的ASCII碼,可以通過查詢應答代碼表來檢查錯誤。
3、 軟件實現方法
要通過CP340通訊模塊同SR93系列溫控儀表之間的通訊,PLC程序的設計也是一個比較重要的環節,其主要包括CP340發送讀取數據命令程序、CP340發送寫數據命令程序、CP340接收儀表數據通訊程序以及對讀取到的數據進行處理的程序。is shown in figure 1. In figure, FX2N-32is A RELAY-TYPE PLC with 16 input/output points each. It is a new generation of micro-PLC with excellent performance in Mitsubishi Plc. . It has a wide AC input (85 ~ 264VAC) , a processing speed of 0.08 s/basic instruction and an 8K step memory (Ram) , and in the process of running can change the program, with real-time clock, with timing function and can be time control. The input point uses the PLC internal power supply, greatly simplified the circuit. The output is supplied by 24Vdc to the load of indicator lamp and relay. 3 realization of interlock control system 3.1 definition i/o table according to interlock system i/o signal, the definition of PLC i/o allocation table as table 2. At the same time, the system time is introduced for the newly added First Accident Record. Table 2 is an important basis for future program development and maintenance. And the agreement to meet the interlocking logic definition is 1, interlocking is 1 or 0 by the actual signal connection decision. In Table 2i/o allocation table 2, x 1 ~ X 17 is the input point, 11 points, and Y 0 ~ Y 17 is the output point, 16 points. Among them, Y13 ~ Y17 is used for the internal indicator light of the first accident record. 3.2 the program design system is developed with the MELSEC-F special software package provided by Mitsubishi Corporation. The software package is a program development tool based on Windows and powerful Mitsubishi FX series Plc. It is easy to operate and learn, can Be written directly using the ladder diagram and statement table, and both easy to switch. At the same time you can read/write on-line, loading and downloading procedures, online modification, monitoring and debugging procedures, greatly improving programming efficiency, shorten the development and debugging time. The interlock program of P201/3 high speed booster pump is 210 steps long. The following is a description of the key processing methods and points to be noted in program design. When there is an input signal, the T200 timer (time base is 10ms) carries on the 50ms time-delay filter processing, uses the intermediate variable M10 to replace the input signal x 2. This method improves the anti-jamming ability of the system to the input signal. Because the scanning speed of PLC is very fast, it is necessary to increase the filtering function properly. (3) high speed pump interlock logic handling high speed pump start and stop interlock logic (part) as shown in figure 4[4] . In order to ensure the correctness and readability of the program, the following steps






所有評論僅代表網友意見,與本站立場無關。