LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What programming techniques should i utilise?

Hi All,

I just want some advice really. I am not a LV expert (i'm hoping to take the CLAD exam shortly) but i do know my way around it reasonably well. I am not a software engineer either, so i need some help with the big picture stuff as i embark on a project to get things right in the begining.

The Hardware - a number of PCI cards for pulsing/recieving and digitising that function together.

The software - there is currently  a C program that can control the cards, but i am developing LV to control it and do extra stuff. The company that produce the cards are interested in the end product so are willing to give me access to their software engineer as i develop things.

What i have already done - i've imported the dll's using LV8.20 and created a whole set of subVI's for controlling the cards. These subVI's work and i've managed to do quite a bit of the basic control and data read/write. So far so good.

What i need to do - I need to initalise the cards, set a number of variables, and then make repeated (very fast) calls to get data from the digitising card. Once i get this data i need to either stream it to disk (for v.fast aquisation) or run it through some further algorithms (fft, curve fitting, averaging etc). During running i may want to change some of the variables. At the end i need to uninitalise the whole thing.

I've been reading up on state machines, queues, master/slave, producer/consumer, but i'm not sure how to go about laying out the system. My thoughts are in the picture below.



Should i use schronisation? Should i use a programing framework like a state machine (there's not really any desicion making process). Will the above loops run in different threads?

I hope all that makes sense. Please feel free to comment and make any 'big picture' suggestions.

Phil

Message Edited by therealkilkenny on 02-08-2007 03:49 PM

0 Kudos
Message 1 of 3
(2,842 Views)

Hi Phil,

It seems that you're on the right track for approaching this project. All your while loops will be run in separate threads as long as you don't wire any dependencies between them (ie. wiring an output from one loop to an input in another loop).

The question of whether you should use synchronization such as queues or notifiers depends on whether you care about data being overwritten and/or duplicated. Basically, queues ensure no data is overwritten or duplicated (eg. Producer/Consumer model), and notifiers ensure no data is duplicated (eg. Master/Slave model). For example, you could enqueue elements in your fast loop and dequeue elements in your slow loop. This would mean all data that was acquired by your fast loop would be displayed on your front panel by your slow loop.

There doesn't seem to be any reason why you should use a state machine based on your project description. I would recommend using queues or notifiers based on how you want to display your data on the front panel. Another recommendation is that you might want to separate your fast loop into two loops: one for acquiring data, and one for analyzing/storing data. This is because analyzing/storing data usually takes a lot of CPU processing and might delay your data acquisition when used in the same thread.

Let me know if this helps and if you have any other questions.

Regards

Way S.

NI UK Applications Engineer

0 Kudos
Message 2 of 3
(2,769 Views)
I have an example program I have been meaning to post for awhile that does about what you are doing (just two loops, not three, though, and in separate VIs).  It uses queues for interloop communications.  If you have any questions, let me know.  Feedback on the example would be greatly appreciated.  It is intended as an example of how to create reference objects, but it works for general program structure, as well.
0 Kudos
Message 3 of 3
(2,748 Views)