LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I receive an error while trying to read a variant from an invoke node

I use an activex server to comunicate with a ModBus device, but every time I want to read the response message from the device (whose value is a variant) I get an error that says "a null reference pointer was passed at the rutine" (error number: H80007642). I've had tested the activex server with Excel97 and it works fine.
0 Kudos
Message 1 of 4
(2,475 Views)
Hello JesusCruz,

Have you been able to communicate with the device at all? Are we sure it is passing data back? What type of data should it be, and what type of data are you casting the variant as? I obviously can�t run your code since I don�t have the device, but I�d be happy to take a look at it if you want to post it.

If none of these suggestions help, or if I�m not correctly understanding your issue, please reply with comments or answers to the discussion above and any additional information that may help, and I�ll be happy to look further into it.

Have a nice day!

Robert Mortensen
Applications Engineer
National Instruments
Robert Mortensen
Software Engineer
National Instruments
0 Kudos
Message 2 of 4
(2,475 Views)
Hello Robert,
Thank you for your time. Yes, the communication with the device is established, in LabView I can write to it with no problem, zero CRC errors and all of the messages I send have a corresponding response, in Excel97 I can read and write but the syncronization it's very poor since I can't do a proper looping sequence.
When writing from LabView there is no need to cast anything, if I send a byte, an array of booleans, an array of integers, I just wire the data to the variant input (no casting or conversion is necesary) and the device reads all of them. When I try to read a single or multiples values (a boolean, an integer or an array of those, the returned data is always an array of variants that can be an array of booleans or integers) I u
se the invoke node and choose the proper method and if I not wire the variant output no errors are trigged, but if I wire this output, by casting (I'd tried using the casting function as well as the "To G" function) to a boolean, an integer, or an array of those, (I try them all) even right-clicking and using the LabView function "create indicator" and creating an OLE variant indicator, all the time I get the error H800706F4: "a null reference pointer was passed to the routine". I hope you're still interested in helping me. If you need more details please let me know. Thank you in advance.
(I apologize for the ortographic and grammatical errors, I'm not an english spoken-writing person)
0 Kudos
Message 3 of 4
(2,475 Views)
Jesus,

Do you have the Database Connectivity Toolset, by chance? It comes with a function called �Database Variant to Data.� Database variants are handled differently than regular variants. When using this toolkit, this specific function has to be used. If the normal �Variant to Data� function is used, it will not work. You may be running into the same issue.

I am also wondering if the invoke node is passing back valid data. Try wiring the variant output to a �Flatten to String� function. It will output a string that can then be viewed as hex to see exactly what data is being passed out. Compare this to the expected data.

Let me know how it goes, and good luck!

Have a nice day!

Robert Mortensen
Applications Engineer
Nati
onal Instruments
Robert Mortensen
Software Engineer
National Instruments
0 Kudos
Message 4 of 4
(2,475 Views)