LPT Status Register Interrupt Trigger |
尚未結案
|
ray24
中階會員 ![]() ![]() ![]() 發表:18 回覆:88 積分:56 註冊:2002-07-24 發送簡訊給我 |
|
conundrum
尊榮會員 ![]() ![]() ![]() ![]() ![]() ![]() 發表:893 回覆:1272 積分:643 註冊:2004-01-06 發送簡訊給我 |
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=70017 http://www.vcomsoft.com/infopage/LPTPORT.html
CONTENTS I. INTRODUCTION II. Using The LPTPORT.DLL in C III. Using the LPTPORT.DLL in Visual Basic 5-6 IV. BIOS Memory Mapped I/O regions INTRODUCTION LPTPORT.DLL is a 32 bit, user configurable dynamic link library created to afford the developer power and control over low level LPT and COM port hardware . This DLL was written in C and gives the Visual Basic, C Developer an application Interface to Read and Write LPT and COM Port Registers. The LPTPORT library provides full R/W access to LPT and COM Port Byte, Status and Control registers. LPTPORT can be used to automatically detect and open default LPT, COM Ports as well as BIOS memory mapped I/O devices which will greatly reduce development time. LPTPORT 1.3.1 library is available with the purchase of a single user development license for only $9.95 and comes with C and Visual Basic source code examples. If you are currently developing an C or Visual Basic application and want to resign from writing complicated I/O port drivers LPTPORT can help. I have built in many more functions in version 1.3.1.1 that will even simplify accessing I/O ports on any WIN9x system even more. You no longer need to know how memory mapped I/O works or even how access to the BIOS memory map is achieved. LPTPORT still supports BIOS memory map access but only if you want to use those features. Two new functions GetDefaultLPT and GetDefaultCOM can be used to automatically determine the default LPT or COM I/O port base address. In addition to Default LPT and COM port address determination I have provided a function called GetAddress that will allow you to read a Word from BIOS memory at a given segment and offset address. Data reading and writing is very easy using LPTPORT. After you have the default LPT or COM port base address. A simple call to the ReadData function will return the data read from an port address. Data can also be written to a port address using the WriteData function. Seeking an NT/2000 or XP solution for I/O port access ? We now have an NT/2000/XP version of LPTPORT . For NT/2000/XP version information : Visual Enterprises DDK II. Using The LPTPORT.DLL in C I have written LPTPORT in Visual C and compiled it into a resuable DLL . The DLL can be used in either Visual C or Borland C development environments. The prototypes listed below are callable by loading the DLL into your applications memory space. The easiest way to accomplish this is to use the LoadLibrary API call. Once the library is loaded you can then define pointers to each function within the process memory space. Here is a simple lptport.h header file you can use to call the library functions in C . Includes: #include |
ray24
中階會員 ![]() ![]() ![]() 發表:18 回覆:88 積分:56 註冊:2002-07-24 發送簡訊給我 |
先感謝conundrum的回覆, 但可能誤會我的問題了
那我舉個例子好了 就用您提供的FUNCTION來說明 lib_ReadData這各FUNCTION 是來讀LPT PORT 的某一個位置的值
但是我使用時必須不斷的執行這個FUNCTION 來取值
並且判斷這各值中的某一個BIT 是否為TRUE
這樣做有一點耗程式的資源 所以我希望是當這個BIT 由 FALSE 轉成 TRUE時主動的通知應用程式
就像OS會送MESSAGE給應用程式那樣的呼叫 CALLBACK FUNCTION 不知道這樣的需求要如何實作
------
台上一分鐘,台下十年功 |
conundrum
尊榮會員 ![]() ![]() ![]() ![]() ![]() ![]() 發表:893 回覆:1272 積分:643 註冊:2004-01-06 發送簡訊給我 |
|
ray24
中階會員 ![]() ![]() ![]() 發表:18 回覆:88 積分:56 註冊:2002-07-24 發送簡訊給我 |
恩...寫的連我自己都快看不懂了
------
台上一分鐘,台下十年功 |
conundrum
尊榮會員 ![]() ![]() ![]() ![]() ![]() ![]() 發表:893 回覆:1272 積分:643 註冊:2004-01-06 發送簡訊給我 |
基本上 庵可能是無法解答的 以下凡KTOP轉貼的 請自行至原網站看看資料是否有可思考的 如由 LPT to socket 或 虛擬RS232 to RS232 HOOK的訊息接收 等等 http://www.beyondlogic.org/spp/parallel.htm http://www.luberth.com/cstep/parallel.htm
http://support.gateway.com/s/Servers/COMPO/Cases/3501128/manual/05740a2.htm
http://bioscentral.com/misc/bda.htm
http://www-user.tu-chemnitz.de/~mad/BiosKompendium/isicmos.htm http://www.franksteinberg.de/progss.htm http://www.groovyweb.uklinux.net/?page_name=operating systems tutorial
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=62691
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=62687
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=62268
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=56540
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=53955
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=53767
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=51359
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=51747
http://jiurl.nease.net/document.htm
8. 内存篇 内存共享(一) ProtoPTE 9. 内存篇 内存共享(二) CopyOnWrite
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=50996
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=44873
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=71607
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=62690 Caller ID Developer Tools
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=61453
http://www.ainslie.org.uk/callerid/dev_soft.htm http://delphi.ktop.com.tw/topic.php?TOPIC_ID=51356
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=51006
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=51007
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=50997 若外部訊號給的太快就會 miss 掉
//不能由硬體轉換為別的協定嗎 如 RS232 to tcp to plc等 目前小弟想做的就是接收 LPT status register 其中的一個 Bit 作為觸發訊號(此觸發訊號是經由PC外部提供的)
//很像UPS的 RS232訊號給PC說 快斷電了 ㄟ OS 快準備關機 可找 axsoft 版主的討論文章 庵幫不上了 哈哈 哈哈哈
|
derrenbol1
中階會員 ![]() ![]() ![]() 發表:5 回覆:113 積分:93 註冊:2004-12-09 發送簡訊給我 |
To ray24: 看了有些亂, 雖然不太知道你們對話的詳細, 但我知道你的訴求是應用程式要直接使用中斷是吧? 我從事的是Embedded System建置及Firmware撰寫. 若依照我對"OS"的觀念來說的話, 那作業系統是不應該給使用者直接使用中斷的權利; 作業系統不光只為了貴單位的程式而運作, 它得保持系統穩定, 在正常使用情況下, 考慮一個情況若當作業系統允許使用者操作中斷, 但萬一使用者忘了將系統原本預設的中斷服務常式還原的話, 那後果就嘿嘿嘿了.
我想你應該知道"中斷"在作業系統中算是一個資源, 而作業系統應該全部都掌控在核心內, 提供給使用者的是另一層的介面, 一個Call Back的介面以讓使用者與核心作連接, 或是一個事件, 來通知使用者, 這樣才能保證當上述情況發生時作業系統不導致當機, 不然Window 98不應該是98天才當一次, 應該是趨近9.8天才對.
以各位應用程式撰寫人員不漠生的Thread為例, 它是利用系統計時器的功能做到的, 該計時器是作業系統所控制用來切換行程, 而Thread基本上也算是一種行程, 而且比較不會佔記憶體; 那那天你心血來潮想拿計時器來用用的話, 大概該時間內只剩下你的程式在執行, "Multitask"恐怕就不存在了.
DOS ? 這種東西在任一本作業系統的書籍中僅能被歸類成"監控程式"而已; 同時間只有一個程式能被執行, 中斷給你又有何不可, 當機頂多重開而已
|
derrenbol1
中階會員 ![]() ![]() ![]() 發表:5 回覆:113 積分:93 註冊:2004-12-09 發送簡訊給我 |
To ray24 :
看了有些亂, 雖然不太知道你們對話的詳細, 但我知道你的訴求是應用程式
要直接使用中斷是吧? 我從事的是Embedded System建置及Firmware撰寫. 若依
照我對"OS"的觀念來說的話, 那作業系統是不應該給使用者直接使用中斷的權
利; 作業系統不光只為了貴單位的程式而運作, 它得保持系統穩定, 在正常使
用情況下, 考慮一個情況若當作業系統允許使用者操作中斷, 但萬一使用者忘
了將系統原本預設的中斷服務常式還原的話, 那後果就嘿嘿嘿了. 我想你應該知道"中斷"在作業系統中算是一個資源, 而作業系統應該全部都
掌控在核心內, 提供給使用者的是另一層的介面, 一個Call Back的介面以讓使
用者與核心作連接, 或是一個事件, 來通知使用者, 這樣才能保證當上述情況
發生時作業系統不導致當機, 不然Window 98不應該是98天才當一次, 應該是趨
近9.8天才對. 以各位應用程式撰寫人員不漠生的Thread為例, 它是利用系統計時器的功能
做到的, 該計時器是作業系統所控制用來切換行程, 而Thread基本上也算是一
種行程, 而且比較不會佔記憶體; 那那天你心血來潮想拿計時器來用用的話,
大概該時間內只剩下你的程式在執行, "Multitask"恐怕就不存在了. DOS ? 這種東西在任一本作業系統的書籍中僅能被歸類成"監控程式"而已;
同時間只有一個程式能被執行, 中斷給你又有何不可, 當機頂多重開而已; 雖
然在我的觀念中是不允許這種行為的, 但我還是很想知道有沒有人在Windows中
搞這招, 對於80x86的CPU而言, 應該必須切到Supervisor Mode才有資格去更改
IDT才對, 用Window API的話, 比爾蓋子不知道同不同意. 再Port一次, 好像忘了Enter了, 上一回答怎麼那麼長?
|
conundrum
尊榮會員 ![]() ![]() ![]() ![]() ![]() ![]() 發表:893 回覆:1272 積分:643 註冊:2004-01-06 發送簡訊給我 |
但我還是很想知道有沒有人在Windows中 搞這招 庵是知道一位 林君學 這老版主 自己有寫一支 保護/真實 模式 切換於
2000/xp
話說那 林sir 版主 不知有無看到 看到是否會出來一下 哈哈 令一個就是 大名頂頂的 除錯魔神 SoftICE lu 網友 thread 高手的問答
預防死結
http://delphi.ktop.com.tw/winnertopics.asp?M_ID=16913&M_NAME=lu http://delphi.ktop.com.tw/topic.php?TOPIC_ID=62819
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=62520
http://www.delphi3d.net/articles/viewarticle.php?article=threads.htm
http://delphi.ktop.com.tw/topic.php?topic_id=69191 【問題】有關WinIO的使用
http://delphi.ktop.com.tw/topic.php?topic_id=66444 純討論 題外話 "OS"的觀念來說的話, 那作業系統是不應該給使用者直接使用中斷的權
利; 作業系統不光只為了貴單位的程式而運作, 它得保持系統穩定,
//
理論上 可能要先看 OS系統排程的特性 一般程式只能在ring 3 執行
提高 執行權限 一般的Window API當然ms是常常藏招的 例如 網路封包 與 資料複製 2者比較 在2000/xp等OS下 它們是認定
那一個為優先
答案 如果都在背景執行 網路封包是高於 資料複製
原因 網路封包有時間限制的困擾 當初OS就有考慮 時差與重要性 所以內定
封包傳遞 優先於 資料複製 重點 : 網路封包資料較小 無法重覆(甚至不回應接收) 拒絕遺失 傳遞時間有限 所以卡高 再說下去 系統分析的書 先來先出 後來先出 可能都看不完了 庵扯太遠了 哈哈
|
ray24
中階會員 ![]() ![]() ![]() 發表:18 回覆:88 積分:56 註冊:2002-07-24 發送簡訊給我 |
conundrum 大哥別這麼說...你能提供這些資料我已經非常感激了
畢竟這種冷門的題目...甚至有人願意多看一眼衝衝人氣就非常難能可貴了 derrenbol1兄...
我啦哩拉扎的寫了一堆...亂沒重點的
倒是您說到了一個重點
而作業系統應該全部都
掌控在核心內, 提供給使用者的是另一層的介面, 一個Call Back的介面以讓使
用者與核心作連接, 或是一個事件, 來通知使用者
其實寫了這麼多要的就是這個< >
就是因為 > 若是可能的話又該如何實做呢? 臭比爾蓋子 < > 我恨妳....>_< ----------------------
台上一分鐘,台下十年功
------
台上一分鐘,台下十年功 |
conundrum
尊榮會員 ![]() ![]() ![]() ![]() ![]() ![]() 發表:893 回覆:1272 積分:643 註冊:2004-01-06 發送簡訊給我 |
|
derrenbol1
中階會員 ![]() ![]() ![]() 發表:5 回覆:113 積分:93 註冊:2004-12-09 發送簡訊給我 |
|
ray24
中階會員 ![]() ![]() ![]() 發表:18 回覆:88 積分:56 註冊:2002-07-24 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |