红色代码改成你的端口位置,蓝色查找对比原来的代码
Dim portflag As Integer = 0
'变量声明
Dim CardPUCIIN As Byte() = New Byte(254) {}
Dim pucManaMsg As Byte() = New Byte(254) {}
Dim pucCHMsg As Byte() = New Byte(254) {}
Dim pucPHMsg As Byte() = New Byte(3023) {}
Dim puiCHMsgLen As UInt32 = 0
Dim puiPHMsgLen As UInt32 = 0
Dim st As Integer = 0
'读卡操作
st = SDT_StartFindIDCard(portflag, CardPUCIIN, 1)
msgbox(st)
If st <> &H9f Then
Return
End If
st = SDT_SelectIDCard(portflag, pucManaMsg, 1)
msgbox(st)
If st <> &H90 Then
Return
End If
st = SDT_ReadBaseMsg(portflag, pucCHMsg, puiCHMsgLen, pucPHMsg, puiPHMsgLen, 1)
msgbox(st)
If st <> &H90 Then
Return
End If
'显示结果
msgbox(System.Text.ASCIIEncoding.Unicode.GetString(pucCHMsg))
对照这段代码,改成自己的就行啊