12-03-2024 02:43 AM
Hi, I have some Simple Vi which mimics instrument reading. I am reading every second but in the array like after loop completes, I want every minute data should store not every second.
I have attached the Vi.
Set the time target Like For example 180sec for 3min or 600 sec for 10min.
example if you set time target for 600 sec means 10 min it should only store data in array 10 reading that is every minute.
I have tried to use case structure and Quotient & Remainder. It stores value for every minute but not continuously store the data in array.
like
1min value stored
2min value stored
but in-between these minutes empty values are stored. I don't want that.
Please someone guide me.
SUMMARY: I want to read every second but log data every minute.
If I give wait ms in while loop 60000 it reads every minute and logs every minute. But when you try to stop it, it will stop after 1minute not sudden stop.
Solved! Go to Solution.
12-03-2024 03:30 AM
Hi Basavaraj,
@Basavaraj093 wrote:
SUMMARY: I want to read every second but log data every minute.
Have your loop iterate once per second to read a new value, but save the data only on each 60th iteration…
12-03-2024 09:42 PM
Not current Vi but, previous Vi did store the value at every min(60sec) but in-between these numbers it stores the empty value. (String Array)
I have attached how it looks like image, (String Array) not an actually reading but how its look like.
if I start it reads first reading at 0 sec i.e.10:00 AM
next reading is at 10:01 AM after 1min.
but in-between its empty that I don't want.
12-03-2024 10:19 PM
Here is the Updated Vi.
I have Run it for 3min i.e. 180sec.
I don't know why it is storing empty values.
12-04-2024 12:16 AM - edited 12-04-2024 12:27 AM
Hi Basavaraj,
@Basavaraj093 wrote:
I don't know why it is storing empty values.
Because you aren't able to debug your own VI!?
Just watch it working with highlight execution mode!
The generic answer is simply "THINK DATAFLOW!"
Code analysis:
Both items are dictated by "THINK DATAFLOW!" - the very basic LabVIEW mantra. (You should say it loud whenever you have problems understanding how your own code works.)
Suggestion:
Build the data array inside the case structure and use shift register(s) at the while loop to hold the array data. This is very basic LabVIEW stuff, and you should be able to implement it after the very first lessons of the LabVIEW beginner courses...
P.S.:
12-05-2024 02:47 PM
The reason the while loop waits 1 min to stop is because you place the wait function in the loop.
It runs the loop one time then freezes until 1 min passes.
If you want to have the front panel active, you need a different architecture.
for example using tick count function. when the time lapsed is over the 1 min, then it calls the function to the instrument and reads the data, before that, the loops keeps running and you can stop it