LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI for recording data

Hi all,

I am a mechatronics student, and am new to labview. Needed some help with a few things to get started. I am using labview student edition 2009 and a NI 9213 temperature module with NI USB 9162. I wanted to design a VI that would in essence do the following tasks:

 

1. Check to see how many sensors are connected and display LEDs for the same.

2. Take an average of the sensors values. (but only those which are connected).

3. Show sensor values and deviation of the individual values from the calculated average.

 

I have started the design of the VI but am just in the basics. I wanted to know how it is possible to check data coming from DAQ satisfies a set of given 'if then else' conditions?

I hope you can help me out.

Message 1 of 6
(1,128 Views)

Well I don't ever use the DAQ Assistant or the Dynamic Data Type but I can help you with two things right off the bat.

 

1.  TCs report a very high number when they're NOT connected.  Almost all types can go below 0 degrees (C or F).  So, using less than zero isn't a valid way to determine if a TC is hooked up to a channel.  Try actually disconnecting one and see what temperature comes back.  (Hint: If it's close to the surface of the sun it's probably not valid. Smiley Wink)

 

2.  DAQ code set up for multiple channels returns an ARRAY of values.  Index that array in a loop and put your code there rather than copying everything 16 times.

LabVIEW 8.5.1 - 2019 Pro Dev
0 Kudos
Message 2 of 6
(1,119 Views)

Hi,

 

Yea I am aware of the fact that an open channel on the DAQ results in a value of -55000 or so.. So I used a simple check for positivist of channel data to check if a T/C is connected... Because I'm only interested in temperature ranging from room temp up to 200C. So just put in a simple check for connection / disconnection of a T/C in a channel. Hope this was a simple solution.
Also thanks for the input on using a array instead of repeating stuff 16 times 😉 I knew there was a better way but didn't know the solution.. 🙂

 

Roshan

Message 3 of 6
(1,110 Views)

Hi,

 

So i tried working a little further to develop the VI to check for if a signal was (+ve), if so then it is relevant for calculation of average else dicard...

I wrote down a simple C/C++ code as I am used to programming in that.. it goes as follows :

 

avg,count, loca_sum = 0;

for (int i=0;i<=15;i++)

{

         if (a[i]>0)

         {

                local_sum = Local_sum + a[i];

                count ++,;

         }

}

avg = local_sum / count

 

I wanted to implement this simple for loop into my labview VI.... but i was not sucessful.. can some one help me out with this...

0 Kudos
Message 4 of 6
(1,087 Views)

Your code makes no sense. First, you are only taking a single sample per channel. What sort of average do you want to take? The average for all channels? You certainly can't take an average for a single channel unless you use the point-by-point mean function. If you had multiple samples, just use the standard Mean function. There is even an express VI (Statistics) that you can use.

 

You should take the basic LabVIEW tutorial.

0 Kudos
Message 5 of 6
(1,070 Views)

Hi Dennis,

 

If you would have read my first post you would've probably understood my problem.

I want to check how many sensors are connected and online, and take an average of those that are connected and display them.... Can you help me to do this.. I am not sure how to split the signal coming from the DAQ as it is an array and i need to acess the individual elements of this array to check if connected and then decide to take them into account for calculating the mean of those.

0 Kudos
Message 6 of 6
(1,043 Views)