Question

Now, i know a little bit about the class and how to install the COMRD800.dll driver (using command prompt : regsvr32).

I'm using Visual Studio 2010 as my text editor, and VB.NET as my programming language.

But here i am, another problem is chasing me again. I don't know where is my fault.

First, i wanna explain, that when using this RF ID, there are some function to be called before writing and reading the hex key from RF ID tag. Here are the functions that i have to use before writing or reading.

dc_init(100,115200) 'to open the port, this should be initialized first
dc_beep(icdev,10) 'just to make the device beeping
dc_load_key_hex(icdev,0,0,"ffffffffffff") 'initializing the device key
dc_request(icdev,0,tagtype) 'to get the Card Tag Type
dc_anticoll(icdev,0,snr) 'to get the card's serial number
dc_select(icdev,snr,sizeA) 'to get the size of the card's memory to pc (it always "8")
dc_authentication(icdev,0,0) 'to pass the authentication
dc_write_hex(icdev,1,TestStr) 'writing to the RF ID tag with string TestStr
dc_read_hex(icdev,1,TestStr2) 'Nah, here is where the error occured. 

TestStr2 is a refference variable, in other words, the value of hex would be stored there. (i should print the TestStr2 to get hex value from RF ID tag)

When the function return "0" it means "correct" or working. But when the function return <> 0 it means "something is wrong".

This far, they all return "0". (Except the dc_read_hex where the error existed).

Explaining : Those functions came from the driver (dcrf32.dll file). To use them in my project, i must declare them in my VB.NET Module file. (in my project it's the "KoneksiRFID.vb" file).

So far i have no problem with the functions, but when i get to the "reading" part (dc_read_hex function) i have an error. It said "FatalExecutionEngineError".

Images

As you can see, the problem occured when i read the value. Here is my project if you want to participate in my problem and find a way to solve them. Thanks Before, for whoever tried to solve this problem. I Appreciate it so much.

My Entire Project (including its driver and RFID manual .pdf)

Oh one more thing, you have to put the "driver (dcrf32.dll, dcrf32.lib,dcrf32.h) files" to your bin or windows/system32 <-- i don't know if this required or not. But, just try it when the vb.net module didn't work properly.

Was it helpful?

Solution

Your VB6 definition is this:

Declare Function dc_read_hex Lib "dcrf32.dll" (ByVal icdev As Long, ByVal adr%, ByVal sdata$) As Integer

You currently have your definition as this, you have not adjusted the data type of adr or the return value:

Declare Function dc_read_hex Lib "dcrf32.dll" (ByVal icdev As Integer, ByVal adr%, ByRef sdata$) As Integer

Try defining it as:

Declare Function dc_read_hex Lib "dcrf32.dll" (ByVal icdev As Integer, ByVal adr as Short, ByRef sdata as String) As Short

Edit:

Give this a try from this MSDN page you will probably have to add Imports System.RunTime.InteropServices.

Declare Function dc_read_hex Lib "dcrf32.dll" (ByVal icdev As Integer, ByVal adr as Short, <MarshalAs(UnmanagedType.LPTStr)> sdata as String) As Short
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top