Example Code

Test USB 2.0 CPU Load

Code and Documents

Attachment

Description:

This VI highlights the inefficiency of USB 2.0 on Windows and therefore highlight the new advantages of USB 3.0, when available. Note the CPU usage of the two modes (via task manager) ; the VI needs to be restarted for the new mode to take effect.

To save CPU with USB 2.0, in a low frame rate/long term monitoring application, it is more efficient for the acquisition to stop and start when images are needed rather than letting the acquisition run in the background while discarding excessive images.

This VI uses LabVIEW 2012 SP1 and Vision Acquisition Software (IMAQdx 4.0), and therefore can be used with any IMAQdx supported camera (GigE, IEEE 1394, USB 3.0) also.

Instructions:

  1. Select a USB 2.0 camera, such as a Microsoft or Logitech webcam. The camera needs to support Directshow.
  2. Run the VI as “Run Smooth” and the acquisition will run more consistently and will acquire at the interval specified; PC CPU usage will likely be very high.
  3. Stop the VI.
  4. Run the VI as “Saving CPU” and the acquisition will, at times, need a couple more moments to start the acquisition before acquiring each image; PC usage will likely be significantly lower.

USB CPU load_BD.png

USB CPU load_FP.png

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
TejaskumarPatel
Member
Member
on

Is there any possibility to search via labview if connected USB camera is 2.0 or 3.0 type?

Tejaskumar Patel | (CLD)
NateBraska
Member
Member
on

There may be a way to do so, but I am not sure. I recommend creating a new discussion forum post or NI support ticket if you would like assistance researching this question.

Best of luck!

Contributors