From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Real- time peak detection and export

Hello people,

i know this topic has been extensively answered on this forum and but after spending day i still can't make it happen.

 

I am acquiring a sinusoid at a sampling rate of 20 Khz, with 2Khz samples per channel. For test, i have a sine signal with frequency 500Hz. This means i have a peak every 40 points.

 

With this i can see that i have 50 peaks per second ( which makes sense since i have 2000 samples per second).

 

Now when i try to export this into a text file, i could export my sine signal as expected, but for peaks i only get 50 peaks no matter how long i record.

Any help would be much appreciated.

Thanks in advance

0 Kudos
Message 1 of 4
(2,594 Views)

If you attach your VI or project, you might get some help. Otherwise people cannot see your code.

0 Kudos
Message 2 of 4
(2,561 Views)

zezendapuss wrote:

I am acquiring a sinusoid at a sampling rate of 20 Khz, with 2Khz samples per channel. For test, i have a sine signal with frequency 500Hz. This means i have a peak every 40 points.

 

With this i can see that i have 50 peaks per second ( which makes sense since i have 2000 samples per second).


Let's clean up some terminology first.  You have a sample rate of 20kS/s.  Each time you read the buffer, you read 2kS.  So each iteration is 100ms.  So you are detecting 50 peaks/iteration, which makes sense (500Hz•0.1s=50).

 

Now as to your problem, my guess is that you are overwriting your file each iteration.  But without code, that is a complete guess.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 4
(2,558 Views)

Here is the vi i have been using. I could plot the peaks in the graph but still cant figure out how to export these peaks in a txt file.

0 Kudos
Message 4 of 4
(2,524 Views)