Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Call Library Function in LabView 6i using a USB interface to U2C-12 USB-I2C/SPI/GPIO Interface Adapter from Diolan.com.

I'm using the Call Library Function in LabView 6i to access the i2cbrdg.dll library for the U2C-12 USB-I2C/SPI/GPIO Interface Adapter from Diolan.com. I'm trying to use the U2C_OPENDEVICE function. The response when trying to open device 0 is -1 or INVALID_HANDLE_VALUE. Do you have any suggestions as to what the problem might be? Thanks for any help you can provide!

0 Kudos
Message 1 of 31
(9,168 Views)
I use one of those boards in a current project and wrote a whole set of LabVIEW drivers for it, but they're in 8.2. The response indicates that no board was found. Did you confirm that you can talk to the board using the Control Center app that is included in the software download?
Message 2 of 31
(9,160 Views)

Thank you for your reply. When I use the U2C_GETDEVICECOUNT function the response is 1, so it appears that the Interface Adapter is being recognized as being present. I’ve also used the Control Panel program supplied by Diolan and it does communicate to the Interface Adapter without any problems. Any other ideas?

0 Kudos
Message 3 of 31
(9,156 Views)
That function is pretty straightforward, so unless you're calling it incorrectly, I'm not sure. You can try the U2C_OpenDeviceBySerialNum function to see if that works. If you post your VI I can take a look at it to make sure it's configured properly.
0 Kudos
Message 4 of 31
(9,152 Views)

Please see the attached vi. I’ve tried to open the device using the serial number that was returned when using the Diolan interface program. The response is -1. I’m a novice LabView user and I really appreciate any help you can provide.

0 Kudos
Message 5 of 31
(9,126 Views)
For some reason the vi did not get attached to the previous message. I'll try again.
0 Kudos
Message 6 of 31
(9,125 Views)
Your call to the DLL is not configured properly. The return type should be a signed 32-bit integer, and the input should be a an unsigned 8-bit integer, passed by value. You were passing the input as a pointer to a value. If you installed the full software distribution from Diolan you should have a "C:\Program Files\Diolan\U2C-I2C" folder, assuming the default installation directory. In the "C:\Program Files\Diolan\U2C-12\Src\Common" folder there's a i2cbridge.h file. If you open this file you will see the definitions of the datatypes used by the Diolan functions.

Also, it seems that you were intending to run this VI using the continuous run button, based on the mechanical action of the booleans. You should not do this. The continuous run button should only be used when trying to debug in certain instances. It should not be used for "normal" running of code. You should use a loop controlled by a front-panel stop button, or use a loop with an event structure. Better yet, the individual operations (Find Device, Open Device, etc.) should be individual VIs.
0 Kudos
Message 7 of 31
(9,119 Views)
Thank you so much for your help and insight. The LabView application is now communicating with the U2C-12 USB-I2C/SPI/GPIO Interface Adapter from Diolan.
0 Kudos
Message 8 of 31
(9,077 Views)

Hello,

 

I started a new project with U2C-12 board but I could not get any information return when passing pointer to a function.

 

Could you post your working example or some kind of LabVIEW wrapper for U2C-12 board.

 

Thank you for your help.

 

VI123

0 Kudos
Message 9 of 31
(8,349 Views)
Please see the attached example of LabView VI using the U2C-12.
0 Kudos
Message 10 of 31
(8,328 Views)