Issues with Programming CR95HF/M24LR in VB.net
Hi there, I am using a CR95HF board from a M24LR discovery kit to read data from a device. If I use the dual-interface EEPROM software from the ST website, select Reader Application and select M24LR64A, then click Read, or alternatively, 'show RF file transfer tools' and then save EEProm into a file' it does what I want, however I want to be able to include this functionality into my own software.
I have not programmed a hardware unit like this before, so am just getting used to it. I have constructed a small simple VB.net application based on the downloadable code examples, however there are some issues:[code]Public Declare Ansi Function CR95HFDll_Echo Lib ''CR95HF.dll'' (ByVal mystring As String) As Long Public Declare Function CR95HFDll_Idn Lib ''CR95HF.dll'' (ByVal mystring As String) As Long Public Declare Function CR95HFDll_Select Lib ''CR95HF.dll'' (ByVal mycmdstring As String, ByVal mystring As String) As Long Public Declare Function CR95HFDll_SendReceive Lib ''CR95HF.dll'' (ByVal mycmdstring As String, ByVal mystring As String) As Long Public Declare Function CR95HFDll_STCmd Lib ''CR95HF.dll'' (ByVal mycmdstring As String, ByVal mystring As String) As Long Public Declare Function CR95HFDll_FieldOff Lib ''CR95HF.dll'' (ByVal mystring As String) As Long Public Declare Function CR95HFDll_GetDLLrev Lib ''CR95HF.dll'' (ByVal mystring As String) As Long Public Declare Function CR95HFDll_ResetSPI Lib ''CR95HF.dll'' (ByVal mystring As String) As Long Public Declare Function CR95HFDll_SendIRQPulse Lib ''CR95HF.dll'' (ByVal mystring As String) As Long Public Declare Function CR95HFDLL_getMCUrev Lib ''CR95HF.dll'' (ByVal mystring As String) As Long 'added in Dll revision 0.4 Public Declare Function CR95HFDLL_getInterfacePinState Lib ''CR95HF.dll'' (ByVal mystring As String) As Long 'added in Dll revision 0.5 Public Declare Function CR95HFDLL_USBconnect Lib ''CR95HF.dll'' () As Long Public Declare Function CR95HFDll_Polling_Reading Lib ''CR95HF.dll'' (ByVal mystring As String) As Long Public Declare Function CR95HFDll_SendNSSPulse Lib ''CR95HF.dll'' (ByVal mystring As String) As Long 'added in DLL revision 0.6 Public Declare Function CR95HFDLL_USBhandlecheck Lib ''CR95HF.dll'' () As Long 'added in DLL revision 0.9 Public Declare Function CR95HFDLL_getHardwareVersion Lib ''CR95HF.dll'' (ByVal mystring As String) As Long Public Const CR95HF_STM32_error = &H1 Public Const CR95HF_empty_argument_error = &H2 Public Const CR95HF_cmd_parameter_error = &H3 Public Const CR95HF_communication_error = &H4 Public Const CR95HF_USB_communication_error = &H5 Public Const CR95HF_ERRORCODE_DEFAULT = &HFE Public Const CR95HF_ERRORCODE_TIMEOUT = &HFD[/code][code]Dim lngStatus As Long = 5 Dim lngStatus2 As Long = 6 Dim strAnswer As New String('' ''c, 256) Dim strTagResponse As New String('' ''c, 256) lngStatus = CR95HFDLL_USBconnect() If (lngStatus = 0) Then lngStatus2 = CR95HFDll_Select(''010D'', strAnswer) CR95HFDll_SendReceive(''260100'', strTagResponse) MsgBox(''RFID Code is: '' & strTagResponse) Else MsgBox(''Warning : DEMO-CR95HF-A not connected'') End If Dim strAnswer2 As New String('' ''c, 256) lngStatus = CR95HFDll_STCmd(''010202010D'', strAnswer2)[/code]Firstly I do not know how to get the data from the code blocks as the EEPROM software does. I have looked through the manuals/documentation and just simply cannot figure it out. Also there are some issues with the return values. for the CR95HFDLL_USBconnect function it correctly returns 0 or 1, but for all the others, it just seems to return gibberish, and I do not know why. It could be to do with the string I am sending it, as vb.net cannot cope with the command ''As String*256''any help would be appreciated! #cr95hf #m24lr-discovery #cr95hf #vbnet #vbnet #vbnet #m24lr-discovery