Author Sean Hsu Version 1.0.1 Date 2012/10/26 Page 1/5 Q: 如何利用特定 timer 實現即時性的動作? 適用於 : 平台 OS 版本 XPAC utility 版本 XPAC 系列 所有版本皆適用 Note1 Note1: 和 utility 沒有任何無關. 使用哪種計時器 (timer) 來達到即時性 (Real-Time)? 使用多媒體計時器 (Multimedia Timer) 來實現即時性 (Real-Time). 多媒體計時器 (Multimedia Timer) 函數 : (1).timeBeginPeriod (2).timeEndPeriod (3).timeKillEvent (4).timeSetEvent, (5).TimeProc 為什麼選擇多媒體計時器 (Multimedia Timer) 來實現即時性 (Real-Time)? 因為其它種計時器 (timer) 無法調整優先權, 因此無法實現即時性 (Real-Time) 的要求. 多媒體計時器 (Multimedia Timer) 優先權 (Priority) 的輸入範圍為何? 優先權數值的輸入範圍是 8 到 256. 如何使用多媒體計時器 (Multimedia Timer)? 我們提供三種程式語言的 demo(c sharp, VB.net, VC++) 來教導使用者如何使用多媒體計時器 (Multimedia Timer). 1. VC++ demo
Author Sean Hsu Version 1.0.1 Date 2012/10/26 Page 2/5 2. C sharp demo 因為在 compact framework 中沒有提供多媒體計時器 (Multimedia Timer) 可以使用, 所以我們提供一個外部 mmtimer.dll 來提供多媒體計時器 (Multimedia Timer). Note: 請務必要將 mmtimer.dll 和執行檔放在同一資料夾中. 3. VB.net demo 因為在 compact framework 中沒有提供多媒體計時器 (Multimedia Timer) 可以使用, 所以我們提供一個外部 mmtimer.dll 來提供多媒體計時器 (Multimedia Timer). Note: 請務必要將 mmtimer.dll 和執行檔放在同一資料夾中.
Author Sean Hsu Version 1.0.1 Date 2012/10/26 Page 3/5 Demo 下載位置 : C sharp: http://ftp.icpdas.com/pub/cd/xpac-atom-ce6/demo/xpac/c%23/standard/readtimetest_timesetevent/ VC++: http://ftp.icpdas.com/pub/cd/xp-8000-ce6/demo/xpac/vc2008/standard/realtimetest/ VB.net: http://ftp.icpdas.com/pub/cd/xp-8000-ce6/demo/xpac/vb.net/standard/readtimetest_timesetevent/ Timer 效能實測測試平台 :XP-8000-Atom-CE6,OS 版本為 1.0.0.2 測試模組 :I-8054W( 隔離 ) 測試條件 : 1. XP-8000-Atom-CE6 皆執行下列程式使 CPU Loading 達到 100% 持續在 \temp 對 text.txt 寫入資料 FTP : 使用程式對 WP-8x4x 的 FTP Server 進行上傳和下載的動作 TCPMP 播放影片 2. Real-time timer 之 priority 設為 50 測試方法 : 將 I-8054W 任一 DO 通道連接至示波器 執行 C# 或 VC real-time timer 程式, 設定 timer 的 interval 值, 按下啟動鍵 將示波器顯示功能設定為無限持續, 連續記錄 12 小時波型 可以取得此波型的抖動時間 此時間即為系統響應的誤差時間 ( 愈小表示即時能力越好 ) 使用 C# 測試程式間隔時間 (Time Interval): 2 ms 抖動時間 (Jitter) : 280 μs
Author Sean Hsu Version 1.0.1 Date 2012/10/26 Page 4/5 測試結果 使用 VC 測試程式間隔時間 (Time Interval): 2 ms 抖動時間 (Jitter) : 140 μs
Author Cid Version 1.0.1 Date 2011/9/20 Page 5/5 資料參考何謂即時性 (Real-Time)? 請參考以下連結說明. http://en.wikipedia.org/wiki/windows_ce http://blogs.msdn.com/b/mikehall/archive/2005/07/27/443924.aspx http://msdn.microsoft.com/en-us/library/ms836535.aspx Read-Time API 說明 http://msdn.microsoft.com/en-us/library/ee483451%28winembedded.60%29.aspx 2. 基本術語 Interrupt An interrupt is a Hardware signal indicates that a real-world event has occurred The corresponding hardware device needs to be serviced by the computer system in some way. Latency Latency describes the time from when the interrupt occurred to when the hardware begins to be serviced. Jitter Jitter defines the range of allowable variations in service times, and is usually defined by the tolerance of a mechanical system for variability in the response. 請參考以下連結說明. ftp://ftp.icpdas.com/pub/cd/xp-8000-ce6/document/faq/performance_report/x8-01_interrupt_performance_en.pdf ftp://ftp.icpdas.com/pub/cd/xpac-atom-ce6/document/faq/performance_report/x8-01_interrupt_performance_en.pdf