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: 

how to set real time waveform chart

I would like to record voltage signal from built-in microphone. My block diagram is attached.

 

I would to like record 1second data every 10min and then take an average of that 1s data so that I have 1 data point about every 10min. The time of the origin of the chart must be kept at start date and time all the time and the program need to run until I stop it. 

 

But I cannot set the date and time to be real time. How can I make it?

 

Thank you very much.

0 Kudos
Message 1 of 6
(2,971 Views)

Hi

 

Attached is a module that should work the way you wanted it to. Let me know if it works.

 

1. in your vi, the program would run only once, wait for 60 seconds and then stop.

2. you need a while loop, for the program to run till you stop.

3. in my code, the elapsed time funtion will count for Time target you enter in seconds. i kept it for one hour as defautl value.

4. by setting the minumum value on X scale of the graph, you can ensure that the graph starts plotting with the current time as the first sample.

5. you can then build a waveform usign the current time and the Y data as shown in the code

 

i hope i have udnerstood your requirement correctly and posted the required solution

Regards
Freelance_LV
TestAutomation Consultant
0 Kudos
Message 2 of 6
(2,963 Views)

Hi phx,

I send you an example which does what you want.

 

----------------------------------------------------------------------

Hola phx,

Te envío un ejemplo que hace lo que quieres.

 

 

Diego.

------------------------------------------------------------------------------------------------------
«Al bien hacer jamás le falta premio.» or «Doing good never lacks reward”»
Cervantes.

(Give Kudos to Good Answers, Mark it as a Solution if your problem is Solved)
(Da Kudos a Buenas Respuestas, Marca como Solucion si tu problema está Resuelto)
0 Kudos
Message 3 of 6
(2,957 Views)

Freelance_LV, Thank you very much for your editing, I am testing the program. I have some questions.

 

1. Why can't I just using continuously running to run my program to make to run continuously?

 

2. From your diagram, what I realise is that in 3600s, the signal of time sends data to "elapsed time" every 0.1s until the elapesd time is the same as target time so the the "True/False" Loop" can run. My question is, once the the "True/False loop" start runnig, how long does it run? 1second? Or is my understanding about the flow wrong?

 

3. The minimum sample rate of the "acquire sound" is set to 11025Hz which is also the sample length of the "Mean". Does it mean that the mean it takes is the mean of the amplitude of latest 11025 samples?

 

4. Why isn't the x-axis the current time if I just put the diagram inside the True/False Loop out to a new VI?

 

Thank you very much!!

0 Kudos
Message 4 of 6
(2,941 Views)

diegoperezdediego, Thank you very much for your help. I am now testing the problem from Freelance_LV. I would try it tomorrow. Many Thanks.

0 Kudos
Message 5 of 6
(2,936 Views)

Hello

 

answers are in blue


@phx wrote:

Freelance_LV, Thank you very much for your editing, I am testing the program. I have some questions.

 

1. Why can't I just using continuously running to run my program to make to run continuously? it is a good practice to use a while loop and run the code, than use the run continuously button. my understanding is that the run continuously button will cause the code to run at the highest possible processor speed and will use up the entire load on the processor. by using a while loop and placing a small delay, we can ensure that the cpu is not loaded by our program. But, i hope our seniors could provide the correct explanation to it.

 

2. From your diagram, what I realise is that in 3600s, the signal of time sends data to "elapsed time" every 0.1s until the elapesd time is the same as target time so the the "True/False" Loop" can run. My question is, once the the "True/False loop" start runnig, how long does it run? 1second? Or is my understanding about the flow wrong? check the attached code. i made some additions, to answers your question.

 

3. The minimum sample rate of the "acquire sound" is set to 11025Hz which is also the sample length of the "Mean". Does it mean that the mean it takes is the mean of the amplitude of latest 11025 samples? would suggest you use Mean vi than the Mean Pt to Pt vi. logically, the mean vi should read the input array of data, calculate the mean of the values. there is no 'latest' here. the mean vi gives the mean value of the array at its input. the acquire sound vi will read the data from the microphone at the sample rate mentioned. you said the min sample rate if 11025 Hz. but your code shows 8000 Hz as input!

 

4. Why isn't the x-axis the current time if I just put the diagram inside the True/False Loop out to a new VI? you will need to set the start time of the X-axis using the property node X-axis range minimum value. Else, the chart/graph will take the standard start time as 1/1/1981 and 0.00 time + or _ the GMT zone.

 

Thank you very much!!


 

Regards
Freelance_LV
TestAutomation Consultant
Message 6 of 6
(2,913 Views)