LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

General Advice on my Labview project

I am new to the LV operating platform, and I feel my self-taught (with much help from yourselves) program has evolved quite well. At this point I am looking for input on how I can streamline my programming and layout. I am using LV 6.0.2, with a (National Instruments) DAQCard-6062E, and a 16 channel backpane which has 5B isolation modules.
 
In the attached program, I sample 4 channels total (3 strain gages and a proximity sensor) to determine the loading on a subject in relation to a rotating mechanism which serves as the proximity sensor trigger.
 
I am fairly pleased with what I have thus far... but am sure there are shortcuts and better layouts which others may have seen many more times than myself. Please respond with even little comments, as everything is a new perspective that will provide a better overall understanding. Thanx.
 
#1:  I do have a serious concern which I hope someone can assist in... As you can see by my program, in order to initialize the strain gage reading, I use shift registers to move the data from the previous cycle to the next... and with 4 channels being used... I have piggybacked 4 input shift registers to keep everything in line. My fear is that when this program is expanded (I have 16 channels to work with) that I will have up to 16 shift registers for each data point that I need to bring in. This seems a bit messy, though could work in a pinch. Is there a better way to do this?
 
concern #2: the strain gages often have noise on them (I suspect from 60Hz power sources nearby), and I was initially sampling 16 points at 1000/sec (1-60Hz time period) and averaging (thus removing) said interferance. Unfortunately I couldn't get the x-axis time to work out due to the non-even (0.01666 etc..) multiplier that would provide the delta on the time axis. I could get it to start at the correct time, but after a limited amount of time, it was obviously incorrect. As i only have the LV6.0.2 base package to work with, I have no filters that I may use to allow an even timed sample. Any thoughts on this one?
 
OK, thats the biggest ones.. but as mentioned... any hints are welcome and appreciated. If you mod my program and resave.... please return it to a 6.0 format... as my 'puter does not like anything above 6.0.2.
 
Thanks in advance for your help.
Paul
0 Kudos
Message 1 of 2
(2,523 Views)

I'm not really into DAQ, so I'll just make some notes about the style.

In general, it looks OK. Much better than some other code I've seen, even by experienced people.

The first thing I would suggest is that you clean it up and make everything straight and clear, even at the cost of a larger diagram. I find it preferable to scroll a bit than to have to figure out what I was trying to write. The difference made simply by having the diagram clean and the wires straight is huge.
I also place quite a lot of documentation. People may claim that you can "read" a good diagram and that it's "self documenting", but I would still much rather read a free label that tells me what the programmer (including me) intended for this piece of code to do (and why, if needed) and then verify it by looking at the code than start figuring out from the code itself (and I do this even for relatively small pieces of code).

Another point is that you have some unnecessary coercions (the wait is a U32, the divide coerces to DBL, the VI inside the case accepts SGLs). This is not necessarily a big toll, but still can be removed. In newer versions coercions are clearly shown with a gray dot, but I don't think that was available in 6.0 (maybe as an option). Try searching google for Brian Benken. He has a site with some INI settings. It might be available there.
 
You can try reducing your SRs by using an array to hold the data, replacing the proper element each time and passing that array through the SR (although I will leave it to you to figure out how).
 
Try seeing if you can change the way you rebuild the array at the end. Building inside a loop is not a good thing. Once again, this is less critical in smaller arrays, but just a matter of style for some bigger arrays.
 
Proper error handling is important in order to know how to pinpoint an error when it occurs, although I'm not sure if any is needed in your program.
 
There are probably some other things that I can't think of at the moment, but in general, if it works, that's the important thing.
 
To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).

___________________
Try to take over the world!
0 Kudos
Message 2 of 2
(2,496 Views)