求助:VB如何獲取計(jì)算機(jī)自動(dòng)分配給CH365的I/O端口基址

各位高手,本人是菜鳥,求助: CH365如果不采用本地硬件定址功能,則原ISA板卡的應(yīng)用程序應(yīng)該作少量修改,包括: 1。獲取計(jì)算機(jī)自動(dòng)分配給CH365的I/O端口基址; 在VB中該使用Declare Function CH365GetIoBaseAddr Lib "CH365DLL.DLL" (ByRef oIoBaseAddr As mCH365_IO_REG) As Boolean ' CH365GetIoBaseAddr 獲取I/O端口的基址 ' oIoBaseAddr 保存I/O端口基址的單元地址 嗎,如何使用啊, 幫幫忙阿,不勝感激!

把聲明加在你的VB中,然后在程序中調(diào)用CH365GetIoBaseAddr函數(shù),它的返回值表示是否成功獲取基地址,而oIoBaseAddr就是返回的基地址啊. 具體的調(diào)用可以是這樣.你先定義一個(gè)變量比如"BaseAddr",然后,if CH365GetIoBaseAddr(BaseAddr)=true then: BaseAddr就是你取得的基地址啦.


可以將下面的兩個(gè)函數(shù)對(duì)基址的聲明 Declare Function CH365GetIoBaseAddr Lib "CH365DLL.DLL" (ByRef oIoBaseAddr As mCH365_IO_REG) As Boolean ' CH365GetIoBaseAddr 獲取I/O端口的基址 ' oIoBaseAddr 保存I/O端口基址的單元地址 Declare Function CH365SetIoBaseAddr Lib "CH365DLL.DLL" (ByVal iIoBaseAddr As mCH365_IO_REG) As Boolean ' CH365SetIoBaseAddr 設(shè)定I/O端口的基址 ' iIoBaseAddr 指定I/O端口基址 改為 Declare Function CH365SetIoBaseAddr Lib "CH365DLL.DLL" (ByVal iIoBaseAddr As Any) As Boolean ' CH365SetIoBaseAddr 設(shè)定I/O端口的基址 ' iIoBaseAddr 指定I/O端口基址

這樣地址值就保存至iIoBaseAddr 變量?jī)?nèi)了.你可以這樣試試


謝謝,好人那........


樓上的大哥,弱弱的問問 我申明 Declare Function CH365SetIoBaseAddr Lib "CH365DLL.DLL" (ByVal iIoBaseAddr As Any) As Boolean 然后定義 DIM IOBASEADDR AS LONG 讀出的地址是 C800,那么我對(duì)其偏移地址7寫55H操作時(shí),是不是可以用 CH365SetIoBaseAddr IOBASEADDR CH365ReadIoByte(IOBASEADDR+7, &H55) 或者CH365ReadIoByte(&HC807, &H55)

嚴(yán)重感謝啊!


錯(cuò)了是 CH365WriteIoByte(IOBASEADDR+7, &H55) 或者CH365WriteIoByte(&HC807, &H55)


CH365WriteIoByte ( // 向I/O端口寫入一個(gè)字節(jié) PVOID iAddr, // 指定I/O端口的地址 UCHAR iByte ) // 待寫入的字節(jié)數(shù)據(jù)


是用 CH365WriteIoByte(0xC807, 0x55) ;


謝謝AERY,再問問 我原來的ISA卡是用74688,用定址的方式操作硬件和軟件都沒問題 ,我現(xiàn)在把它改為自動(dòng)分配地址,接法是A9-A3懸空了(原來接74688上,就是把74688取下不用),把74688的輸出端接地,用A0-A2 ,IOW譯碼,在DEBUG365中讀出的地址是 C800, 為什么我對(duì)IO其偏移地址7寫55H操作時(shí),讀出的值也是55H,但是我的硬件沒有動(dòng)作, 請(qǐng)問在VB中該用什么函數(shù)操作啊,是用CH365WriteIoByte 和 CH365ReadIoByte嗎?如果不是 該用什么函數(shù)呢? 在VB中使用的函數(shù)如下: Declare Function CH365GetIoBaseAddr Lib "CH365DLL.DLL" (ByRef oIoBaseAddr As ANY) As Boolean '申明函數(shù) Dim Ioadd As ANY LoadLibrary "CH365DLL.DLL" ' 加載動(dòng)態(tài)庫 mOpen = CH365mOpenDevice(0, True, True) '打開CH365 CH365GetIoBaseAddr Ioadd '取IO基址 CH365WriteIoByte Ioadd+7,&h55 'IO偏移地址7寫55 If (CH365ReadIoByte(Ioadd+7, ChByte)) Then '讀取IO偏移地址7的數(shù)據(jù) txtByte.Text = Hex(ChByte) '顯示 Else MsgBox "Read failed£?" End If


解決了,謝謝!


只有登錄才能回復(fù),可以選擇微信賬號(hào)登錄

国产91精品新入口,国产成人综合网在线播放,九热这里只有精品,本道在线观看,美女视频a美女视频,韩国美女激情视频,日本美女pvp视频