您好,我正在使用M24LR发现套件中的CR95HF板从设备读取数据。如果我使用ST网站的双接口EEPROM软件,选择阅读器应用程序并选择M24LR64A,然后单击读取,或者“显示RF文件传输工具”,然后将EEProm保存到文件中“它做我想要的,但是我希望能够将此功能包含在我自己的软件中。
我之前没有编写过这样的硬件单元,所以我只是习惯了它。我基于可下载的代码示例构建了一个简单的小型VB.net应用程序,但是存在一些问题:
[码]
公共声明Ansi函数CR95HFDll_Echo Lib''CR95HF.dll''(ByVal mystring As String)As Long
公共声明函数CR95HFDll_Idn Lib''CR95HF.dll''(ByVal mystring As String)As Long
公共声明函数CR95HFDll_Select Lib''CR95HF.dll''(ByVal mycmdstring As String,ByVal mystring As String)As Long
公共声明函数CR95HFDll_SendReceive Lib''CR95HF.dll''(ByVal mycmdstring As String,ByVal mystring As String)As Long
公共声明函数CR95HFDll_STCmd Lib''CR95HF.dll''(ByVal mycmdstring As String,ByVal mystring As String)As Long
公共声明函数CR95HFDll_FieldOff Lib''CR95HF.dll''(ByVal mystring As String)As Long
公共声明函数CR95HFDll_GetDLLrev Lib''CR95HF.dll''(ByVal mystring As String)As Long
公共声明函数CR95HFDll_ResetSPI Lib''CR95HF.dll''(ByVal mystring As String)As Long
公共声明函数CR95HFDll_SendIRQPulse Lib''CR95HF.dll''(ByVal mystring As String)As Long
公共声明函数CR95HFDLL_getMCUrev Lib''CR95HF.dll''(ByVal mystring As String)As Long
'在Dll修订版0.4中添加
公共声明函数CR95HFDLL_ge
tinterfacePinState Lib''CR95HF.dll''(ByVal mystring As String)As Long
'在Dll修订版0.5中添加
公共声明函数CR95HFDLL_USBconnect Lib''CR95HF.dll''()As Long
公共声明函数CR95HFDll_Polling_Reading Lib''CR95HF.dll''(ByVal mystring As String)As Long
公共声明函数CR95HFDll_SendNSSPulse Lib''CR95HF.dll''(ByVal mystring As String)As Long
'在DLL修订版0.6中添加
公共声明函数CR95HFDLL_USBhandlecheck Lib''CR95HF.dll''()As Long
'在DLL修订版0.9中添加了
公共声明函数CR95HFDLL_getHardwareVersion Lib''CR95HF.dll''(ByVal mystring As String)As Long
公共Const CR95HF_
STM32_error =& H1
公共Const CR95HF_empty_argument_error =& H2
公共Const CR95HF_cmd_parameter_error =& H3
公共Const CR95HF_communication_error =& H4
公共Const CR95HF_USB_communication_error =& H5
公共Const CR95HF_ERRORCODE_DEFAULT =& HFE
公共Const CR95HF_ERRORCODE_TIMEOUT =& HFD
[/码]
[码]
Dim lngStatus As Long = 5
Dim lngStatus2 As Long = 6
Dim strAnswer As New String(''''c,256)
Dim strTagResponse为新字符串(''''c,256)
lngStatus = CR95HFDLL_USBconnect()
如果(lngStatus = 0)那么
lngStatus2 = CR95HFDll_Select(''010D'',strAnswer)
CR95HFDll_SendReceive('''260100'',strTagResponse)
MsgBox(''RFID代码:''& strTagResponse)
其他
MsgBox(''警告:DEMO-CR95HF-A未连接'')
万一
Dim strAnswer2作为新字符串('''',c,256)
lngStatus = CR95HFDll_STCmd(''010202010D'',strAnswer2)
[/码]
首先,我不知道如何从EEPROM软件中获取代码块中的数据。我查看了手册/文档,只是简直无法弄明白。返回值也存在一些问题。对于CR95HFDLL_USBconnect函数,它正确返回0或1,但对于所有其他函数,它似乎只是返回乱码,我不知道为什么。它可能与我发送它的字符串有关,因为vb.net无法处理命令''As String * 256''
任何帮助,将不胜感激!
#cr95hf#m24lr-discovery#cr95hf #vbnet #vbnet #vbnet#m24lr-discovery