Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

USB-6009 AI Diff Reading Problem

Hello,

 

I am currently using Measurement Studio 2012 to develop an application that communicates and takes readings from a USB-6009 piece of hardware.  Right now I have coded a UI to show me differential readings that I am taking from the USB-6009 from channels AI0 and AI1.  I have 2 each Kistler pressure transducers that are being powered with its own DC power supply.  I am applying 50PSI to one transducer and 100PSI to the other tranducer.

 

If I have only one transducer hooked up, (AI0 for example), and only one task that is setup in my program for that channel, the pressure that I am seeing in my program is valid and correct at 100PSI.  If I move this tranducer to a different channel, like AI1, AI2, or AI3, then I still get good results.  Now the problem lies when I have more then 1 channel being used on the USB-6009. 

 

This is the setup I have that causes the issue.  I have tranducer 1 pressurized to 100PSI on channel AI0 and tranducer 2 pressurized to 50PSI on channel AI0.  When I run my program, both channels will always read the same pressure as tranducer 1(100PSI).  They should be reading different.  The readings I should be getting is transducer 1 reading 100PSI and transducer 2 reading 50PSI.   

 

I did some changes to see if I would get different results and nothing worked.  One change I attempted is that I ran a jumper from AI0- to to AI terminal 4 GND and ran a jumper from AI1- to AI terminal 7 GND.  This changed nothing and did not resolve the issue. No matter which terminal GND I ran the jumpers to the issue still remained. Another change I tried is to move transducer  1(originally on AI0 100PSI), to channel AI1 and move transducer 2(originally on AI1 50PSI) to channel AI0 and the result was still the same, but instead of all channels reading 100PSI, they read 50PSI.  This showed me that as long as my program has more then 1 channel setup, then all channels will always read the same as the lowest AI channel that is hooked up.  So if the lowest numbered AI channel that I had hooked up was AI3, then any channels after that AI channel that is hooked up will read the same as the channel AI3.  I have reviewed my code and confirmed that my code is indeed setting up each channel to its own separate physical channel.  I don't understand why this behavior is happening.  Any help would be greatly appreciated.  If you need to know more info about what I have going on or questions, just let me know and I will provide as much information as I can.

 

Thanks!!

0 Kudos
Message 1 of 3
(5,246 Views)

Additional Info:

   One thing I should of tried ealier is to load up MAX and see what readings I get. I do indeed get different readings from AI0 to AI1, like I should.  I figured that info would be important.  I still have the issue but I am going to comb through my code and see if there are any other issues going on.

0 Kudos
Message 2 of 3
(5,243 Views)

Solved!!

 

I just wanted to post the solution to the problem so in the future people can see this solution if they come across the same thing.

 

I analyzed my code and seen that maybe the way I was creating the instance of the AnalogSingleChannelReader() class was being done wrong.  I was taking readings at a particular frequency and at each iteration I was recreating the class variable AnalogSingleChannelReader() for each channel.  I would then take a reading then null the class then recreate it again and setup for the next channel to be read.  Doing this was the cause of the problem.  I refactored my code to have each channel have its OWN AnalogSingleChannelReader() class encapsulated with the channel class I created and just created the reader class one time.  This would cause the program to have its own AnalogSingleChannelReader() class solving the issue.  I am glad that I have figured out the issue and now hope that this post can help somebody in the future.

0 Kudos
Message 3 of 3
(5,235 Views)