LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

producer/consumer design pattern, USB-6211, oscilloscope

<meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8"><meta name="GENERATOR" content="OpenOffice.org 2.4 (Unix)">

Hello,

I'm an undergraduate Engineering Student. As a summer project I am working with my professor to develop some virtual instruments that can be used in the classroom at the Freshmen/Sophomore level.

Virtual Instruments to be made:

multimeter

oscilloscope

signal generator

Equipment:

I am using a National Instruments USB-6211 DAQ. For more information about this device click on the link below:

https://www.ni.com/en-us/support/model.usb-6211.html

LabVIEW 8.2

-------------------------------------------

Right now, I am working on the oscilloscope and have run into some errors. Initially, I kept getting the following error: “DAQmax read error: Error 200279.” This usually occurred when I set my sampling rate near to the maximum setting. This particular error has already been discussed on the NI forum here:

http://forums.ni.com/ni/board/message?board.id=170&thread.id=221743 

In this thread they discuss using a queue to solve this problem. I did this and I no longer receive the error. However, I do not have much experience with the programing logic associated with a queue, and I want to be sure that my code is correct, and efficient.

The only other problem is with the trigger. When I turn the trigger on, the waveform flickers on and off very rapidly. The trigger works though, the problem occurs when displaying the triggered waveform. I wonder if this is because of my loop structure or because I am not using the “Trigger and Gate” VI properly or perhaps something different all together.

In summary:

Am I properly implementing the producer/consumer design pattern in conjunction with my oscilloscope code?

Is there any way to optimize my code?

How can I fix the trigger function so that the waveform does not flicker?

Attached is my moderately commented code. I am not too experienced with LabVIEW, so please explain in detail so I may learn.

Thanks a lot!

Jimmy

 
0 Kudos
Message 1 of 2
(2,838 Views)
Hi Jimmy,

I took a quick look at the code that you have attached and you seem to be off to a good start. I ran a quick test and everything seems to be working. Depending on what rate you are sampling at and the speed of your computer, the queue may back up a bit since the consumer loop is system dependent. One way to optimize your code is to use the Basic Level Trigger Detection function instead of the Trigger and Gate express VI. Both of these functions should be in the same subpalette. This will allow the consumer loop to run faster and should remove any flickering that you are currently seeing.

Regards,
Kent
Applications Engineer
0 Kudos
Message 2 of 2
(2,799 Views)