LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

USB interrupt plug-in PC CVI

Solved!
Go to solution

When I plug-in the USB from my application to the PC , I can communicate with the USB link using CVI8.5 and ni-visa.

I use a polling method to detect the USB plug-in.After detecting the USB plug-in , i initialize the USB link.

How can I generate an interrupt when I plug-in the USB application, so i don't need the polling method.

 

Paul

0 Kudos
Message 1 of 6
(3,778 Views)

Hello Paul Bros,

 

I'm a bit confused about your question.

 

Normally the connecting of the USB-device on itself should generate the interrupt and you should not have to generate it from inside CVI.

You should however implement a way to handle the interrupts in your CVI-code.

 

As I don't know which device you're using nor which OS, it's difficult to say what you should do.

 

After a google search I have found a thread explaining certain approaches to this (on MAC):

http://stackoverflow.com/questions/3368008/reading-and-writing-to-usb-hid-interrupt-endpoints-on-mac

 

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 2 of 6
(3,760 Views)

Dear Thierry,

 

The application is an application that we designed with an ARM7  uP with an USB port.

The OS is Windows Vista but must work also at Windows7 and XP(for XP we made a differend driver with the CVI tools development driver).

When the application is plug-in at the PC , the Measurement and Automation gives the USB connection in the list.

In the Windows hardware list the application appears.

For the datafransfer I use viWrite and viRead.

 

Can i use:

viInstallHandler

viEnableEvent 

before I open the communication-link with the USB application.

I want an interrupt before I initialise the USb link , so i don't have to poll when i start the CVI application , and when the connected application change.

 

I  change the parametersettings in the application by the USB link (I have 10 the same applications, these are 10 Targets for a shootingstand).

I start the CVI8.5 and run the application.

There is an USB polling and initialisation of the USB link , after initialisation the USB polling will not be called anymore.

I connect the ARM7 application at the PC and I can change the parametersettings in the ARM7 application (Target1).

When I disconnect Target1 and connect another application eg Target2 the USB communication-link is lost.

To communicate with Target2 I must stop the application running under CVI and restart , the USB-link is detected by polling and initiated.

I can change the parametersettings on Target2.

 

Is it so that I must use interrupt pipeline to do this?

 

With regards

 

Paul Brosens

 

0 Kudos
Message 3 of 6
(3,756 Views)
Solution
Accepted by topic author Paul Bros

Hello Paul,

 

How familiar are you with the "concept" USB?

 

If I understand it correctly, then the problem is not situated in CVI  itself, but more related to accessing USB-devices in general.

 

One very useful guide/tool that I have also used myself (in personal atmosphere) is the following one:

http://msdn.microsoft.com/en-us/library/windows/hardware/ff540174%28v=vs.85%29.aspx

 

Are you writing your driver from scratch.

 

Is there a specific reason why you don't want to poll?

 

Also something useful might be the following document.

 

Also the following document might prove to be very useful:

http://www.codeproject.com/Articles/18062/Detecting-USB-Drive-Removal-in-a-C-Program

 

At a certain level you should check "windows messages" that are produced by windows. The tutorial above should introduce you to certain of these concepts.

 

 

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 4 of 6
(3,729 Views)

Dear THierry,

 

Thank you for the info about windows messages.

I used "InstallWinMsgCallback" and is works fine.

 

With regards

 

Paul

 

 :smileywink:

0 Kudos
Message 5 of 6
(3,692 Views)

Good to hear!

 

Good luck with the further programming!

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 6 of 6
(3,684 Views)