Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

USB interrupt 64byte

Hello,

 

I have been working on a simple HID USB instrument which operates using Interrupts. I have sucessfully created drivers that are recognized by LabView VISA and I can communicate with the device. However, I am not sure if I am sending the correct command byte to actuate the instrument. I also believe that the data output is not the correct representation for my sensor data.

 

The instrument is a measurement device that requires user input to actuate and then reads/transmits data from two sensors back to the computer. I have included in the attached VI some of the basic interface requirements for the board and I would really appreciate it if someone could take a look and offer some insight about how to get this to work.

 

Thanks,

AMP

 

0 Kudos
Message 1 of 10
(4,071 Views)

Up to your "Wait on VISA Event" everything seems OK.

 

The lower output of your "Wait on Event" should be connected to the "Get USB Interrupt Data", not the top one.  Conversely, the top one should be wired out of the loop, not the lower one.  Swap these around and it might just work for you.

 

Shane

 

PS Your setting of USB OUT is not neccessary.  It certainly does NOT enable Interrupt events at EP 0.

PPS Are you sure your write should be done via BULK and not via CONTROL?  HIDs normally have only CONTROL and INTERRPUT Pipes, neither of which works with the standard VISA Write AFAIK.

0 Kudos
Message 2 of 10
(4,050 Views)

Thanks Shane,

 

I was able to get labview to talk with the controller and report output data. I have attached the VI that works in that manner. What does not seem to be working is the input command. the 'anything' cluster on the front panel is defined in the comment box on the block diagram. Essentially, it sends a voltage command to the microcontroller that then actuates a force generator. The output data from the Get Interrupt Data looks like it is correctly reading the output signals from the microcontroller but I do not know how to separate the two 2-byte output arrays that correspond to different sensors.

 

Mind taking a look and see if anything jumps out at you? I suppose it would be difficult without having the board to plug in, but I am getting desperate.

 

-A

0 Kudos
Message 3 of 10
(3,962 Views)

Hey amproctor -

 

I have a couple of questions for you. You mentioned that the input command does not seem to be working, but the problem you described seemed to have to do with reading your output. Can you clarify this?

 

Also, the VisaUsbInterruptDataWin32 VI is missing for me. What is happening in that VI? If you let us know what the format is of the data in that array, we can help you figure out how to parse it correctly.

 

Best Regards,

 

John M

National Instruments
Applications Engineer
0 Kudos
Message 4 of 10
(3,936 Views)

Hi John,

 

I found that subVI on the forums. I have posted the version that I am using here. I have also included the USB interface specs that relate to the microcontroller we are using.

 

To be more clear about my problem, I have two.

 

One, I cannot figure out how to send the right command byte (as defined in the attached word doc) so that my instrument actuates via the Interrupt OUT pipe on EP1.


Two, I cannot plot/record the right output data from my sensors after the command has been sent. I should have one channel that reads a load cell and on channel that reads an LVDT (both are simply voltages) but they are combined into a single output data report (see the word doc for definitions).

 

I have a feeling that if I can get the input command in the right format the instrument should operate correctly, meaning it will 'move' like it should. Then the only challenge will be reading the output data from the USB correctly so that i can separate each sensor data and turn it into a spreadsheet array and save it to file.

 

Any insight on this would be greatly appreciated. I am more than happy to get into more detail if you need it.

 

Cheers,

A

 

 

Download All
0 Kudos
Message 5 of 10
(3,933 Views)

@amproctor wrote:

Hi John,

 

I found that subVI on the forums. I have posted the version that I am using here.  

 


Why on earth are you using that function to get your interrupt data when there's a perfectly good method within LV itself.....  Look at my Nuggets (in my signature) to see how to read Interrupt data.

0 Kudos
Message 6 of 10
(3,923 Views)

Actually, that file is the same file that is included in LV. It is just unlocked so that I can modify the size and shape of the output array.

0 Kudos
Message 7 of 10
(3,891 Views)

Please read my Nuggets which are linked in my signature.  Diving that deep into the DLL calls of VISA is seriously not recommended.  Use the perfectly suitable functions provided on the menus.

 

Diving into DLL calls makes it very difficult for people like me to help you because we don't see any changes youmight have made to the calls and I don't have the time to cross check everything.

0 Kudos
Message 8 of 10
(3,887 Views)

OK, will take another look. I must be missing something.

0 Kudos
Message 9 of 10
(3,885 Views)

Re-reading your first nugget gave me an idea, thanks Shane.

 

I think a major aspect that I need to investigate more is the nature of the signals being sent back and forth between the board and my PC. I will get that breakdown posted ASAP and maybe I can figure it out.

 

More to come...

0 Kudos
Message 10 of 10
(3,883 Views)