LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

3 loops

I want to create 3 loops but not sure how to do or if possible to control datalogging from a voltage meter.
 
I want to loop for 5 hours then stop this loop
Within this 5 hour loop i want to do 2 further things.
Print data to the screen every 5 seconds and i also
want to save this data to file every 10 minutes.
 
I know how to do the 5 hour timer and 10 min timer but not sure how to format the loops so they work correctly as above.
Can anyone give me a basic outlined example of how to format the loops ?
 
I am using labview 8.0
 
Thanks,
             Labtech5555
0 Kudos
Message 1 of 12
(3,354 Views)

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

0 Kudos
Message 2 of 12
(3,353 Views)

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

0 Kudos
Message 3 of 12
(3,334 Views)

I will put together an example.. Be back soon.

RayR

0 Kudos
Message 4 of 12
(3,323 Views)

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.



Message Edited by JoeLabView on 03-10-2008 01:44 PM
0 Kudos
Message 5 of 12
(3,315 Views)
0 Kudos
Message 6 of 12
(3,310 Views)
Thanks,I'll look at it tomorrow as offsite today.

Labtech5555
0 Kudos
Message 7 of 12
(3,293 Views)

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

 

0 Kudos
Message 8 of 12
(3,274 Views)

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

0 Kudos
Message 9 of 12
(3,263 Views)

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

0 Kudos
Message 10 of 12
(3,261 Views)