EzProg-I Getting Started (Version 4.0) W-8x8x GM1 控制器 EzProg-I Getting Started V 4.0 1
Warranty All products manufactured by ICPDAS Inc. are warranted against defective materials for a period of one year from the date of delivery to the original purchaser. Warning ICPDAS Inc. assumes no liability for damages consequent to the use of this product. ICPDAS Inc. reserves the right to change this manual at any time without notice. The information furnished by ICPDAS Inc. is believed to be accurate and reliable. However, no responsibility is assumed by ICPDAS Inc. for its use, or for any infringements of patents or other rights of third parties resulting from its use. Copyright Copyright 1997-2008 by ICPDAS Inc., LTD. All rights reserved worldwide. Trademark The names used for identification only maybe registered trademarks of their respective companies. License The user can use, modify and backup this software on a single machine. The user may not reproduce, transfer or distribute this software, or any copy, in whole or in part. EzProg-I Getting Started V 4.0 2
目錄 1 介紹與設置... 4 1.1 簡介...4 1.2 硬體規格...5 1.3 外觀尺寸...6 1.4 軟體包裝...12 1.5 硬體包裝...13 1.6 系統架構...14 1.7 應用架構...15 2 設定 WINCON 系統... 16 2.1 Windows CE 的設定...16 2.2 增加其他控制功能...18 3 安裝 EZPROG-I 在 PC 的開發環境... 19 3.1 安裝 PC 端開發環境...19 3.2 安裝 WinCon_MA 平臺與開發資源...19 3.3 安裝 EzProg-I 開發資源 ( 範例 )...21 3.4 工程開發手冊...24 4 實作簡單的 EZPROG-I 應用程式範例... 25 4.1 利用 EzConfig 做 IO 規劃...26 4.2 程式引用 EzCore.h 及 EzCore.lib...29 4.3 程式引用 HMI 物件...30 4.4 HMI 物件畫面控制設計...33 4.5 專案 EzCore 啟始與測試...35 EzProg-I Getting Started V 4.0 3
1 介紹與設置 歡迎使用本手冊 EzpProg-I_Getting Started_4.0tc.pdf, 泓格所提供的這本手冊, 將協助新的使用者, 能快速的 install硬體和軟體 1.1 簡介 WinCon 主要的硬體描述如下圖, 其中包括了 VGA USB Mouse Keyboard, Compact Flash COM Port Ethernet 和基本的 I/O 插槽介面 圖中是 W-8781-GM1 硬體的樣本,15 pin VGA port 是電腦螢幕標準介面, 並且能配合 USB 或 RS232 支援觸控螢幕 COM2 是標準 5 線 RS232 通訊埠,COM3 是標準的 RS485 通訊埠, 亦可以利用標準 Ethernet 連接網路設備 EzProg-I Getting Started V 4.0 4
1.2 硬體規格 W-8381-GM1 Processor xscale PXA-270 CPU, 520MHz Operating System Windows CE 5.0 Multiple Booting Selection Flash/CF/USB disk SDRAM Flash 64M bytes 32M bytes W-8781-GM1 FRAM Storage Interface Ethernet Port COM 2 COM 3 Additional Serial Port Default Function 128K bytes 1 x Compact Flash type II insert with ejector; 1G/512M 2x USB1.1, 1 x VGA port 1 x RJ45, 10/100BaseT 9-pin D-Sub (RS-232) 2-wire Terminal Block (RS-485) N/A 64-bit hardware unique serial number Reset button Power LEDs Watchdog Timer Real Time Clock I/O Expansion Slot 3 7 Operating Temp. -25 C to +75 C ( Depends on I/O modules) Storage Temp. -30 C to +85 C Humidity 5~95% Power Supply 20W, Unregulated +10Vdc to +30Vdc Dimensions (LxHxD)(mm) 230.25x110x93.8 354.26x110x93.8 EzProg-I Getting Started V 4.0 5
1.3 外觀尺寸 3 slots : EzProg-I Getting Started V 4.0 6
EzProg-I Getting Started V 4.0 7
EzProg-I Getting Started V 4.0 8
7 slots : EzProg-I Getting Started V 4.0 9
EzProg-I Getting Started V 4.0 10
EzProg-I Getting Started V 4.0 11
1.4 軟體包裝 EzProg-I Software Package API : 1. EzSDK: Wincon 函式庫請參考手冊 W-8x8x EVC++ SDK 1.0.pdf 請參考手冊 W-8x8x Getting Started 1.0.pdf 2. EzLIB: Easy functions for evc++ 請參考手冊 EzLIB_API_4.0tc.pdf 3. EzMotion: i8092 i8094 i8094h 函式庫 請參考手冊 i8092f_manual_2.3tc.pdf 請參考手冊 i8092f_getting_started_2.2tc.pdf 請參考手冊 i8094_manual_2.3tc.pdf 請參考手冊 i8094_getting_started_2.3tc.pdf 請參考手冊 i8094h_manual_1.3tc.pdf 請參考手冊 i8094h_getting_started_1.2tc.pdf 4. EzCore: Easy logic control,dio AIO FRnet IO 請參考手冊 EzCore_API_4.0tc.pdf EzProg-I Getting Started V 4.0 12
TOOL : 1. EzHMI: ActiveX for evc++ 2. EzConfig: Configuration Tool for DIO AIO 3. EzGo: Configuration Utility for Motion 4. EzMake: Tool for i8094h 請參考手冊 EzProg-I_Tool_4.0tc.pdf APPLICATION : 1. HMI: 人機操作畫面 2. Logic: 機電整合丙級試題 3. Motion: 泓格 MA-Kit展示機請參考手冊 EzProg-I_Basic_Training_3.0tc.pdf EzProg-I_Advanced_Training_2.3tc.pdf 請參考手冊如有更新版本, 請以最新版本為主 1.5 硬體包裝 One set of WinCon-8781 GM1 hardware One Compact Flash card for storing system files. One software utility CD EzProg-I Getting Started V 4.0 13
1.6 系統架構 下圖為 EzProg-I 整體系統架構, 從硬體到作業系統及相關工具之相互關係, 而組成完整架構, 詳細運作資訊請參考相關手冊, 及 ICPDAS 提供相關教育訓練課程 EzProg-I Getting Started V 4.0 14
1.7 應用架構 下圖為 EzProg-I 整體軟體系統開發架結構, 從人機界面到即時系統, 規劃及測試工具整合運作, 最後由 evc++ 統籌開發環境編譯為一應用程序, 詳細資訊請參考相關手冊, 及教育訓練課程 EzProg-I Getting Started V 4.0 15
2 設定 WinCon 系統 在這個章節將介紹設定 WinCon 的一些工具, 你可以使用控制台改變系統時間或網路的設定, 及一些關於 WinCE 的設置 對於泓格所提供的 WinCon Utility 和 CfgTool 的工具, 亦能讓你對 WinCon 做更詳細的設定及調整 2.1 Windows CE 的設定 設定新的日期或時間, 如下的步驟 : 1. 選擇 開始 設定 (S) 控制台 (C), 去開啟控制台的對話框 2. 雙擊 日期 / 時間 icon, 打開內容對話框 3. 完成修改日期或時間後, 點擊 套用 (A) 按紐 注意 : 如果你在 WinCon 上有做任何設定的改變, 就必需要使用 WinCon Utility 去對 registry 做設定改變的儲存 相關的訊息可以參考 WinCon Utility 的章節 EzProg-I Getting Started V 4.0 16
網路的設定, 如下的步驟 : 通常我們不需要再去改變網路的設定, 因為 DHCP已經有預設值了, 但是如果你的網路系統沒有 DHCP 伺服器, 那就必需用手動的方式去調整設定值 1. 選擇 開始 設定 (S) 網路和撥號連線 (N), 去開啟連線設定的對話框 2. 雙擊 ETH11 icon, 打開 Ethernet Adapter 設定對話框 3. 選擇 指定 IP 位址 (S), 設定 IP 位址 (A) 子網路遮罩(U) 預設閘道(G), 注意這個設定必須要可以與 PC 網路連線為原則 4. 選擇 名稱伺服器 Tab, 並且設定主要 DNS(D) 次要 DNS(N) 5. 點擊 OK 按紐 EzProg-I Getting Started V 4.0 17
2.2 增加其他控制功能 增加人機控制畫面, 可以加入 EzHMI (ICPDAS ActiveX for evc++) 控件 增加簡易邏輯控制, 並以 EzConfig 工具完成 DIO AIO 的基本設定 增加運動控制功能, 可以配合 EzGo 和 EzMake 工具, 簡易完成運動控制設置 工具軟體的使用, 請參考手冊 EzProg-I_Tool_4.0tc.pdf 各類範例應用程式, 請參考手冊 EzProg-I_Basic_Training_3.0tc.pdf EzProg-I_Advanced_Training_2.3tc.pdf EzProg-I Getting Started V 4.0 18
3 安裝 EzProg-I 在 PC 的開發環境 3.1 安裝 PC 端開發環境 PC 端主要使用者微軟 evc++4.0 為主要開發環境, 您可以先到微軟網站下載及安裝 evc++4.0 及相關必要之環境及補丁 (Service Pack 4) 3.2 安裝 WinCon_MA 平臺與開發資源 EzProg-I API 包含如下項目的組成 : EzSDK: WinconSDK.DLL WinconSDK.LIB xxxxx.h (WinCon SDK include files) EzLIB: EzLIB.LIB EzLIB_D.LIB EzLIB.H EzMotion: i8092.dll i8092.h i8094.dll i8094.h i8094h.dll i8094h.h EzCore: EzCore.DLL EzCore.H Step-by-Step 安裝 EzProg-I API 步驟 : 請插入 EzProg-I 安裝光碟到你的光碟機然後執行 WINCON_MA_SDK_YYYYMMDD.msi 本手冊發行時之最近版本為 :WINCON_MA_SDK_20070625.msi 最後成功安裝如下軟體 : 1. 函式庫安裝在 PC 路徑下 : \Program Files\Windows CE Tools\wce500\W8x8xGM1\Lib\ARMV4I WinconSDK.lib UARTCE.lib I7000CE.lib Modbus_ARM.lib EzCore.lib EzLIB.lib EzLIB_D.lib i8048_dll.lib i8092.lib i8094.lib i8094h.lib EzProg-I Getting Started V 4.0 19
2. 含括檔安裝在 PC 路徑 : \Program Files\Windows CE Tools\wce500\W8x8xGM1\Include\Armv4i WinconSDK.h WinCon.h UARTCE.h Uart.h I7000CE.h I7000.h I8000.h I87000.h Modbus_ARM.h EzCore.h EzLIB.h i8017h.h i8024.h i8080.h i8090.h i8091.h i8092.h i8094.h i8094h.h EzProg-I Getting Started V 4.0 20
3.3 安裝 EzProg-I 開發資源 ( 範例 ) PC 端主安裝 ICPDAS 提供之 EzPRog-I 的安裝包, 執行 SETUP.exe 後預設安裝路徑為 C:\ICPDAS\EzProg-I, 其中包括下列三個主要目錄 C:\ICPDAS\EZPROG-I Manuals EzProg-I 相關使用手冊 OCX PC 端 EzHMI 物件 Samples 範例程序 Sample1 WinCon 標準範例程序 87K_Inside_Slot_Demo Ai_ao_demo Di_do_demo I8080demo I8090demo I8091demo Remote_comport_demo Sample2 EzProg-I 範例程序 BMP EzProg-I 範例程序 ICPDAS.BMP 檔 EzDEMO1_Start EzDEMO2_RTSR EzDEMO3_AES EzDEMO4_USER EzDEMO5_Interrupt EzDEMO6_DataChange EzDEMO7_CDC EzDEMOA_8092F_Interrupt i8092f Motion 中斷處理範例程序 EzDEMOA_8094F_Interrupt i8094f Motion 中斷處理範例程序 EzDEMOA_8094H_Interrupt i8094h Motion 中斷處理範例程序 Sample3 Motion 範例程序 i8092(f) demo_all demo_start First_demo i8094(f) demo_all demo_start First_demo EzProg-I Getting Started V 4.0 21
EzProg-I 範例程序說明如下 : DEMO 名稱 DEMO 目標 DEMO 使用內容 EzDEMO1_ 建立一新的 #include "EzCore.h" Start EzProg-I 應用專案 EzCore.lib DEVICE_INITIAL() SCAN_ENGINE_START() ColorLable+ MSG 0= "# EzCore start ENGINE OK!!" EzDEMO2_ RTSR " 定時執行 " 程序的設定, 啟動, 停止 TSR_RUN() SET_RTSR() START_RTSR() STOP_RTSR() by ButtonST OUT_Y(0) = IN_Xa(0) Label Display D(0) EzDEMO3_ AES 金鑰, 註冊碼檢查註冊 REGISTRY_KEY(); CHECK_KEY(); COLOR EDIT INPUT REGISTRY_KEY ButtonST REGISTRY_KEY,and check KEY ColorLable+ MSG 0= message display EzDEMO4_ USER " 使用者自定 " 程序的設定, 啟動, 停止 USER_RUN() START_USER_THREAD() END_USER_THREAD() ColorLable+ MSG 0= message display ColorLable+ D 0= display RTSR Get data ColorLable+ D 1= display User RUN Count ButtonST USER RUN Start,and Stop EzDEMO5_ Interrupt "DI 中斷執行 " 程序的設定, 啟動, 停止 SET_INT(); START_INT(); STOP_INT(); EzProg-I Getting Started V 4.0 22
EzDEMO6_ DataChange EzLIB 資料轉換陣列與 File IO TSR_RUN() SET_RTSR() START_RTSR() ButtonST *3 OUT_Y(0) = IN_Xa(0) ColorLable+ MSG 0= " " Label Display D(0) EzLIB EzDEMO7_ CDC EzLIB CDC 繪圖 BMP File IO Output to Printer RTSR USER_RUN() START_USER_THREAD() END_USER_THREAD() ColorLable+ MSG 0= message display ColorLable+ D 0= display RTSR Get data ButtonST *9 ButtonST USER RUN Start,and Stop EzLIB,EzBMP EzDEMOA_8092F_Interrupt EzCore and Motion Interrupt demo for i8092f RTSR void INTP_MOTION(WORD MINTTable) ColorLable(MSG 1,2) display MSG ColorLable(D 1,2,3)= display Interrupt data ButtonST *3 ButtonST interrupt Start,and Stop ColorRadio select interrupt type EzDEMOA_8094F_Interrupt EzCore and Motion Interrupt demo for i8094f RTSR void INTP_MOTION(WORD MINTTable) ColorLable(MSG 1,2) display MSG ColorLable(D 1,2,3)= display Interrupt data ButtonST *3 ButtonST interrupt Start,and Stop ColorRadio select interrupt type EzDEMOA_8094H_Interrupt EzCore and Motion Interrupt demo for i809h RTSR void INTP_MOTION(WORD MINTTable) ColorLable(MSG 1,2) display MSG ColorLable(D 1,2,3)= display Interrupt data ButtonST *4 ButtonST interrupt Start,and Stop EzProg-I Getting Started V 4.0 23
3.4 工程開發手冊 安裝完成後會在 開始 => 程式集 => ICPDAS 中建立相關捷徑如下圖 : EzProg-I Getting Started V 4.0 24
4 實作簡單的 EzProg-I 應用程式範例 本章將要帶領您作一簡單的 DIO 應用, 請建立一名為 EzDemo 新專案如下圖 : 硬體為 W-8331-GM1 及 i8077-g DIO 模組插入第一槽中如下圖 : EzProg-I Getting Started V 4.0 25
4.1 利用 EzConfig 做 IO 規劃 從 開始 => 程式集 中啟動 EzConfig 如下圖: 按右上角 SCAN Slot1~7 按鈕開始自動掃瞄 IO 模組 按 是:開始 如下圖: EzProg-I Getting Started V 4.0 26
SCAN 完成後如下圖: 點選 i8077 圖即可看到目前規劃情形 X 0~7 Y 0~7 如下圖: 可以觀查 DI X 輸入狀態及按按鈕(Y1,Y3..)測試 DO 控制 按 OK 離開 EzProg-I Getting Started V 4.0 27
做完簡易規劃完成後按右上第三個按鈕儲存規劃設定資訊 再按 EXIT 離開 EzConfig EzProg-I Getting Started V 4.0 28
4.2 程式引用 EzCore.h 及 EzCore.lib 在專案主要程式 EzDemoDlg.cpp 檔頭加入 #include "EzCore.h" 宣告如下圖 : 選擇專案 Project => Setting 出現 Project Setting 對話框如下 : EzProg-I Getting Started V 4.0 29
4.3 程式引用 HMI 物件 選擇專案 Project => Add To Project => Components and Contros 如下 出現 Components and Contros Gallery 對話框我們選擇 LED 再按 Insert 及選擇 Switch 再按 Insert 加入專案 : EzProg-I Getting Started V 4.0 30
如果您是第一次使用會看不到任何物件, 請按下圖的 Add Control 出現下面對話框 : EzProg-I Getting Started V 4.0 31
請選擇到 C:\ICPDAS\EzProg-I\OCX\ 位置選擇要用的 OCX 檔, 後按開啟即可加入, 並重複此動作加入所有的 OCX 檔為止如下圖 加入所有 OCX 到專案後, 切換到畫面設計頁面就可以看到新增 EzHMI 物件如下圖 : EzProg-I Getting Started V 4.0 32
4.4 HMI 物件畫面控制設計 選擇 LED 物件, 用滑鼠拉到適當位置放下, 並用滑鼠在 LED 上按右鍵在下拉式選單中選擇 Properties 如下圖 :Flash Timer 輸入 2,Select X/Y/M 選擇 RealDI X,X/Y/M LED 輸入 0 後關閉 EzProg-I Getting Started V 4.0 33
以同步驟加入 Switch 物件 : 如下圖 :Switch Type 選 SWTCH TOGGLE, Y/M Enable 打勾,Select Y/M 選擇 RealDO Y,Switch(on/off) 輸入 0 後關閉 如此即完成簡單 2 物件加入與設定 EzCore 聯結關係 EzProg-I Getting Started V 4.0 34
4.5 專案 EzCore 啟始與測試 在我們的主對話框啟始的 OnInitDialog() 中加入 EzCore 啟動程式如下 : long ret; ret=device_initial(output_now, 0, RUN_PRG_MODE); if (ret == _NO_ERROR) { ret= SCAN_ENGINE_START(); if (ret == _NO_ERROR) { SET_M(200, true); //System initial ok } else MessageBox( TEXT("Start ENGINE NG \n Please check "), TEXT("EzCore Engine"), MB_OK MB_ICONERROR); } else { MessageBox( TEXT("Load ALL Device Data NG \n Please check \n Please Rescan IO "), TEXT("EzCore Engine"), MB_OK MB_ICONERROR); } 如下圖 : EzProg-I Getting Started V 4.0 35
按熱鍵 F5 連線下載執行 :( 請先確認網路設定是正確的 ) 如果沒有其他異常, 在 WinCon 畫面出現如下對執行畫面, 你可以看到 LED 輸入 i8077 X 0 狀態, 你也可以按 Switch 改變 i8077 Y 0 輸出狀態 如此即完成一簡單的控制程式 詳細程式碼請參考範例程式 EzProg-I Getting Started V 4.0 36