📄 pci8613.bas
字号:
'################# 内存映射寄存器直接操作及读写函数 ########################
' 适用于用户对本设备更直接、更特殊、更低层、更复杂的控制。比如根据特殊的
' 控制对象需要特殊的控制流程和控制效率时,则用户可以使用这些接口予以实现。
Declare Function PCI8613_GetDeviceAddr Lib "PCI8613" (ByVal hDevice As Long, ByRef LinearAddr As Long, ByRef PhysAddr As Long, ByVal RegisterID As Integer) As Boolean
' 取得指定的指定设备寄存器组的线性基地址和物理地址
' 设备对象句柄,它由CreateDevice函数创建
' 返回指定寄存器组的线性地址
' 返回指定寄存器组的物理地址
' 设备寄存器组的ID号(0-5)
Declare Function PCI8613_WriteRegisterByte Lib "PCI8613" (ByVal hDevice As Long, ByVal LinearAddr As Long, ByVal OffsetBytes As Long, ByVal Value As Byte) As Boolean
' 往指定寄存器空间位置写入单节字数据
' 设备对象句柄,它由CreateDevice函数创建
' 指定寄存器的线性基地址,它等于GetDeviceAddr中的LinearAddr参数返回值
' 相对于线性基地址基地址的偏移位置(字节)
' 往指定地址写入单字节数据(其地址由线性基地址和偏移位置决定)
Declare Function PCI8613_WriteRegisterWord Lib "PCI8613" (ByVal hDevice As Long, ByVal LinearAddr As Long, ByVal OffsetBytes As Long, ByVal Value As Integer) As Boolean
' 往指定寄存器空间位置写入双字节数据
' 设备对象句柄,它由CreateDevice函数创建
' 指定寄存器的线性基地址,它等于GetDeviceAddr中的LinearAddr参数返回值
' 相对于线性基地址基地址的偏移位置(字节)
' 往指定地址写入单字节数据(其地址由线性基地址和偏移位置决定)
Declare Function PCI8613_WriteRegisterULong Lib "PCI8613" (ByVal hDevice As Long, ByVal LinearAddr As Long, ByVal OffsetBytes As Long, ByVal Value As Long) As Boolean
' 往指定寄存器空间位置写入四节字数据
' 设备对象句柄,它由CreateDevice函数创建
' 指定寄存器的线性基地址,它等于GetDeviceAddr中的LinearAddr参数返回值
' 相对于线性基地址基地址的偏移位置(字节)
' 往指定地址写入单字节数据(其地址由线性基地址和偏移位置决定)
Declare Function PCI8613_ReadRegisterByte Lib "PCI8613" (ByVal hDevice As Long, ByVal LinearAddr As Long, ByVal OffsetBytes As Long) As Byte
' 往指定寄存器空间位置读入单字节数据
' 设备对象句柄,它由CreateDevice函数创建
' 指定寄存器的线性基地址,它等于GetDeviceAddr中的LinearAddr参数返回值
' 相对于线性基地址基地址的偏移位置(字节)
' 往指定地址写入单字节数据(其地址由线性基地址和偏移位置决定)
Declare Function PCI8613_ReadRegisterWord Lib "PCI8613" (ByVal hDevice As Long, ByVal LinearAddr As Long, ByVal OffsetBytes As Long) As Integer
' 往指定寄存器空间位置读入双字节数据
' 设备对象句柄,它由CreateDevice函数创建
' 指定寄存器的线性基地址,它等于GetDeviceAddr中的LinearAddr参数返回值
' 相对于线性基地址基地址的偏移位置(字节)
' 往指定地址写入单字节数据(其地址由线性基地址和偏移位置决定)
Declare Function PCI8613_ReadRegisterULong Lib "PCI8613" (ByVal hDevice As Long, ByVal LinearAddr As Long, ByVal OffsetBytes As Long) As Long
' 往指定寄存器空间位置读入四字节数据
' 设备对象句柄,它由CreateDevice函数创建
' 指定寄存器的线性基地址,它等于GetDeviceAddr中的LinearAddr参数返回值
' 相对于线性基地址基地址的偏移位置(字节)
' 往指定地址写入单字节数据(其地址由线性基地址和偏移位置决定)
'################# I/O端口直接操作及读写函数 ########################
' 适用于用户对本设备更直接、更特殊、更低层、更复杂的控制。比如根据特殊的
' 控制对象需要特殊的控制流程和控制效率时,则用户可以使用这些接口予以实现。
' 但这些函数主要适用于传统设备,如ISA总线、并口、串口等设备,不能用于本PCI设备
Declare Function PCI8613_WritePortByte Lib "PCI8613" (ByVal hDevice As Long, ByVal nPort As Integer, ByVal Value As Byte) As Boolean
' 8位写端口
' 设备句柄(由CreateDevice创建)
' 端口地址
' 写出的8位整型数据
Declare Function PCI8613_WritePortWord Lib "PCI8613" (ByVal hDevice As Long, ByVal nPort As Integer, ByVal Value As Integer) As Boolean
Declare Function PCI8613_WritePortULong Lib "PCI8613" (ByVal hDevice As Long, ByVal nPort As Long, ByVal Value As Long) As Boolean
Declare Function PCI8613_ReadPortByte Lib "PCI8613" (ByVal hDevice As Long, ByVal nPort As Integer) As Byte
Declare Function PCI8613_ReadPortWord Lib "PCI8613" (ByVal hDevice As Long, ByVal nPort As Integer) As Integer
Declare Function PCI8613_ReadPortULong Lib "PCI8613" (ByVal hDevice As Long, ByVal nPort As Integer) As Long
'######################### 文件操作函数 ##############################
Declare Function PCI8613_CreateFileObject Lib "PCI8613" (ByVal hDevice As Long, ByVal strFileName As String, ByVal Mode As Integer) As Long
' 创建文件对象
' 设备对象句柄,它由CreateDevice函数创建
' 路径及文件名
' 文件操作方式
Declare Function PCI8613_WriteFile Lib "PCI8613" (ByVal hFileObject As Long, ByRef pDataBuffer As Integer, ByVal nWriteSizeBytes As Long) As Boolean
' 保存用户空间中数据
' 文件对象,它由CreateFileObject函数创建
' 用户数据空间地址
' 缓冲区大小(字节)
Declare Function PCI8613_ReadFile Lib "PCI8613" (ByVal hFileObject As Long, ByRef pDataBuffer As Integer, ByVal nOffsetBytes As Long, ByVal nReadSizeBytes As Long) As Boolean
' 读数据
' 文件对象,它由CreateFileObject函数创建
' 接受文件数据的用户内存缓冲区
' 从文件前端开始的偏移位置
' 从偏移位置开始读的字节数
Declare Function PCI8613_SetFileOffset Lib "PCI8613" (ByVal hFileObject As Long, ByVal nOffsetBytes As Long) As Boolean
' 设置文件偏移指针
' 文件对象,它由CreateFileObject函数创建
' 文件偏移位置(以字为单位)
Declare Function PCI8613_GetFileLength Lib "PCI8613" (ByVal hFileObject As Long) As Long ' 取得指定文件长度(字节)
Declare Function PCI8613_ReleaseFile Lib "PCI8613" (ByVal hFileObject As Long) As Boolean ' 获得指定盘符的磁盘空间(注意使用64位变量)
Declare Function PCI8613_GetDiskFreeBytes Lib "PCI8613" (ByVal strDiskName As String) As Long ' 盘符名,如C盘为"C:\\", D盘为"D:\\"
'########################### 线程操作函数 ######################################
Declare Function PCI8613_CreateSystemEvent Lib "PCI8613" () As Long ' 创建内核事件对象,供InitDeviceDmaAD和VB子线程等函数使用
Declare Function PCI8613_ReleaseSystemEvent Lib "PCI8613" (ByVal hEvent As Long) As Boolean ' 释放内核事件对象
Declare Function PCI8613_CreateVBThread Lib "PCI8613" (ByRef hThread As Long, ByVal RoutineAddr As String) As Boolean ' 创建VB子线程
Declare Function PCI8613_TerminateVBThread Lib "PCI8613" (ByVal hThread As Long) As Boolean ' 释放VB子线程
Declare Function PCI8613_DelayTimeUs Lib "PCI8613" (ByVal hDevice As Long, ByVal nTimeUs As Long) As Boolean ' 微秒级延时函数
'############################### 辅助函数 ###################################
Declare Function PCI8613_kbhit Lib "PCI8613" () As Boolean ' 探测用户是否有击键动作(在控制台应用程序Console中有效)
Declare Function PCI8613_getch Lib "PCI8613" () As String ' 等待并获取用户击键值(在控制台应用程序Console中有效)
Declare Function PCI8613_SaveParaInt Lib "PCI8613" (ByVal hDevice As Long, ByVal strParaName As String, ByVal nValue As Integer) As Boolean ' 将整型数据保存到注册表中(Device-x\Others)
Declare Function PCI8613_LoadParaInt Lib "PCI8613" (ByVal hDevice As Long, ByVal strParaName As String, ByVal nDefaultVal As Integer) As Integer ' 将整型数据从注册表中回读出来(Device-x\Others)
Declare Function PCI8613_SaveParaString Lib "PCI8613" (ByVal hDevice As Long, ByVal strParaName As String, ByVal strParaVal As String) As Boolean ' 将字符串数据保存到注册表中(Device-x\Others)
Declare Function PCI8613_LoadParaString Lib "PCI8613" (ByVal hDevice As Long, ByVal strParaName As String, ByVal strParaVal As String, ByVal strDefaultVal As String) As Boolean ' 将字符串数据从注册表中回读出来(Device-x\Others)
Declare Function PCI8613_GetLastErrorEx Lib "PCI8613" (ByVal strFuncName As String, ByVal strErrorMsg As String) As Integer
'***********************************************************
' 设备地址获取函数GetDeviceAddr的参数RegisterID所使用的选项(有效部分)
Public Const PCI8613_REG_MEM_PLXCHIP = &H0 ' 0号寄存器对应PLX芯片所使用的内存模式基地址(使用LinearAddr)
Public Const PCI8613_REG_IO_PLXCHIP = &H1 ' 1号寄存器对应PLX芯片所使用的IO模式基地址(使用PhysAddr)
Public Const PCI8613_REG_IO_CPLD = &H2 ' 2号寄存器对应板上控制单元所使用的IO模式基地址(使用PhysAddr)
Public Const PCI8613_REG_IO_ADFIFO = &H3 ' 3号寄存器对应板上AD缓冲区所使用的IO模式基地址(使用PhysAddr)
'***********************************************************
' 各种FIFO存储器的长度(点)
Public Const FIFO_IDT7202_LENGTH = 1024
Public Const FIFO_IDT7203_LENGTH = 2048
Public Const FIFO_IDT7204_LENGTH = 4096
Public Const FIFO_IDT7205_LENGTH = 8192
Public Const FIFO_IDT7206_LENGTH = 16384
Public Const FIFO_IDT7207_LENGTH = 32768
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -