LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to do fifo in labview?

Dear friends,
 
As i am writing the data into the .xls file through write lvm tool, I want to write the data in the FIFO style in a single file, mean data should overwrite in the file after each second and at each update data of earliest second should be removed from file and data with the latest should be in with overwriting the existing file. Can anybody sugget how i can do this?
Message 1 of 50
(3,485 Views)

Hi,

It depends on which Filo Input VI's you are using to write to file.

Look at attached VI to get an idea

All you need to do is select pos mode as 'start' and pos offset as '0' in file write VI.

This ensures that the file will only contain data writen in the last iteration

Regards

Dev

 

Message 2 of 50
(3,474 Views)
Hi
 
If you use the write LVM express vi, just configure it to overwrite the existing file (see picture).
 
Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 3 of 50
(3,472 Views)

Thanks Man,

But it wont work, when selecting overwrite mode, it only overwrites the existing file next time when i run the program, i want to overwrite the file in the current execution after each second.

 

Message 4 of 50
(3,466 Views)
I see - I didn't realise this as I never use this function.
I'm currently using LV7.0 - don't know if this is different in LV8.0, but the most secure way is to do it on your own (I very rarely use express-vi). So you know what's going on.
 
Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 5 of 50
(3,455 Views)

Hi Nishanth,

Do analyse the VI once more.

Since I have given the file opening option as 'create or replace', you feel that it is overwriting the existing file.

But,  what really happens VI once a file is opened is explained below.

  1. A file is created or replaced (if already existing) outside the loop.
  2. Inside the loop, if you observe, a fresh set of data is generated on every iteration. Now, each iteration's data is overwriting the previous iteration's data inside the while loop.
  3. when you press stop, you will see only the data from the last iteration in the file.

Is this not what you wanted to achieve?

Just to cross check this, Do the following:

Change the pos mode to 'current' in file write operation and you will see how data will be written into the file.

Here you will observe that the data generated in each iteration is saved and appended to the previous iteration's data.

Hope it answes your query

Regards

Dev

 

 

Message 6 of 50
(3,456 Views)

Thanks, Dev

Smiley Indifferent

Thanks for the clarification, i really undstadn what u explain, now its clear in my mind,now another question i want to ask is the 1000ms wait you have put up is for the 1000ms delay after each iteration????if yes it might be the perfect solution for me!!!!!Smiley Happy

Message 7 of 50
(3,445 Views)

Hi Nishant,

Yes it is just a dummy 1oo millisec wait for a delay after each iteration, i put it so that the while loop does not run randomly and take up the full process time.

That's it.

Regards

Dev

 

Message 8 of 50
(3,438 Views)

Hi Nishant,

Yes it is just a dummy 1000 millisec wait for a delay after each iteration.

I put it so that the while loop does not run randomly and take up the full process time.

That's it.

Regards

Dev

 

Message 9 of 50
(3,438 Views)
It's not just a delay - it also alows other loops to execute. If you have a loop without any delay, LV tries to execute it as fast as possible, what results in high CPU loads. So always place a little delay in a loop.
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 10 of 50
(3,438 Views)