![cvi語言編碼規(guī)范_第1頁](http://file2.renrendoc.com/fileroot_temp3/2021-4/24/b60b504a-c237-4e20-b768-e91bc9860d63/b60b504a-c237-4e20-b768-e91bc9860d631.gif)
![cvi語言編碼規(guī)范_第2頁](http://file2.renrendoc.com/fileroot_temp3/2021-4/24/b60b504a-c237-4e20-b768-e91bc9860d63/b60b504a-c237-4e20-b768-e91bc9860d632.gif)
![cvi語言編碼規(guī)范_第3頁](http://file2.renrendoc.com/fileroot_temp3/2021-4/24/b60b504a-c237-4e20-b768-e91bc9860d63/b60b504a-c237-4e20-b768-e91bc9860d633.gif)
![cvi語言編碼規(guī)范_第4頁](http://file2.renrendoc.com/fileroot_temp3/2021-4/24/b60b504a-c237-4e20-b768-e91bc9860d63/b60b504a-c237-4e20-b768-e91bc9860d634.gif)
![cvi語言編碼規(guī)范_第5頁](http://file2.renrendoc.com/fileroot_temp3/2021-4/24/b60b504a-c237-4e20-b768-e91bc9860d63/b60b504a-c237-4e20-b768-e91bc9860d635.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、精品文檔你我共享 目的:規(guī)范上位機CVI軟件代碼的編寫,提高上位機程序的可讀性和可維護性。 適用范圍:適用于本公司基于 CVI的所有上位機程序。 說明:CVI語言的核心是標準 C;因此本規(guī)范是在 C語言編碼規(guī)范的基礎上,對變量命名,函數(shù)名,函數(shù) 調(diào)用等具體細節(jié)進行了詳細的規(guī)范;其余內(nèi)容基本參照原C語言編碼規(guī)范的規(guī)定。 1、 DLL文件命名 12 13 14 24 34 AAAAAA 通信類 DLL文件的命名,用產(chǎn)品名稱+后綴.DLL的方式命名;女0 AN9651H.DLL AN9632X.DLL;作為 公司代碼前綴的 AN用大寫字母,作為產(chǎn)品系列的后綴H,X,U,P等用大寫字母;對于某一系列產(chǎn)
2、品通 用的DLL文件,產(chǎn)品名稱中相應的位用小寫字母x代替,如 AN97xxx.DLL; AN969xx.DLL等; 2、 C語言的源文件,頭文件,工程文件等的命名,遵照 DLL文件命名的原則。 函數(shù)命名 對查詢類函數(shù),動詞為 對設置類函數(shù),動詞為 3、 對控制類函數(shù),動詞為 對組合類命令,動詞為 函數(shù)返回值 Control ; Comp lex; 如 ControlStart; ControlStop 等等 如 ComplexSetStartReadVoltage 等等; 對通信類DLL函數(shù),返回值為int 意,不是下位機通信返回的錯誤代碼) CodeError Message -1 型,=0
3、,表示函數(shù)執(zhí)行成功,=負值表示相應的通信錯誤代碼 (注 ,錯誤代碼如下表, Unknown system error. Inv alid port nu mber. Port is not open. Unknown I/O error. 通信類DLL文件中,函數(shù)的命名原則為:DLL文件名(沒有后綴)+下劃線 _+函數(shù)功能名 其中函數(shù)功能名為動賓詞組,每個單詞的首字母大寫,其它字母小寫; Read;如 ReadVoltage, ReadCurrent, Read Power 等等 Set ;女0 SetOutVoltage ; SetOutFrequency 等等 Unexp ected in
4、 ternal error. No serial port found. Cannot open p ort. 11 A NULL poin ter was p assed whe n a non-NULL poin ter was exp ected. Out of memory. Un able to allocate system resources. Inv alid p arameter. Inv alid baud rate. Inv alid p arity. Inv alid nu mber of data bits. 精品文檔你我共享 AAAAAA 44 90 91 Inv
5、alid nu mber of stop bits. Bad file han dle. File I/O error. 94 97 99 104 114 124 151 152 180 257 258 259 -260 261 262 263 264 265 269 300 301 302 303 304 -305 402 Inv alid count; must be greater tha n or equal to 0. Inv alid interrupt level. I/O op erati on timed out. Break time must be a p ositive
6、 value. Requested input queue size must be 0 or greater. Requested out put queue size must be 0 or greater. Gen eral I/O error. Buffer p arameter is NULL. Supp orted library could not be loaded. P acket was sent, but no ack no wledgme nt was received. Packet was not sent withi n retry limit. Packet
7、was not received within retry limit. End of tran smissi on character encoun tered whe n start of data character exp ected. Un able to read p acket nu mber. Incon siste nt p acket nu mber. Un able to read p acket data. Un able to read checksum. Checksum received did not match compu ted checksum. P ac
8、ket size exceeds input queue size. Error opening file. Error readi ng file. Did not receive in itial n egative ack no wledgme nt character. Did not receive ack no wledgme nt after end of tran smissi on character was sent. Error writi ng to file. Did not receive either a start of data or end of tran
9、smissi on character whe n exp ected. Tran sfer was can celed because CAN ASCII character was received. 503 504 505 506 507 508 Inv alid start delay. Inv alid maximum nu mber of retries. Inv alid wait p eriod. Inv alid p acket size. Un able to read Cyclical Redu ndancy Check. Cyclical Redundancy Chec
10、k error. -9 =正值表示相應的下位機上傳的錯誤代碼或上位機對通信數(shù)據(jù)解包處理后產(chǎn)生的錯誤代碼,錯誤代碼定 義如下 #defi ne AINUO_COMERR_TIMEOUT / 下位機上傳的錯誤類型 #defi ne AINUO_COMERR_CHECKSUM 0 x01 / 校驗和錯誤 #defi ne AINUO_COMERR_CMDT YP 0 x02 / 命令類型錯誤 #defi ne AINUO_COMERR_CMD 0 x03 / 命令字錯誤 #defi ne AINUO_COMERR_STAT 0 x04 / 狀態(tài)不符 #defi ne AINUO_COMERR_ PA
11、RA 0 x05 / 參數(shù)錯誤 / 上位機接收到的數(shù)據(jù)出錯錯誤類型 #defi ne AINUO_ PCCOMERR_CHECKSUM 0 x11 / 校驗和錯誤 #defi ne AINUO_ PCCOMERR_CMDT YP 0 x12 / 命令類型錯誤 #defi ne AINUO_ PCCOMERR_CMD 0 x13 / 命令字錯誤 #defi ne AINUO_ PCCOMERR_ PACKHEAD 0 x16 / 數(shù)據(jù)頭錯誤 #defi ne AINUO_ PCCOMERR_ PACKTAIL 0 x17 / 數(shù)據(jù)尾錯誤 #defineAINUO PCCOMERR PACKLEN 0 x18 / 數(shù)據(jù)包長度錯誤 4、函數(shù)參數(shù) 示例如下: 輸入?yún)?shù) int32 portNo ;通信端口號 int32 addr ;下位機地址 這兩個參數(shù)一般是必需的; ;設置參數(shù) 輸出參數(shù) double64 *voltage double64 *curre
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 現(xiàn)代家居裝飾風格與心理健康關(guān)系探討
- 構(gòu)建以服務功能為導向的綠色生態(tài)環(huán)境教育體系
- 生物醫(yī)藥與健康產(chǎn)業(yè)的投資潛力研究
- 現(xiàn)代化技術(shù)與醫(yī)療中心的高層建筑設計思考
- 生態(tài)城市建設中環(huán)境科學的應用研究
- Unit 5 We're family Period 3 (說課稿)-2024-2025學年外研版(三起)(2024)英語三年級上冊
- 2024-2025學年高中生物 第四部分 淺嘗現(xiàn)代生物技術(shù)說課稿 浙科版選修1
- 2024-2025學年高中物理 第四章 電磁感應 5 電磁感應現(xiàn)象的兩類情況(1)說課稿 新人教版選修3-2
- 9古代科技 耀我中華-獨領(lǐng)風騷的古代技術(shù)創(chuàng)造(說課稿)2023-2024學年統(tǒng)編版道德與法治五年級上冊
- 26 手術(shù)臺就是陣地 說課稿-2024-2025學年統(tǒng)編版語文三年級上冊001
- 2025版茅臺酒出口業(yè)務代理及銷售合同模板4篇
- 2025年N1叉車司機考試試題(附答案)
- 《醫(yī)院財務分析報告》課件
- 2024年考研政治試題及答案
- 2024-2025學年人教版數(shù)學六年級上冊 期末綜合卷(含答案)
- 天津市部分區(qū)2023-2024學年高二上學期期末考試 物理 含解析
- 2025年初級社會工作者綜合能力全國考試題庫(含答案)
- 2024年濰坊護理職業(yè)學院單招職業(yè)適應性測試題庫附答案
- 《鉗工基本知識》課件
- 第八期:風電典型事故案例剖析(二)
- DB63T 2357-2024 ?;烦簝薨踩芾硪?guī)范
評論
0/150
提交評論