LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB RAW Communication Using VISA Read and Write

Hi everyone,

 

First off, I don't have a strong knowledge of USB RAW or VISA, so I apologize if any of the wording/questions do not make sense/aren't written the way they should be.  I am trying to modify a program to work with a USB RAW device (laser) that I have connected.  I have already created a driver for my device which shows up in MAX, and I have used VISA to do this, and have changed the VISA class in my program to USB-RAW already.

 

I have a few questions regarding how to read/write data using this device.  

 

1)  How do I know what type of transfers I need to use (bulk or control)?  I believe based on my research I will be using bulk.  

 

2)  Assuming bulk transfers, can I just use VISA Read and VISA write the way I have in the screen shot entitled "VISA Write Program"? 

 

3)  In this screenshot of "VISA Write Program" what would I use as the byte number? (currently set at 1).  And do I need to use the property node to specify where the data is coming from?

 

I am currently receiving an error from the "VISA Write Program" subVI, which is why I chose it to include in this question.  The error number is 1073807339".  

 

I have also attached screen shots of my RAW device showing up in MAX, as well as the attributes (I don't know if this will be helpful enough, please let me know if more information is needed to help me). 

 

Thank you.

 

csot88

0 Kudos
Message 1 of 8
(7,629 Views)
The type of transfer, the number of bytes, etc. will have been made available from the vendor. All of this information is required before you decide to use USB RAW instead of the driver that the vendor provides.
0 Kudos
Message 2 of 8
(7,620 Views)

The manual tells me that the laser is designed to communicate via a standard USB interface, and that if I install the application it will install the "right" USB drivers.

 

Attached is the USB driver they provided and the sample program.

 

The reason I chose to use USB RAW is that the program I am modifying (which we used with the older version of laser which is connected by GPIB) already had coded in a VISA option.  I thought it would be easiest just to modify this code.

 

 

0 Kudos
Message 3 of 8
(7,614 Views)

Assuming that it is bulk transfer and I knew the correct numbers, what is the format for the code to set up a VISA Write and VISA Read?

 

Thanks.

 

 

0 Kudos
Message 4 of 8
(7,613 Views)
Why would you want to assume that? The USB RAW option is not going to be anything like the GPIB version unless they are using USBTMC. If they did, then creating your own driver was the worst thing you could do. If not, you would be much better off using the vendor's api instead of stumbling in the dark.
0 Kudos
Message 5 of 8
(7,604 Views)


For the purposes of learning how to write and read with the VISA RAW class, I thought that would be the simplest question by making that assumption for now.

 

They did use USBTMC.

 

This is why I am trying to just modify their code to use with the USB RAW class, from what I understand (which could be totally wrong which is why I am asking this question) it might not be that much different because you can use VISA functions.

 

I already mentioned I am not an experienced user, trying to become more knowledgeable through these forums and tutorials, but it is still relatively new territory for me.

 

 

0 Kudos
Message 6 of 8
(7,589 Views)
As I said, with USBTMC, creating your own driver would be the worst thing you could do. With USBTMC, you let MAX recognize the device and then the same driver for GPIB will work. Remove the damage you did and restore the original driver.
0 Kudos
Message 7 of 8
(7,585 Views)

@csot88 wrote:


For the purposes of learning how to write and read with the VISA RAW class, I thought that would be the simplest question by making that assumption for now.

 

They did use USBTMC.

 

This is why I am trying to just modify their code to use with the USB RAW class, from what I understand (which could be totally wrong which is why I am asking this question) it might not be that much different because you can use VISA functions.

 

I already mentioned I am not an experienced user, trying to become more knowledgeable through these forums and tutorials, but it is still relatively new territory for me.

 

 


Well. USB Raw communication is definitely not something to start to improve your non existing knowledge. In terms of communicating with devices it is similar to programming your software in assembly instead of LabVIEW. You do need an exact protocol description. Since you claim it do be USBTMC you could download that specification and read it except that specifications are usually very hard to read and understand even if you know the details already.

 

Looking at your VI (that didn't contain the actual driver VIs at all) I do doubt your claim about the device being USBTMC however. If that would be the case there would be no need to use a .Net component to enumerate the possible devices in the beginning, since VISA does all this automatically for USBTMC devices.

 

USB Raw is complicated, lowest level and in general should be avoided at all costs, unless you have a very good understanding of how USB bits are transfered and even then only as last resort, after you were able to get the complete protocol specification. Anything else will be much faster to develop, easier to maintain and more likely to result in a working solution.

Rolf Kalbermatter
My Blog
0 Kudos
Message 8 of 8
(7,567 Views)