信捷-TouchWinc函數(shù)功能塊用戶手冊
聲明:您必須遵守我們的協(xié)議,如果您下載了該資源行為將被視為對《電天下賬號(hào)管理規(guī)范》全部內(nèi)容的認(rèn)可,本網(wǎng)站資源來自原創(chuàng),僅供用于學(xué)習(xí)和交流,請勿用于商業(yè)用途。如有侵權(quán)、不妥之處,請舉報(bào)本資源,我們將及時(shí)審核處理!
信捷-TouchWinc函數(shù)功能塊用戶手冊
TouchWin中簡單的命令新添C函數(shù)功能塊,使人機(jī)界面可以完成更多、更復(fù)雜的運(yùn)算和通訊要求。
文本預(yù)覽
TouchWin
C 函數(shù)功能塊
用戶手冊
無錫信捷電氣股份有限公司
資料編號(hào):HC 10 20150108 2.D目 錄
前言................................................................................................................................................... 1
1 函數(shù)功能塊介紹 ........................................................................................................................... 2
1.1 函數(shù)功能塊運(yùn)行環(huán)境 ....................................................................................................... 2
1.2 函數(shù)功能塊制作 ............................................................................................................... 2
1.3 函數(shù)功能塊編譯 ............................................................................................................... 3
1.4 函數(shù)功能塊運(yùn)行 ............................................................................................................... 5
2 函數(shù)功能塊說明 .......................................................................................................................... 7
2.1 書寫方式 ........................................................................................................................... 7
2.2 函數(shù)類型 ........................................................................................................................... 7
2.3 預(yù)定義數(shù)據(jù)類型 ............................................................................................................... 8
2.4 預(yù)定義宏指令 ................................................................................................................... 9
2.5 系統(tǒng)函數(shù) ........................................................................................................................... 9
2.5.1 Read/ Write .............................................................................................................. 9
2.5.2 Reads/Writes ............................................................................................................ 9
2.5.3 Enter/ Leave ........................................................................................................... 10
2.5.4 Send ........................................................................................................................ 10
2.5.5 Receive ................................................................................................................... 10
2.5.6 Malloc .................................................................................................................... 11
2.5.7 Free ......................................................................................................................... 11
2.5.8 Delay ...................................................................................................................... 11
2.5.9 ScreenJump ............................................................................................................ 11
2.5.10 OpenWindow ....................................................................................................... 11
2.5.11 CloseWindow ....................................................................................................... 12
2.5.12 Beep ..................................................................................................................... 12
2.5.13 WakeScreen.......................................................................................................... 12
2.5.14 Crc ........................................................................................................................ 12
2.5.15 Crc16 .................................................................................................................... 12
2.5.16 Lock/Unlock ......................................................................................................... 13
2.5.17 Word_2_Int16 ...................................................................................................... 13
2.5.18 Word_2_Int32 ...................................................................................................... 13
2.5.19 DWord_2_Int32 ................................................................................................... 13
2.5.20 DWord_2_Float .................................................................................................... 13
2.5.21 Int16_2_Word ...................................................................................................... 13
2.5.22 Int32_2_Word ...................................................................................................... 13
2.5.23 Int32_2_DWord ................................................................................................... 14
2.5.24 Float_2_DWord .................................................................................................... 14
2.5.25 DCMapSetBackColor .......................................................................................... 14
2.5.26 DCMapDrawLine ................................................................................................. 14
2.5.27 DCMapDrawRect ................................................................................................. 15
2.5.28 DCMapDrawCircle .............................................................................................. 15
2.5.29 DCMapDrawEllipse ............................................................................................. 162.5.30 DCMapDrawCircleArc ........................................................................................ 17
2.5.31 DCMapDrawEllipseArc ....................................................................................... 17
2.5.32 DCMapClear ........................................................................................................ 18
2.6 宏操作 ............................................................................................................................. 19
2.6.1 Max ........................................................................................................................ 19
2.6.2 Min ......................................................................................................................... 19
2.6.3 MAKEWORD ........................................................................................................ 19
2.6.4 MAKEDWORD ..................................................................................................... 19
2.6.5 LOBYTE ................................................................................................................ 19
2.6.6 HIBYTE ................................................................................................................. 19
2.6.7 LOWORD .............................................................................................................. 20
2.6.8 HIWORD ............................................................................................................... 20
2.7 C語言常見庫函數(shù) .......................................................................................................... 20
2.7.1 abs .......................................................................................................................... 20
2.7.2 acos、asin、atan .................................................................................................... 20
2.7.3 cos、sin、tan ......................................................................................................... 20
2.7.4 log........................................................................................................................... 21
2.7.5 log10 ....................................................................................................................... 21
2.7.6 pow ......................................................................................................................... 21
2.7.7 sqrt .......................................................................................................................... 21
2.7.8 rand ......................................................................................................................... 21
2.8 觸摸屏內(nèi)部對象(PSW、PFW、PSB) ........................................................................... 22
2.8.1 PSW對象 .............................................................................................................. 22
2.8.2 PSB對象 ................................................................................................................ 22
2.8.3 PFW對象 .............................................................................................................. 23
2.9 PLC外部對象元件D、Y…讀寫 ..................................................................................... 23
3 工程示例 .................................................................................................................................... 25
3.1 數(shù)據(jù)比較 ......................................................................................................................... 25
3.2 自由通訊 ......................................................................................................................... 27
3.3 四則運(yùn)算 ......................................................................................................................... 30
3.4 函數(shù)畫布 ......................................................................................................................... 34
4 常見問題 .................................................................................................................................... 38
4.1 如何對正在編輯C功能函數(shù)程序進(jìn)行編譯? ............................................................. 38
4.2 如何在C功能函數(shù)塊中讀取PLC參數(shù)值或者寫入PLC參數(shù)值? ............................. 38
4.3 使用Read、Write、Reads、Writes函數(shù)快捷方法? ............................................... 38
4.4 函數(shù)功能塊在線模擬時(shí)為什么不能執(zhí)行? ................................................................. 39
4.5 Read函數(shù)和Reads有什么區(qū)別? ................................................................................ 39
4.6 函數(shù)功能塊與標(biāo)準(zhǔn)的C語言有什么區(qū)別? ................................................................. 39
附錄1 C標(biāo)準(zhǔn)庫函數(shù)的調(diào)用限制 ................................................................................................. 40
附錄2 C函數(shù)使用注意事項(xiàng) ......................................................................................................... 41TouchWin C函數(shù)功能塊用戶手冊
前言
相較于人機(jī)界面軟件 TouchWin 中簡單的工程命令、高級功能指令,新添加的 C 函數(shù)功能塊,
使人機(jī)界面可以完成更多、更復(fù)雜的運(yùn)算和通訊要求,使系統(tǒng)功能得到了更大限度的發(fā)揮,更好地
滿足客戶的實(shí)際需求。
本書通過介紹C指令以及結(jié)合一些簡單的示例來說明關(guān)于C函數(shù)功能的使用方法,因此在介紹
中只使用了一些簡單易懂的C函數(shù)知識(shí),主要目的是讓客戶找到了解這個(gè)功能,知道一些基本的書
寫規(guī)則,了解在使用過程中的一些注意事項(xiàng)。信捷人機(jī)界面軟件 TouchWin 支持 C 語言的多數(shù)函數(shù)
庫,詳細(xì)的函數(shù)使用請參考C語言相關(guān)教材或通過網(wǎng)站查詢學(xué)習(xí)C語言的使用。
1TouchWin C函數(shù)功能塊用戶手冊
1
函數(shù)功能塊介紹
1.1 函數(shù)功能塊運(yùn)行環(huán)境
函數(shù)功能塊一定要下載程序到人界面中才能正常運(yùn)行,不支持在線模擬和離線模擬。
1.2 函數(shù)功能塊制作
人機(jī)界面軟件要求V2.C.6及以上,所用軟件版本可以單擊“幫助”菜單下“關(guān)于”查看。創(chuàng)建
C 函數(shù)功能塊
用戶手冊
無錫信捷電氣股份有限公司
資料編號(hào):HC 10 20150108 2.D目 錄
前言................................................................................................................................................... 1
1 函數(shù)功能塊介紹 ........................................................................................................................... 2
1.1 函數(shù)功能塊運(yùn)行環(huán)境 ....................................................................................................... 2
1.2 函數(shù)功能塊制作 ............................................................................................................... 2
1.3 函數(shù)功能塊編譯 ............................................................................................................... 3
1.4 函數(shù)功能塊運(yùn)行 ............................................................................................................... 5
2 函數(shù)功能塊說明 .......................................................................................................................... 7
2.1 書寫方式 ........................................................................................................................... 7
2.2 函數(shù)類型 ........................................................................................................................... 7
2.3 預(yù)定義數(shù)據(jù)類型 ............................................................................................................... 8
2.4 預(yù)定義宏指令 ................................................................................................................... 9
2.5 系統(tǒng)函數(shù) ........................................................................................................................... 9
2.5.1 Read/ Write .............................................................................................................. 9
2.5.2 Reads/Writes ............................................................................................................ 9
2.5.3 Enter/ Leave ........................................................................................................... 10
2.5.4 Send ........................................................................................................................ 10
2.5.5 Receive ................................................................................................................... 10
2.5.6 Malloc .................................................................................................................... 11
2.5.7 Free ......................................................................................................................... 11
2.5.8 Delay ...................................................................................................................... 11
2.5.9 ScreenJump ............................................................................................................ 11
2.5.10 OpenWindow ....................................................................................................... 11
2.5.11 CloseWindow ....................................................................................................... 12
2.5.12 Beep ..................................................................................................................... 12
2.5.13 WakeScreen.......................................................................................................... 12
2.5.14 Crc ........................................................................................................................ 12
2.5.15 Crc16 .................................................................................................................... 12
2.5.16 Lock/Unlock ......................................................................................................... 13
2.5.17 Word_2_Int16 ...................................................................................................... 13
2.5.18 Word_2_Int32 ...................................................................................................... 13
2.5.19 DWord_2_Int32 ................................................................................................... 13
2.5.20 DWord_2_Float .................................................................................................... 13
2.5.21 Int16_2_Word ...................................................................................................... 13
2.5.22 Int32_2_Word ...................................................................................................... 13
2.5.23 Int32_2_DWord ................................................................................................... 14
2.5.24 Float_2_DWord .................................................................................................... 14
2.5.25 DCMapSetBackColor .......................................................................................... 14
2.5.26 DCMapDrawLine ................................................................................................. 14
2.5.27 DCMapDrawRect ................................................................................................. 15
2.5.28 DCMapDrawCircle .............................................................................................. 15
2.5.29 DCMapDrawEllipse ............................................................................................. 162.5.30 DCMapDrawCircleArc ........................................................................................ 17
2.5.31 DCMapDrawEllipseArc ....................................................................................... 17
2.5.32 DCMapClear ........................................................................................................ 18
2.6 宏操作 ............................................................................................................................. 19
2.6.1 Max ........................................................................................................................ 19
2.6.2 Min ......................................................................................................................... 19
2.6.3 MAKEWORD ........................................................................................................ 19
2.6.4 MAKEDWORD ..................................................................................................... 19
2.6.5 LOBYTE ................................................................................................................ 19
2.6.6 HIBYTE ................................................................................................................. 19
2.6.7 LOWORD .............................................................................................................. 20
2.6.8 HIWORD ............................................................................................................... 20
2.7 C語言常見庫函數(shù) .......................................................................................................... 20
2.7.1 abs .......................................................................................................................... 20
2.7.2 acos、asin、atan .................................................................................................... 20
2.7.3 cos、sin、tan ......................................................................................................... 20
2.7.4 log........................................................................................................................... 21
2.7.5 log10 ....................................................................................................................... 21
2.7.6 pow ......................................................................................................................... 21
2.7.7 sqrt .......................................................................................................................... 21
2.7.8 rand ......................................................................................................................... 21
2.8 觸摸屏內(nèi)部對象(PSW、PFW、PSB) ........................................................................... 22
2.8.1 PSW對象 .............................................................................................................. 22
2.8.2 PSB對象 ................................................................................................................ 22
2.8.3 PFW對象 .............................................................................................................. 23
2.9 PLC外部對象元件D、Y…讀寫 ..................................................................................... 23
3 工程示例 .................................................................................................................................... 25
3.1 數(shù)據(jù)比較 ......................................................................................................................... 25
3.2 自由通訊 ......................................................................................................................... 27
3.3 四則運(yùn)算 ......................................................................................................................... 30
3.4 函數(shù)畫布 ......................................................................................................................... 34
4 常見問題 .................................................................................................................................... 38
4.1 如何對正在編輯C功能函數(shù)程序進(jìn)行編譯? ............................................................. 38
4.2 如何在C功能函數(shù)塊中讀取PLC參數(shù)值或者寫入PLC參數(shù)值? ............................. 38
4.3 使用Read、Write、Reads、Writes函數(shù)快捷方法? ............................................... 38
4.4 函數(shù)功能塊在線模擬時(shí)為什么不能執(zhí)行? ................................................................. 39
4.5 Read函數(shù)和Reads有什么區(qū)別? ................................................................................ 39
4.6 函數(shù)功能塊與標(biāo)準(zhǔn)的C語言有什么區(qū)別? ................................................................. 39
附錄1 C標(biāo)準(zhǔn)庫函數(shù)的調(diào)用限制 ................................................................................................. 40
附錄2 C函數(shù)使用注意事項(xiàng) ......................................................................................................... 41TouchWin C函數(shù)功能塊用戶手冊
前言
相較于人機(jī)界面軟件 TouchWin 中簡單的工程命令、高級功能指令,新添加的 C 函數(shù)功能塊,
使人機(jī)界面可以完成更多、更復(fù)雜的運(yùn)算和通訊要求,使系統(tǒng)功能得到了更大限度的發(fā)揮,更好地
滿足客戶的實(shí)際需求。
本書通過介紹C指令以及結(jié)合一些簡單的示例來說明關(guān)于C函數(shù)功能的使用方法,因此在介紹
中只使用了一些簡單易懂的C函數(shù)知識(shí),主要目的是讓客戶找到了解這個(gè)功能,知道一些基本的書
寫規(guī)則,了解在使用過程中的一些注意事項(xiàng)。信捷人機(jī)界面軟件 TouchWin 支持 C 語言的多數(shù)函數(shù)
庫,詳細(xì)的函數(shù)使用請參考C語言相關(guān)教材或通過網(wǎng)站查詢學(xué)習(xí)C語言的使用。
1TouchWin C函數(shù)功能塊用戶手冊
1
函數(shù)功能塊介紹
1.1 函數(shù)功能塊運(yùn)行環(huán)境
函數(shù)功能塊一定要下載程序到人界面中才能正常運(yùn)行,不支持在線模擬和離線模擬。
1.2 函數(shù)功能塊制作
人機(jī)界面軟件要求V2.C.6及以上,所用軟件版本可以單擊“幫助”菜單下“關(guān)于”查看。創(chuàng)建