Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

waveform chart

Hello!

I have a problem with "waveform chart".

We are recieving a signal from the serial port in a waveform chart. The problem that I have is with the X scale (time)

The time that shows the chart is not the real time and we need to view the real time because we want to know the period of the signal.

The X scale is showing 3 seconds when it really has gone about one second.

Thank you for your help
0 Kudos
Message 1 of 10
(4,370 Views)
You need to tell the chart what your sample rate is. It assumes a sample rate of 1. You can right click and select Properties>Scales. Select the X-Axis and change the multiplier. If your sample rate is every 3 seconds, enter a multiplier of 3. If it's every 500 msec, enter a multiplier of .5. You can also do this programatically. Look at the shipping example called Real-Time Chart to see how the delay value is wired to the Xscale.Multiplier property.
Message 2 of 10
(4,362 Views)

Hi Dennis,

I´ve seen your answers about problems with real time waveform charts.

I have a similar problem in my app (in attachment). I'm acquiring a 10 Hz senoidal signal and my sample rate is 250 Hz. I'm sending (serial port) it (a sample at a time) to another PC. In this one I´m running the vi in attachment. I have one chart and one graph (for testing). I don´t know what I have to do to my XScale show the actual time, that is: When I run the vi, as soon as I start the transmission the waveforms are showed in both graph and chart, but the time in chart Xscale run faster than the actual time, it starts at correct time and I can see 10 cycles of the senoidal signal in 1 second of the chart (10Hz as it is), so the multiplier is ok, but the XScale is showing the time later than the actual time. Why it runs faster?

I´d thank you if you could help me.

Celia

0 Kudos
Message 3 of 10
(4,167 Views)

Where exactly are you getting a sample rate of 250 Hz? The only thing you are sampling in this example is the serial port and you have no rate defined in the while loop.

Also, get rid of the sequence structure. It does nothing.

Message 4 of 10
(4,164 Views)

Dennis,

My sample rate is set by the transmission. The transmission app is in attachment.

0 Kudos
Message 5 of 10
(4,159 Views)

Dennis,

My sample rate is set by the transmission. The transmission app is in attachment.

0 Kudos
Message 6 of 10
(4,160 Views)
There's no timing in your transmission either. You've got a DAQmx Read of 1Chan 1Samp in a while loop with no timing there at all. Programming a value for the sample clock does nothing when you use on demand sampling. On demand sampling is strictly software timed. Change it to 1Chan NSamp if you want to use hardwire timed acquisition. Or, if you want to use on demand, put a wait (ms) in the loop. A timed loop will be better than the while loop you have.
Message 7 of 10
(4,158 Views)
I don't know if I understand what you said, but I don't want to put any delay time in the while loop in Transwave, I want it be as fast as it can be. When I run this two vi's together I can see in the waveform graph a number of cycles of the 10Hz senoidal signal corresponding to the number of samples of 4 ms (250Hz). This is is an example I´ve just run: 20 cycles of 10Hz signal in 500 samples in waveform graph. This is ok for me. I only want to know how to put the actual time in Xscale chart.
If you run the Real-Time Chart example putting delay time near 0 you will see that the time is not the actual time, that is what it is happening to me and I don't know how to fix it.
I asked too, about the chart history in RecWaveChart, I said that if the the number of samples doesn't reach the history length set, the waveform in chart is repeated several times and I´m already clearing the history chart before the while loop.
If anyone could help me I would thank you.
 
Celia
0 Kudos
Message 8 of 10
(4,141 Views)

I don't know how to make it any clearer. If you want the x axis to reflect actual time, the x axis multiplier has to equal  a sample rate and you have no sample rate. If you want 250 samples per second, put a 4 msec wait inside or use a timed loop equal to that. A timed loop would be the best solution.

It's possible that the serial port buffer is retaining old data since you may stop the client after the server is stopped. Do a VISA Flush buffer after you do the VISA Configure Serial Port and see if that helps.

0 Kudos
Message 9 of 10
(4,135 Views)
Let me modify my earlier comment. In order to use the waveform chart, you have to make a correlation between a known sample rate. However, if you use an XY graph instead, you can use the Get Date/Time In Seconds and wire that to the x axis. A regular or express XY graph can be used. The example below are set up assuming you want absolute time on the x axis. If you want relative time, then get a time stamp outside the loop and subtract the start time from the current time before converting it to a DBL.
Message 10 of 10
(4,125 Views)