Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

USB digital camera and VISA communication problem

I have a digital camera which uses USB 2.0 as it's interface to the PC. I have installed the camera usign the manufacturers .inf file and the camera works fine with their software. However, I cannot get MAX 3.1 to recognize the presence of the USB camera.

Ultimatley, I would like to use Labview to interface and control the camera, but I think MAX needs to configure the camera for use with VISA.

Thanks,
Chris
Chris Reyerson
Optical Systems Engineer
Arete Associates
Tucson, AZ
0 Kudos
Message 1 of 17
(6,134 Views)
Hello,

In order to use VISA to control driver your camara (in any development environment, including LabVIEW) you'll need to indicate to windows that VISA is the driver for that device; this is done with inf files. More specifically, you would use the VISA Driver Development Wizard to generate this (and potentially, although very rarely, modify it to add functionality). If you have NI-VISA installed, the wizard can be launched using Start -> Programs -> National Instruments -> VISA -> VISA Driver Development Wizard. In any event, this still does not trivialize the task because you will still need to know how to communicate with the camara; there are two possibilities for using VISA:

1. (Best Case) Your camara is a USBTMC compatible device:

In this case, you will be able to use "high-level" VISA Write and Read functions to communicate with your camara, using whatever "message-based" API it provides (which should be in the user manual or available from the manufacturer, such as a set of string commands like Zoom, Capture, etc. where you would literally write strings using the VISA Write function, and read back data using VISA Read). You can read more about this at:

http://digital.ni.com/worldwide/bwcontent.nsf/web/all/63A0C78EF6083ACF86256E92004DC0DF


2. (Worst Case) Your camara is not USBTMC compatible:

In this case, you would theoretically have to use USB Raw communication, which would amount to actually writing binary data to your instrument. This will be almost certainly impossible for you to do, unless you have extremely intimate contact with the developer of the firmware for the camara. That is, you'll have to know exactly when and in what format to send every bit of data to the instrument. It is very unlikely that the manufacturer will be willing to give information on this level of detail away to consumers, however, you may inquire with them and I suppose you never know for sure!


I would say the intermediate case given your preference to control the camara through LabVIEW would be to somehow use the driver provided by the manufacturer, and perhaps somehow interface LabVIEW to the application your manufacturer provides. You may find more information about doing this on the discussion forums or developer zone, but if you decide to go this route, look first in the LabVIEW posts since it would reduce to a strictly LabVIEW programming problem.

Best Regards and good luck if you need to contact the manufacturer!

Feel free to repost if you have additional questions!

Thank you,

JLS
Best,
JLS
Sixclear
Message 2 of 17
(6,111 Views)
Hi,

I have full documentation on the USB raw communication, I am contracting directly for the camera vendor. My preference is to use their API (in the form of a dynamic link library), but they used C++ to write the dll and Labview is not compatible. (It may be a little more complicated than that, and I am working on this issue with the camera software engineer) In the mean time I want to be able to communicate using USB raw commands. The camera is not USBTMC compatible.

I used NI Visa Driver development wizard to create the .inf file and Windows Device Manager now reconginezes the camera as a NI-VISA USB Device, however, MAX does not display the camera in its list under Devices and Interfaces. I belive MAX must recognize the camera before I can use Labview to communicate with it, right?

Thanks,
Chris
Chris Reyerson
Optical Systems Engineer
Arete Associates
Tucson, AZ
0 Kudos
Message 3 of 17
(6,098 Views)
That is very interesting. Just to clarify is the Windows Device Manager showing the camera under the NI-VISA USB Devices resource type or is the camera showing up under a different type? If it is showing up under the NI-VISA USB Devices resource type then it should be showing up in MAX under devices and interfaces.

Search the web and see if you can find a program called USBVIEW. It is just an exe that should run on any Windows operating system. Once you launch it, go to Options and check Config Descriptors, then do a refresh. Now select the Camera from the USB tree. It should list all of its descriptors on the right. Take a screen shot of the data on the right and try to make sure you get all of it. It should look like the one I am attaching. From this I might be able to tell what is going on. It might also help if you can run NI-SPY and set it to log to file and turn capture on, then open MAX and select Devices and Interfaces. NI-SPY should capture all of the NI-VISA commands. If you can post the USBVIEW pict and the SPY capture I might be able to tell you what is going on.

As a side note what type of USB operations does your camera need (bulk, control, isochronous, interrupt)?

Josh Prewitt
National Instruments
Message 4 of 17
(6,081 Views)
Hi Joshua,

Thanks for the reply. I have attached the screen shot of the USBview. Apparently .spy is not a valid extention of an attached file (I tried it), so just replace the cirrent extension with .spy.

Chris
Chris Reyerson
Optical Systems Engineer
Arete Associates
Tucson, AZ
0 Kudos
Message 5 of 17
(6,066 Views)
Hi Joshua,

I got that last file backwards, it is the NI-spy log file, attached to this post is the USBview screen shot.

I do not know what type of communication this camera USB driver uses. I can ask the software engineer if it would help.

Thanks for your help,
Chris
Chris Reyerson
Optical Systems Engineer
Arete Associates
Tucson, AZ
0 Kudos
Message 6 of 17
(6,063 Views)
Hello,

Two things:

1. Since JoshuaP did mention the transfer type, it is likely a good thing to ask about in the mean time.

2. Have you tried using dll's in LabVIEW before using a Call Library Function Node?

I would take a look at Call DLL.vi, which has the following description:

This VI allows you to browse examples of external code (C and C++) data types and how they interface with LabVIEW. Each data type has an example VI that demonstates the use of the Call Library Function Node. To open the example VI for a particular data type, select that data type from the list on the left and then press the "Open Example VI for Current Data Type" button. The function prototype, the function's source code, and any specific details about this example will appear in the External Code Information cluster.

You can find this and many other example programs using the example finder in LabVIEW. To find Call DLL.vi simply open the example finder (use Help -> Find Examples in LabVIEW), click the Search tab near the upper lefthand corner, and type "dll" (without quotes) into the search field.

Repost if you have any further questions or if you feel this won't help you!

Best Regards,

JLS
Best,
JLS
Sixclear
0 Kudos
Message 7 of 17
(6,028 Views)
Hi JLS,

This camera comes with an API in the form of a .dll. Unfortunately, the person who wrote the dll used C++ and there is some conflict, the Labview Call Library Function can't read the functions contained within the dll (something to do with classes I think). I am trying to get the software engineer to write what he calls a "wrapper dll" which will allow Labview to recognize the dll. Ultimatley the dll simply acts as a translator between the user and the camera, it translates friendly message based communication to not-so-friendly register based communication. I prefer to interface to the camera using the API, but I may need to communicate directly with the camera, which I have experience doing on other digitical cameras (like Imperx).

I still can't get MAX to recognize the USB camera, even though it is listed under Window Device Manager as a NI-VISA USB device. This is where I am at now.

Thanks for all your help,
Chris
Chris Reyerson
Optical Systems Engineer
Arete Associates
Tucson, AZ
0 Kudos
Message 8 of 17
(6,025 Views)
hi,


I m very interresting in your experience, because i m trying to control a digital camera (Fujifilm Finepix S1 pro) from Labview too.

//quote
using whatever "message-based" API it provides (which should be in the user manual or available from the manufacturer, such as a set of string commands like Zoom, Capture, etc. where you would literally write strings using the VISA Write function, and read back data using VISA Read)
//end

I put the NI VISA driver, the VISAIC recognizes the camera, but I can t find the strings commands. Where should I look for?

Furthemore, i spyed the USB port in order to know the ASCII code that was sent during a Shoot (there is a program "shooting software" with the camera), can it be usefull?

I basicly need to shoot with the camera at a precise moment. Can you tell me if you finaly were able to do that?

Thank you very much in advance,

Thib
0 Kudos
Message 9 of 17
(6,018 Views)
Hi Thib,

My situation is a little different from your because I am working with a scientific/engineering camera. Yours is a commercial camera. The string commands used to control and communicate with the Fuji will be difficult to determine and essentially impossible to get out of Fuji. In my case, I have a document from the camera manufacturer specifiying the commands. Furthermore, I think that you will not be able to trigger the camera using the USB connection, typically on commercial cameras the USB is simply used for file managment and file download, not actual camera control.

There may be an alternate option, I have an Olympus camera which has a small auxillary connecotr located on the side which I have never used before. I think it might be used for remote trigger, or possibly for a remote flash. YOu might check into that possibility. Otherwise I think you shoudl work with a scientific/engineering grade camera, I think NI resells some from Sony, Pulnix, etc.

Chris
Chris Reyerson
Optical Systems Engineer
Arete Associates
Tucson, AZ
0 Kudos
Message 10 of 17
(5,595 Views)