From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Use NI VISA instead of DLL provided by vendor.

Dear all,

 

We own a C11165 Hamamatsu DCAM, connected by USB.

We have some .dll and the .lib to make it work. It works perfectly while using it on labwindows, if we use directly the function inside the .lib.

However, we would like to use NI-VISA library instead, but therefore, i have no idea what string I would send to the device. Is there a way to force VISA to use the .lib to make it work ? So I can still use the function provided, using NI VISA.

 

I made the driver with the driver interface of NI VISA, using the driver provided by Hamamatsu, so NI VISA Interactive Control recognize the device.

 

Here is an example of function we have:

 

//============================================================================
// DcamInitialize()
//	Initialize the library.
// ---------------------------------------------------------------------------
// [Argument]
//			None. 
// [Return values]
//			If the function succeeds the return value is TRUE (1). 
//			If the function fails the return value is FALSE (0).
//			To obtain detailed error information, use the DcamGetLastError function.
// [Note]
//			1.	This function must first be run before running other functions.
//			2.	An error is issued if the library has already been initialized.
//			3.	Only one process can use this library.
//============================================================================
_DCamUSBEXPORT  short _DCamUSBSTDCALL DcamInitialize(void);
 

//============================================================================
// DcamUninitialize()
//	Unload the library resources and close the device driver.
// ---------------------------------------------------------------------------
// [Argument]
//			None.
// [Return values]
//			If the function succeeds the return value is TRUE (1). 
//			If the function fails the return value is FALSE (0).
//			To obtain detailed error information, use the DcamGetLastError function.
// [Note]
//			Call this function when quitting the program or the DCamLIB library is not needed.
//============================================================================
_DCamUSBEXPORT  int _DCamUSBSTDCALL DcamUninitialize( void );

//============================================================================
// DcamOpen()
//	Open the device.
// ---------------------------------------------------------------------------
// [Argument]
//			None.
// [Return values]
//			If the function succeeds the return value is TRUE (1). 
//			If the function fails the return value is FALSE (0).
//			To obtain detailed error information, use the DcamGetLastError function.
// [Note]
//============================================================================
_DCamUSBEXPORT  int _DCamUSBSTDCALL DcamOpen( void );

//============================================================================
// DcamClose()
//	Close the device.
// ---------------------------------------------------------------------------
// [Argument]
//			None.
// [Return values]
//			If the function succeeds the return value is TRUE (1). 
//			If the function fails the return value is FALSE (0).
//			To obtain detailed error information, use the DcamGetLastError function.
// [Note]
//============================================================================
_DCamUSBEXPORT  int _DCamUSBSTDCALL DcamClose( void );

//============================================================================
// DcamGetDeviceState()
//	Obtain the type of device state.
// ---------------------------------------------------------------------------
// [Argument]
//			pState   	: /O: Specify the address of the variable where the type 
//							  of device state is to be stored. One of the 
//							  following values is obtained.
//								DCAM_DEVSTATE_NON   	: Non-connection, No device found
//								DCAM_DEVSTATE_DEVICE	: Non-connection, Device found
//								DCAM_DEVSTATE_NODEVICE	: Connection, No device found
//								DCAM_DEVSTATE_CONNECT	: Connection, Device found
//								DCAM_DEVSTATE_BOOT	: Connection, Device found(during the boot process)
// [Return values]
//			If the function succeeds the return value is TRUE (1). 
//			If the function fails the return value is FALSE (0).
//			To obtain detailed error information, use the DcamGetLastError function.
// [Note]
//============================================================================
_DCamUSBEXPORT  int _DCamUSBSTDCALL DcamGetDeviceState( int* pState );

//============================================================================
// DcamGetImageSize()
//	Obtain the width and height of image data to acquire from the USB Driver Board.
// ---------------------------------------------------------------------------
// [Argument]
//			pWidth		: /O: Specify the address of the variable where the image 
//							  width is to be stored. 
//			pHeight		: /O: Specify the address of the variable where the image 
//							   height is to be stored.
// [Return values]
//			If the function succeeds the return value is TRUE (1). 
//			If the function fails the return value is FALSE (0).
//			To obtain detailed error information, use the DcamGetLastError function.
// [Note]
//============================================================================

 

0 Kudos
Message 1 of 3
(2,276 Views)

Most likely you need to forget the approach over NI-VISA. This looks like an image acquisition device and even if it uses a standardized USB profile for cameras (which it may not!!!) there is no NI-VISA support for that. Only USB-COM devices (which implement a virtual COM device, and USB-TMC devices implement a communication interface that NI-VISA can access directly as an instrument resource. You would have to access the device through NI-VISA as USB Raw device and implement everything yourself. 

Provided that the camera uses a standardized USB profile that would be theoretically possible but a major work  to perform as you need to implement the entire USB protocol in your software on top of the USB Raw access in NI-VISA. If your device uses a proprietary communication protocol, which is pretty likely for a device like this, then you can almost certainly forget that approach as most manufacturers who choose to implement a proprietary USB protocol do so to prevent others from accessing their device directly. Accordingly they only provide technical documentation about their protocol in very special cases with high volume OEM sales agreements and very highly restrictive NDAs.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 3
(2,227 Views)

Thank you for answering. This is what I ended up thinking but I was not sure.

 

I initially wanted to connect two of these camera on the same computer and synchronized them, but the dll does not allow multi devices connection. So I ended up using two computers and synchronize everhthing.

Thank you for answering.

 

 

 

 

 

 

 

 

 

0 Kudos
Message 3 of 3
(2,220 Views)