03-10-2008 09:40 AM
03-10-2008 09:49 AM
You only need a single loop. You need to trigger an event or state which will print data to the screen every 5 seconds, and save a file every 10 minutes.
A "Wait Until Next ms Multiple" would be appropriate, but before I say that, I need to know how CPU intensive is the code within the loop? Could it excced the 5 secs before it has time to refresh the screen? If so, can you wait 10 seconds until it refreshes the screen?
RayR
03-10-2008 11:06 AM
Hi RayR,
The code within the loop reads 8 voltage channels from a multiplexer.If it only updates the screen every 10 seconds
that would be ok.Can you give me a basic diagram of how this would work ?
Thanks, Labtech5555
03-10-2008 11:49 AM
I will put together an example.. Be back soon.
RayR
03-10-2008 12:44 PM - edited 03-10-2008 12:44 PM
See attached example in LV8.5. I should have asked which LV version you are using.
The example is a simple version. It does not consider certain time criteria, but serves as a starting block to show how simple it can be. A better approach would be to compare actual time stamps instead of relying on iterations because it would not adjust to varying time in reading voltage measurements nor take into account time to write to the file. There are better ways of doing this, but I just wanted to present a basic version.
Hope it helps.
RayR
Just noticed you did mention LV8.0.. Let me see if I can convert.
03-10-2008 12:46 PM
03-11-2008 12:12 PM
03-13-2008 01:37 PM
Hi RayR,
Thats exactly what i am looking for,Thanks.
I have modified your basic progarm into my larger program.Only had to modify an few things to get the timing right
as my program runs about 20 times slower than your basic timed loop program.
I have one further modification i want to do to your basic program which i hope you can confirm can be done. ? Should be straight forward i think..
After say 5 minutes i want to do a sequencer of events using the frame sequencer if possibe then return
to log data as before.I'm at home now and don't have access to labview here so cannot try it.
Thanks,
Labtech5555
03-13-2008 08:42 PM
Yes, you should be able to add to it.
Personally, I stay away from any Sequence structures, especially stacked. If you need to run some sort of event in sequence, then I would recomment the use of a state machine. If the code would be used elsewhere, then a sub-vi is a better approach. You can also use a sub-vi intead of the state machine. Stacked Sequences are my personal enemy 😉
LOL!
Glad the code example helped and that you were able to build from it. Good job! 😄
RayR
03-13-2008 08:48 PM
I just had a look at the example code.. I had already forgotten what I did.
Actually, at first I was tempted to implement a state machine. Maybe I should have, but I wanted to keep it simple. So you could actually convert the outer Case Structure into a Stae Machine. Basically, create a enumerator and edit (enter) the various states (write to file, refresh screen and whatever new function). Wire that enum to the Case Selector instead of Refresh Screen boolean. Right click the wall of the case structure and select add case for every value.
Hope this helps.
RayR