TW201242263A - A Modbus CRC check code generation method - Google Patents

A Modbus CRC check code generation method Download PDF

Info

Publication number
TW201242263A
TW201242263A TW100112049A TW100112049A TW201242263A TW 201242263 A TW201242263 A TW 201242263A TW 100112049 A TW100112049 A TW 100112049A TW 100112049 A TW100112049 A TW 100112049A TW 201242263 A TW201242263 A TW 201242263A
Authority
TW
Taiwan
Prior art keywords
crc
modbus
check code
input data
value
Prior art date
Application number
TW100112049A
Other languages
Chinese (zh)
Other versions
TWI445320B (en
Inventor
Hsin-Kai Liao
Chang-Kao Chen
Ting-Chia Ou
Original Assignee
Iner Aec Executive Yuan
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Iner Aec Executive Yuan filed Critical Iner Aec Executive Yuan
Priority to TW100112049A priority Critical patent/TWI445320B/en
Publication of TW201242263A publication Critical patent/TW201242263A/en
Application granted granted Critical
Publication of TWI445320B publication Critical patent/TWI445320B/en

Links

Abstract

A Modbus CRC check code generation method, in particular, applying in controller communication systems used in various facilities. For any length of input data, the method can generate a set of Modbus CRC-16 check code and can be directly written to the controller communication system of the facilities. Allowing the signal transmitted to the controller through the generator disposed in a time period in order to improve the overall accuracy and reliability of data transmission.

Description

201242263 六、發明說明: 【發明所屬之技術領域】 一種Modbus CRC檢驗碼產生方法,特別是應用於各 種設施控制器通訊系統,例如核能級控制器之通訊系統。 【先前技術】 在工廠自動化系統,例如核電廢、製造業或石化廠, 在訊息交換或傳輸過程之正確性對安全運行環節的要求非 常重要’因此網路之通訊過程必須提供貫行檢測網路錯誤 之驗證功能,當故障發生時,須通知相對應之可編程邏輯 控制器,以便採取適當之行動,網路之通訊。201242263 VI. Description of the Invention: [Technical Field of the Invention] A Modbus CRC check code generation method is especially applied to various facility controller communication systems, such as a communication system of a nuclear energy level controller. [Prior Art] In factory automation systems, such as nuclear power waste, manufacturing or petrochemical plants, the correctness of the information exchange or transmission process is very important to the requirements of the safe operation. Therefore, the network communication process must provide a continuous inspection network. The error verification function, when the failure occurs, must notify the corresponding programmable logic controller in order to take appropriate action, network communication.

Modbus協議是自動化行業的一個共同協議,在1970 年代末,最初之設計為了一個序列線路協議,然而在自動 化行業,目前已成為一個現存標準,且使用在所有智慧自 動化設備中一個常規介面。 CRC普遍使用於錯誤檢查技術,對於被傳輸數據系統 之間或是在處理功能之晶片中。傳統硬體CRC的產生器, 一般而言是一個固定長度之多項式,這些硬體CRC的產生 器,只能使用一個CRC的方程式來計算一個CRC校驗碼。 單一 CRC方程式可適用於單一應用的特定設備。然而,單 一 CRC方程式無法針對所有類型的數據提供錯誤檢查之 能力。使用一個以上的CRC方程式可能需要多個CRC產 生器的開發工具,每個CRC產生器需由一個硬體來實現, 這個解決方案是不合乎需要的,因為額外的電晶體必須增 201242263 加了電路的規模和晶片的成本。 本發明利用軟體之方式自動產生硬體描述語言戶斤需之 Modbus CRC-16格式’即產生後之格式可應用於核能級控 制器之通訊系統設計中。 【發明内容】 為解決使用一個以上的CRC方程式可能需要多個 CRC產生器的開發工具,每個CRC產生器需由一個硬體來 實現之問題,本發明提出一種Modbus CRC檢驗碼產生方 法’可針對任意輸入資料長度產生一組Modbus CRC-16檢 驗碼。 本發明提出一種Modbus CRC檢驗碼產生方法,包含 下列步驟: A) 計算輸入資料長度(d),並將輸入資料長度(d)除以 8以得到一迴圈次數,其中該輸入資料長度(d)最小為8位 元; B) 定義一資料矩陣 m = [m(8*d)m(8*d-l)m(8*d-2) m(3) m(2) m(l)]用以儲存輸入資料,其中m(j)係為輪入資 料第j個位元之值; C) 疋義一檢驗碼矩陣crc = [cl6 cl5 cl4…c3 c2 cl] 用以儲存Modbus CRC-16檢驗碼; D) 定義一迴圈計數器⑴,並令i=l; E) 令 crc = [crc([l:8]) ,其中,,·*,,代表矩陣兩元素 201242263 所在位置相乘: F) 計算 cl = crc(9)*crc(10)*crc(ll)*crc(12)*crc(13) *crc(14)* *crc(15) *crc(16) , c2 = crc(10)*crc(ll)*crc(12)*crc(13) *crc(14)* crc(15) *crc(16) , c3 = crc(9)*crc(10) , c4 = crc(10)*crc(ll) , c5 = crc(ll)*crc(12) , c6 = crc(12)*crc(13) , c7 = crc(13)*crc(14) , c8 = crc(14)*crc(15) , c9 = crc(l)*crc(15)*crc(16) , clO = crc(2)*crc(16) , ell = crc(3) ,cl2 = crc(4) ,cl3 = crc(5) ,cl4 = crc(6) ,cl5 = crc(7) 5 cl6 = crc(8)* crc(9)*crc(10)*crc(ll)*crc(12)*crc(13) *crc(14)* *crc(15) *crc(16),其中 crc(k)係為 Modbus CRC-16檢驗碼之第k個位元之值; G) 檢查迴圈計數器(i)之值是否小於d/8,若是,則將 i之值加l(i=i+l),並回到步驟E),若否,則進行下一步驟; H) 將計算之結果輸出為一 Modbus CRC-16檔案; I) 將該 Modbus CRC-16 按照 Modbus CRC-16 之規則 進行轉換與排序,即可得到一 Modbus CRC-16格式之硬體 描述語言。 藉由本發明所提出之Modbus CRC檢驗碼產生方法產 生出之Modbus CRC-16檢驗碼,可直接寫入各種設施控制 器之通訊系統中,使控制器所傳送之訊號能夠透過該產生 器在一個時間週期處理完畢,以提高整體資料傳遞之正確 性與可靠度。 【實施方式】 201242263 以下將參照隨附之圖式來描述本發明為達成目的所使 用的技術手段與功效,而以下圖式所列舉之實施例僅為輔 助說明’以利貴審查委員瞭解,但本案之技術手段並不限 於所列舉圖式。 再請參閱圖一所示,一種Modbus CRC檢驗碼產生方 法流程圖,包含下列步驟: 首先進行步驟20,計算輸入資料長度(d),並將輸入資 料長度(d)除以8以得到一迴圈次數,其中該輸入資料長度 ⑹最小為8位元; 步驟21 ’定義一資料矩陣m = [m(8*d) m(8*d-l) m(8*d-2) ... m(3) m(2) m⑴]用以儲存輸入資料,其中m⑴ 係為輸入資料第j個位元之值; 步驟22,定義一檢驗碼矩陣crc = [c 16 c 15 c 14 ... c3 c2 cl]用以儲存Modbus CRC-16檢驗碼; 步驟23,定義一迴圈計數器(i),並令i=l ; 步驟 24 , 令 crc = [crc([l :8]) crc([9:16]).*m([l+(i-l)*8:i*8])],其中代表矩陣兩元素 所在位置相乘: 步驟 25 , 計算 cl = crc(9)*crc(10)*crc(ll)*crc(12)*crc(13) *crc(14)* *crc(15) *crc(16) » c2 = crc(10)*crc(ll)*crc(12)*crc(13) *crc(14)* crc(15) *crc(16) ’ c3 = crc(9)*crc(10) ’ c4 = crc(10)*crc(ll), c5 = crc(ll)*crc(12) , c6 = crc(12)*crc(13) , c7 = crc(13)*crc(14) , c8 = crc(14)*crc(15) , c9 = 6 201242263 crc(l)*crc(15)*crc(16) ,clO = crc(2)*crc(16) ,ell = crc(3) ,cl2 = crc(4) ’ cl3 = crc(5) ’ cl4 = crc(6) ,cl5 = crc(7),cl6 = crc(8)* crc(9)*crc(10)*crc(ll)*crc(12)*crc(13) *crc(14)* *crc(15) *crc(16),其中 crc(k)係為 Modbus CRC-16檢驗碼之第k個位元之值; 步驟26 ’檢查迴圈計數器(i)之值是否小於d/8,若是, 則將i之值加l(i=i+l) ’並回到步驟24,若否,則進行下 一步驟; 步驟27,將計算之結果輸出為一 Modbus CRC-16檔案; 步驟 28,將該 Modbus CRC-16 按照 Modbus CRC-16 之規則進行轉換與排序,即可得到一 Modbus CRC-16格式 之硬體描述語言。 步驟29,將該Modbus CRC-16格式之硬體描述語言寫 入一設施控制器中。 該Modbus CRC-16格式之硬體描述語言可寫入各種設 施控制器(例如核能級控制器)之通訊系統中,以供使用。 再請參閱表一所示’表一係為一 Modbus CRC-16檢驗 碼運算方法,其中m係為儲存輪入資料陣列之變數,m(j) 係為資料陣列中第j個位元之值,CIX係為儲存Modbus CRC-16檢驗碼陣列之變數,crc(k)係為M〇dbus CRC_l6 檢驗碼第k位元之值,i係為第丨次迴圈,d係為輸入資料 之位元數’由式(1)運算至式(17)為一迴圈。 以資料長度為32位元為例,迴圈次數為32除以8等 於4,設定i等於1,計算式(” ’將計算之結果儲入erc矩 201242263 陣各相對應之暫存器中,隨後計算式(2)至式(Π) ’以得到 crc陣列中各元素([cl6 cl5…c2 cl])之值,即完成第1次 迴圈,接著依序設定i等於2、3、4並重複計算式(1)至式 (17)。 再§青參閱圖*一所不’係為Modbus CRC檢驗碼產生方 法應用於核能級控制器之通訊系統示意圖,首先輸入任意 資料長度’經由Modbus CRC-16檢驗碼程式運算後輸出一 Modbus CRC-16檢驗碼,接著將該Modbus CRC-16檢驗碼 轉換為硬體描述語言之格式,寫入一核能級控制系統中, 當有特定資料位元輸入該核能級控制系統時,則可輸出特 定資料位元及一特定Modbus CRC-16檢驗碼。 惟以上所述者,僅為本發明之實施例而已,當不能以 之限定本發明所實施之範圍。即大凡依本發明權利要求所 作之均等變化與修飾,皆應仍屬於本發明專利涵蓋之範圍 内’謹請貴審查委員明鑑,並祈惠准,是所至禱。 201242263 le n giK( m) 表一係為Modbus CRC-16檢驗碼運算方法 crc=[crc([l:8]) crc([ ?: 1 6]). *m([ l+(i-l)*8:i *8]) cl=crc(9)*crc(10)*crc(ll)*crc(12)*crc(13)*crc(14)*crc(15)*crc(16) 02=^0(10)^0(11)^0(12)^:-0(13) :Kcrc(14)*crc(15)*crc〇6) c3=crc(9)*crc(10) ¢4=^0(10)^0^(11) 0 5=^0(11)^0(12) c6=crc(12)*crcC13) c7=crc(13)*crc(14) c8=crc(14)*crc(15) c 9==crc(l)*crc(l 5) ^crcC 16) c 1 〇=crc(2)木crc(l 6) c 1 l=crc(3) c 12=crc(4) cl3»crc(5) c 14=crc(6) cl5=crc(7) c!6=crc(8)st:crcC9):4:crc(10):Kcrc(ll)i*=crc(l 2)*^(13)^(14)^〇(15)^〇(16) 表二係為參數對應表 d 代在输入费饵的也元政 m 代在该存钕八资科陣列的變软 m(〇 代袅第丨I元的贲料哞列中的值 i 代畚若迴囹執行次陝 crc 代在铉存crc檢驗碼陣列的费敗 crc(x) 代在第X仅元的cic松盼珥的资既 代在铕入資钭的長度 NJ. \J^ ) \Iy SJ» V—/ \—^ SI/ XI/ Λ1/ NJ. 1 2 3 4 6 7 8 9 o 1 2 4 5 6 7 /l\ ^fv xiv /l\ /—IN /f\ ^(\ /l\ /IV 11 n 11 <1 11 li in 11 /IV c- iv /l\ c c, /IV c. 201242263 【圖式簡單說明】 圖一係為Modbus CRC檢驗碼產生方法流程圖 圖二係為Modbus CRC檢驗碼產生方法應用於核能級控制 器之通訊系統示意圖 【主要元件符號說明】 20〜28流程圖 10The Modbus protocol is a common protocol for the automation industry. It was originally designed as a serial line protocol in the late 1970s. However, in the automation industry, it has now become an existing standard and is used in a conventional interface in all intelligent automation devices. CRC is commonly used in error checking techniques for between data systems being transferred or between processing functions. The traditional hardware CRC generator is generally a fixed length polynomial. These hardware CRC generators can only use a CRC equation to calculate a CRC. A single CRC equation can be applied to a specific device for a single application. However, the single CRC equation does not provide the ability to detect errors for all types of data. Using more than one CRC equation may require multiple CRC generator development tools. Each CRC generator needs to be implemented by a single hardware. This solution is undesirable because additional transistors must be added to 201242263 plus circuitry. The size and cost of the wafer. The invention automatically generates the Modbus CRC-16 format of the hardware description language by means of software. The generated format can be applied to the communication system design of the nuclear energy level controller. SUMMARY OF THE INVENTION In order to solve the problem that multiple CRC generators may be required to use more than one CRC equation, each CRC generator needs to be implemented by one hardware. The present invention proposes a Modbus CRC check code generation method. A set of Modbus CRC-16 check codes is generated for any input data length. The invention provides a Modbus CRC check code generating method, which comprises the following steps: A) calculating the input data length (d), and dividing the input data length (d) by 8 to obtain a loop number, wherein the input data length (d) ) is a minimum of 8 bits; B) defines a data matrix m = [m(8*d)m(8*dl)m(8*d-2) m(3) m(2) m(l)] To store the input data, where m(j) is the value of the jth bit of the rounded data; C) 疋义一检码矩阵rcc = [cl6 cl5 cl4...c3 c2 cl] to store the Modbus CRC-16 check code D) Define a loop counter (1) and let i=l; E) Let crc = [crc([l:8]) , where, ··,,, represent the position of the matrix two elements 201242263: F) Calculate cl = crc(9)*crc(10)*crc(ll)*crc(12)*crc(13) *crc(14)* *crc(15) *crc(16) , c2 = crc(10) *crc(ll)*crc(12)*crc(13) *crc(14)* crc(15) *crc(16) , c3 = crc(9)*crc(10) , c4 = crc(10)* Crc(ll) , c5 = crc(ll)*crc(12) , c6 = crc(12)*crc(13) , c7 = crc(13)*crc(14) , c8 = crc(14)*crc( 15) , c9 = crc(l)*crc(15)*crc(16) , clO = crc(2)*crc(16) , ell = crc(3) , cl2 = crc( 4), cl3 = crc(5) , cl4 = crc(6) , cl5 = crc(7) 5 cl6 = crc(8)* crc(9)*crc(10)*crc(ll)*crc(12) *crc(13) *crc(14)* *crc(15) *crc(16), where crc(k) is the value of the kth bit of the Modbus CRC-16 check code; G) Check the loop counter Whether the value of (i) is less than d/8, and if so, add the value of i to l (i=i+l) and return to step E). If not, proceed to the next step; H) the result of the calculation The output is a Modbus CRC-16 file; I) The Modbus CRC-16 is converted and sorted according to the rules of Modbus CRC-16 to obtain a hardware description language in Modbus CRC-16 format. The Modbus CRC-16 check code generated by the Modbus CRC check code generating method proposed by the present invention can be directly written into the communication system of various facility controllers, so that the signal transmitted by the controller can pass through the generator at a time. The cycle is processed to improve the accuracy and reliability of the overall data transmission. [Embodiment] 201242263 Hereinafter, the technical means and effects of the present invention for achieving the object will be described with reference to the accompanying drawings, and the embodiments listed in the following drawings are merely for the purpose of explanation. The technical means are not limited to the illustrated figures. Referring to FIG. 1 again, a flow chart of a Modbus CRC check code generation method includes the following steps: First, step 20 is performed to calculate the input data length (d), and the input data length (d) is divided by 8 to obtain a back. The number of times, where the length of the input data (6) is a minimum of 8 bits; Step 21 'Define a data matrix m = [m(8*d) m(8*dl) m(8*d-2) ... m( 3) m(2) m(1)] is used to store the input data, where m(1) is the value of the jth bit of the input data; step 22, defining a check code matrix crc = [c 16 c 15 c 14 ... c3 c2 Cl] is used to store the Modbus CRC-16 check code; Step 23, define a loop counter (i), and let i = l; Step 24, let crc = [crc([l:8]) crc([9: 16]).*m([l+(il)*8:i*8])], where the two elements of the matrix are multiplied: Step 25, calculate cl = crc(9)*crc(10)*crc( Ll)*crc(12)*crc(13) *crc(14)* *crc(15) *crc(16) » c2 = crc(10)*crc(ll)*crc(12)*crc(13) *crc(14)* crc(15) *crc(16) ' c3 = crc(9)*crc(10) ' c4 = crc(10)*crc(ll), c5 = crc(ll)*crc(12 ), c6 = crc(12)*crc(13) , c7 = crc(13)*crc(14) , c8 = crc(14)*crc(15) , c9 = 6 201242263 crc(l)*crc(15)*crc(16) ,clO = crc(2)*crc(16) ,ell = crc(3) ,cl2 = crc(4) ' cl3 = crc(5) ' cl4 = crc(6) , cl5 = crc(7), cl6 = crc(8)* crc(9)*crc(10)*crc(ll)*crc (12) *crc(13) *crc(14)* *crc(15) *crc(16), where crc(k) is the value of the kth bit of the Modbus CRC-16 check code; Step 26 ' Check if the value of the loop counter (i) is less than d/8, and if so, add the value of i to l (i=i+l) ' and return to step 24, if not, proceed to the next step; The result of the calculation is output as a Modbus CRC-16 file; Step 28, the Modbus CRC-16 is converted and sorted according to the rules of Modbus CRC-16, and a hardware description language of Modbus CRC-16 format is obtained. In step 29, the hardware description language of the Modbus CRC-16 format is written into a facility controller. The hardware description language of the Modbus CRC-16 format can be written into the communication system of various device controllers (such as nuclear energy level controllers) for use. Referring again to Table 1, the table 1 is a Modbus CRC-16 check code operation method, where m is the variable storing the wheeled data array, and m(j) is the value of the jth bit in the data array. CIX is the variable that stores the Modbus CRC-16 check code array. crc(k) is the value of the kth bit of the M〇dbus CRC_l6 check code, i is the third round, and d is the input data. The number 'from equation (1) to equation (17) is a loop. Taking the data length as 32 bits as an example, the number of loops is 32 divided by 8 equals 4, and i is set to 1. The calculation formula (" 'stores the result of the calculation into the corresponding register of the erc moment 201242263 array. Then calculate the formula (2) to (Π) ' to get the value of each element ([cl6 cl5...c2 cl]) in the crc array, that is, complete the first loop, and then sequentially set i equal to 2, 3, 4 And repeat the calculation formula (1) to (17). § 青青see Figure * One is not a Modbus CRC check code generation method applied to the nuclear power level controller communication system schematic, first enter any data length 'via Modbus The CRC-16 check code program outputs a Modbus CRC-16 check code, and then converts the Modbus CRC-16 check code into a hardware description language format, which is written into a core energy level control system, when there is a specific data bit. When the core level control system is input, a specific data bit and a specific Modbus CRC-16 check code may be output. However, the above is only an embodiment of the present invention, and the present invention cannot be limited thereto. Scope, that is, according to the claims of the present invention Such changes and modifications should still fall within the scope of the patent of the invention. 'Please ask your reviewer to give a clear explanation and pray for it. It is the prayer. 201242263 le n giK( m) Table 1 is Modbus CRC-16 test Code operation method crc=[crc([l:8]) crc([ ?: 1 6]). *m([ l+(il)*8:i *8]) cl=crc(9)*crc(10 )*crc(ll)*crc(12)*crc(13)*crc(14)*crc(15)*crc(16) 02=^0(10)^0(11)^0(12)^: -0(13) :Kcrc(14)*crc(15)*crc〇6) c3=crc(9)*crc(10) ¢4=^0(10)^0^(11) 0 5=^0 (11)^0(12) c6=crc(12)*crcC13) c7=crc(13)*crc(14) c8=crc(14)*crc(15) c 9==crc(l)*crc( l 5) ^crcC 16) c 1 〇=crc(2) wood crc(l 6) c 1 l=crc(3) c 12=crc(4) cl3»crc(5) c 14=crc(6) cl5 =crc(7) c!6=crc(8)st:crcC9):4:crc(10):Kcrc(ll)i*=crc(l 2)*^(13)^(14)^〇(15 )^〇(16) Table 2 is the parameter correspondence table d generation in the input fee bait also Yuanzheng m generation in the storage of the eight-funded array of softening m (〇代袅第丨元元 哞 哞 哞The value i in the 畚 畚 囹 囹 囹 囹 囹 陕 c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c NJ. \J^ ) \Iy SJ» V—/ \—^ SI/ XI/ Λ1/ NJ. 1 2 3 4 6 7 8 9 o 1 2 4 5 6 7 /l\ ^fv xiv /l\ /—IN /f\ ^(\ / l\ /IV 11 n 11 <1 11 li in 11 /IV c- iv /l\ cc, /IV c. 201242263 [Simple diagram of the diagram] Figure 1 is the flow chart of the Modbus CRC check code generation method Schematic diagram of the communication system for the Modbus CRC check code generation method applied to the nuclear energy level controller [Main component symbol description] 20~28 flowchart 10

Claims (1)

201242263 七、申請專利範圍: 1.一種Modbus CRC檢驗碼產生方法,包含下列步驟: A) 計算輸入資料長度(d),並將輸入資料長度(d)除以 8以得到一迴圈次數,其中該輸入資料長度(d)最小為8位 元; B) 定義一資料矩陣 m = [m(8*d)m(8*d-l)m(8*d-2)... m(3) m(2) m(l)]用以儲存輸入資料,其中m⑴係為輪入資 料第j個位元之值; C) 定義一檢驗碼矩陣crc = [cl6 cl5 cl4…c3 c2 cl] 用以儲存Modbus CRC-16檢驗碼; D) 定義一迴圈計數器⑴,並令i=l ; E) 令 crc = [crc([l:8]) crc([9:16]).*m([l+(i-l)*8:i*8])],其中代表矩陣兩元素 所在位置相乘: F) 計算 cl = crc(9)*crc(10)*crc(ll)*crc(12)*crc(13) *crc(14)* *crc(l5) *crc(l6) ’ c2 = crc(10)*crc(ll)*crc(12)*crc(13) *crc(14)* crc(15) *crc(16) , c3 = crc(9)*crc(10) , c4 = crc(10)*crc(ll) , c5 = crc(ll)*crc(12) , c6 = crc(12)*crc(l3) , c7 = crc(13)*crc(14) , c8 = crc(14)*crc(15) ’ c9 = crc(l)*crc(l5)*crc(16) 5 clO = crc(2)*crc(l6) 5 cl 1 = crc(3) ,cl2 = crc(4) ,cl3 = crc(5) ,cl4 = crc(6) ,cl5 = crc(7) »cl6 = crc(8)* crc(9)*crc(10)*crc(ll)*crc(12)*crc(13) *crc(14)* *crc(15) *crc(16),其中 crc(k)係為 Modbus 11 201242263 CRC-16檢驗碼之第k個位元之值; G) 檢查迴圈計數器⑴之值是否小於d/8,若是,則將 i之值加l(i=i+l),並回到步驟E),若否,則進行下一步驟; H) 將計算之結果輸出為一 Modbus CRC-16播案。· 2. 如申請專利範圍第1項所述之一種Modbus CRC檢驗碼 產生方法,其中在步驟H)之後更包含有一步驟I)將該 Modbus CRC_16按照Modbus CRC-16之規則進行轉換與排 序’即可得到一 Modbus CRC-16格式之硬體描述語言。 3. 如申請專利範圍第2項所述之一種Modbus CRC檢驗碼 產生方法,其中在步驟H)之後更包含有一步驟j)將該 Modbus CRC_16格式之硬體描述語言寫入一設施控制器 中。 4. 如申請專利範圍第3項所述之一種Modbus CRC檢驗碼 產生方法,其中該設施控制器為一核能級控制器。 5. 如申睛專利範圍第3項所述之一種Modbus CRC檢驗碼 產生方法,其中該設施控制器為一核能級控制器之通訊系 統。 12201242263 VII. Patent application scope: 1. A Modbus CRC check code generation method, including the following steps: A) Calculate the input data length (d), and divide the input data length (d) by 8 to get a loop number. The input data length (d) is a minimum of 8 bits; B) Define a data matrix m = [m(8*d)m(8*dl)m(8*d-2)... m(3) m (2) m(l)] is used to store the input data, where m(1) is the value of the jth bit of the rounded data; C) define a check code matrix crc = [cl6 cl5 cl4...c3 c2 cl] for storage Modbus CRC-16 check code; D) Define a loop counter (1) and let i=l ; E) Let crc = [crc([l:8]) crc([9:16]).*m([l+ (il)*8:i*8])], which multiplies the position of the two elements of the matrix: F) computes cl = crc(9)*crc(10)*crc(ll)*crc(12)*crc( 13) *crc(14)* *crc(l5) *crc(l6) ' c2 = crc(10)*crc(ll)*crc(12)*crc(13) *crc(14)* crc(15) *crc(16) , c3 = crc(9)*crc(10) , c4 = crc(10)*crc(ll) , c5 = crc(ll)*crc(12) , c6 = crc(12)*crc (l3) , c7 = crc(13)*crc(14) , c8 = crc(14)*crc(15) ' c9 = crc(l)*crc(l5)*crc(16) 5 clO = crc(2)*crc(l6) 5 cl 1 = crc(3) , cl2 = crc(4) , cl3 = crc(5) , cl4 = crc(6) , cl5 = crc(7) »cl6 = Crc(8)* crc(9)*crc(10)*crc(ll)*crc(12)*crc(13) *crc(14)* *crc(15) *crc(16), where crc(k ) is the value of the kth bit of the Modbus 11 201242263 CRC-16 check code; G) Check if the value of the loop counter (1) is less than d/8, and if so, add the value of i to l (i=i+l ), and return to step E), if not, proceed to the next step; H) output the result of the calculation as a Modbus CRC-16 broadcast. 2. A method for generating a Modbus CRC check code according to claim 1, wherein after step H), there is further included a step I) converting and sorting the Modbus CRC_16 according to the rules of Modbus CRC-16. A hardware description language in Modbus CRC-16 format is available. 3. A Modbus CRC check code generating method according to claim 2, wherein after step H), there is further included a step j) writing the hardware description language of the Modbus CRC_16 format into a facility controller. 4. A method of generating a Modbus CRC check code according to claim 3, wherein the facility controller is a nuclear energy level controller. 5. A method of generating a Modbus CRC check code according to claim 3, wherein the facility controller is a communication system of a nuclear energy level controller. 12
TW100112049A 2011-04-07 2011-04-07 A modbus crc check code generation method TWI445320B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW100112049A TWI445320B (en) 2011-04-07 2011-04-07 A modbus crc check code generation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW100112049A TWI445320B (en) 2011-04-07 2011-04-07 A modbus crc check code generation method

Publications (2)

Publication Number Publication Date
TW201242263A true TW201242263A (en) 2012-10-16
TWI445320B TWI445320B (en) 2014-07-11

Family

ID=47600272

Family Applications (1)

Application Number Title Priority Date Filing Date
TW100112049A TWI445320B (en) 2011-04-07 2011-04-07 A modbus crc check code generation method

Country Status (1)

Country Link
TW (1) TWI445320B (en)

Also Published As

Publication number Publication date
TWI445320B (en) 2014-07-11

Similar Documents

Publication Publication Date Title
Holzmann The model checker SPIN
JP2017033562A (en) System and method for model based technology and process for safety-critical software development
US20130067437A1 (en) Providing SystemVerilog Testing Harness for a Standardized Testing Language
CN105320806B (en) Method for summarizing nuclear power process pipeline material by combining PML (polymethylene diamine) with Excel-VBA (Excel-VBA) processing data
Yoo et al. A verification framework for FBD based software in nuclear power plants
CN105868106A (en) An ultrasonic apparatus reliability testing method and testing system
CN102201022A (en) Method and device for checking field programmable gate array (FPGA)
CN109635300A (en) Data verification method and device
CN103150441A (en) Software and hardware synergic simulation verification platform and construction method thereof
CN103995778A (en) Script file generation method and device based on event and action
CN109299193A (en) Method of data synchronization and relevant device
CN107480056A (en) A kind of method for testing software and device
CN108572912A (en) A kind of continuous integrating method, apparatus, electronic equipment and storage medium
Singh et al. Modeling and prediction of performability of safety critical computer based systems using Petri nets
US20050223281A1 (en) Transaction logging and intelligent error reporting in an expectation-based memory agent checker
TW201242263A (en) A Modbus CRC check code generation method
Cui et al. Unifying modeling and simulation based on uml timing diagram and uppaal
Basit ur Rahim et al. Translating activity diagram from duration calculus for modeling of real-time systems and its formal verification using UPPAAL and DiVinE
Ambrosio et al. Designing fault injection experiments using state-based model to test a space software
Björkman et al. Verification of safety logic designs by model checking
CN105470949A (en) Power distribution network reliability evaluation method considering complex transfer supply
Jeong et al. VIS analyzer: A visual assistant for VIS verification and analysis
Homma et al. Using the model checker spin for web application design
Edwards Process algebras for protocol validation and analysis
CN114840178B (en) Process file generation method, device and equipment based on digital simulation platform

Legal Events

Date Code Title Description
MM4A Annulment or lapse of patent due to non-payment of fees