关于数据采集器 casio dt900 串口通讯问题
有哪位高手 懂得调用hostcm32.dll里面函数的顺序问题,我的程序总接收不到信号
怎么办?
Private Type INITTBL
speed As Long
length As Long
parity As Long
sbit As Long
ptout As Long
ctout As Long
cretry As Long
stopkey1 As Long
stopkey2 As Long
End Type
Private Type cinftbl
htid(6) As String
htdmy(2) As String
adv As Long
fileno As Long
filesize As Long
jobcmd As Long
datatype As Long
End Type
Private Declare Function hst_idtblclr Lib "G:\test\hostcm\hostcm32999.dll" () As Integer
Private Declare Function hst_idtbladd Lib "G:\test\hostcm\hostcm32999.dll" (ByVal iddata As String) As Integer
Private Declare Function hst_open Lib "G:\test\hostcm\hostcm32999.dll" (ByVal chno As Long, initab As INITTBL) As Integer
Private Declare Function hst_close Lib "G:\test\hostcm\hostcm32999.dll" () As Integer
Private Declare Function hst_polling Lib "G:\test\hostcm\hostcm32999.dll" (recno As Long, ByVal ioboxno As Long) As Integer
Private Declare Function hst_idtblgetidno Lib "G:\test\hostcm\hostcm32999.dll" () As Integer
Private Declare Function hst_getcinffirst Lib "G:\test\hostcm\hostcm32999.dll" (inftab As cinftbl) As Integer
Private Declare Function hst_getcinfnext Lib "G:\test\hostcm\hostcm32999.dll" (inftab As cinftbl) As Integer
Private Declare Function hst_filerecv Lib "G:\test\hostcm\hostcm32999.dll" (ByVal pname As String, inftab As cinftbl) As Integer
Private Declare Function hst_filesend Lib "G:\test\hostcm\hostcm32999.dll" (ByVal pname As String, inftab As cinftbl) As Integer
Private Declare Function hst_disconnect Lib "G:\test\hostcm\hostcm32999.dll" (ByVal mode As Long, inftab As cinftbl) As Integer
Private Declare Function hst_idtblgetid Lib "G:\test\hostcm\hostcm32999.dll" (ByVal recno As Long, ByVal iddata As String) As Integer
Private Declare Function hst_sethwnd Lib "G:\test\hostcm\hostcm32999.dll" (a As Long, ByVal recno As Long) As Integer
Private Declare Function hst_getcomfname Lib "G:\test\hostcm\hostcm32999.dll" (a As Long) As String
Private Declare Function hst_geterrinf Lib "G:\test\hostcm\hostcm32999.dll" () As String
Private Declare Function hst_stopreq Lib "G:\test\hostcm\hostcm32999.dll" () As Integer
Private Sub Command1_Click()
Dim a As INITTBL
Dim aa As INITTBL
Dim b As cinftbl
Dim v As Long
Dim abc As String
a.cretry = 2
a.ctout = 1000
a.ptout = 100
a.length = 0
a.parity = 0
a.sbit = 1
a.stopkey1 = 0
a.stopkey2 = 0
a.speed = 7
'MsgBox hst_sethwnd(Form1.hWnd, 1)
'MsgBox hst_geterrinf()
' MsgBox hst_getcomfname(78)
'MsgBox hst_stopreq()
b.jobcmd = 0
b.datatype = 1
b.fileno = 1
b.filesize = 1024
b.adv = 2
v = hst_open(1, a)
'MsgBox hst_idtblclr()
'MsgBox hst_idtbladd("1")
'MsgBox hst_getcinffirst(b)
'MsgBox hst_getcinfnext(b)
v = hst_idtblclr
If hst_idtblgetidno <= 0 Then
v = hst_idtbladd("&&&&&&")
End If
v = 3
MsgBox v
MsgBox hst_polling(v, 3)
MsgBox v
v = hst_filerecv("dt900.txt", b)
v = hst_close()
End Sub