LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reducing sampling rate

Solved!
Go to solution

Hello every one...

       iam unable to fing one logic i.e i have an instrument which providing rs 485 data so iam able to read in labview but iam going to keep instrument on for long time so labview saving many samples in excel.my requirement is to save as per my specific sampling rate is it possible plese help me

0 Kudos
Message 1 of 8
(3,616 Views)

can you insert vi for clear understanding?

Best Regards,
Dhans 😉
Kudos are welcome 😉
Aspirant Labview Programmer (Labview 14) 😉
0 Kudos
Message 2 of 8
(3,613 Views)

This is the vi it is providing 2 to 3 samples in a second..but i need specific time ex: 20 sec 1 sample has to store

0 Kudos
Message 3 of 8
(3,589 Views)
Solution
Accepted by topic author hanumeshbujji

Hi hanumeshbujji,

 

when you want to save a sample each 20s you should program it that way!

Use the ElapsedTime ExpressVI, it will give you a boolean signal for saving samples in a case structure!

 

On your VI:

- Why is the BD so big? Why don't you use the AutoCleanupTool - it reduces your BD from 1688×503 down to 872×365 pixel!

- Why do you need to open and close the serial port in each iteration?

- Why do you use BytesAtPort? In combination with a TermChar???

- Why do you use BytesAtPort directly after the SerialWrite function? This is plain wrong!

- Why do you use a sequence structure? All is managed by DATAFLOW!

- Why has your path control NO label? Would you do programming in text-based languages without giving variables a meaningful name?

- Why do you write the header row with each sample? Usually you have just one header row with several rows of samples in spreadsheet files…

- There is no error handling in your VI: what happens when communication with your device fails?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 8
(3,571 Views)

Thank u sir...iam just testing the vi so i didn,t make it properly..anyway thank u so much sir.

0 Kudos
Message 5 of 8
(3,566 Views)

Hi hanumeshbujji,

 Here i have done small modification as GerdW said, for saving a sample for every 20 sec. But I did not do any thing to reduce a sample rate to 1. 

 

Hope it helps 😉

Best Regards,
Dhans 😉
Kudos are welcome 😉
Aspirant Labview Programmer (Labview 14) 😉
0 Kudos
Message 6 of 8
(3,515 Views)

Hi Dhans and hanumeshbujji,

 

you should configure the ElapsedTime ExpressVI to "restart when time has elapsed" to fulfill the requirement to save each 20 seconds…

 

No need for this silly outer while loop!

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 8
(3,504 Views)

Hi,

 

one more correction to my image above:

You need to move the first WriteSpreadsheet function (the one writing the header row) out of the loop - OR (atleast) set it to "append" mode too. Else you would overwrite your spreadsheet file again and again…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 8
(3,496 Views)