waveform questions

3 posts / 0 new
Last post
Offline
Last seen: 3 years 8 months ago
Joined: 03/12/2021
Posts: 10
waveform questions

Hey

I've been going through the Getting Started Guide and I'm in the complex type generator section.  I thought I'd take a shot at Reading and Writing a waveform.  I read here that the correct way to do it is to unbundle the waveform and send its individual elements in a cluster with the timestamp converted to a string.   I've done that, and it MOSTLY works, but I think I have a syncronizing issue.  

This is what my Writer code looks like...the simulate signal block is generating 100 points of a 1000 sample/sec sine waveform at a time and is sending it into the rti write vi:

And this is what my Reader program looks like:

What happens is the Reader will occasionally flicker and the waveform will have a gap in it...

So I think it's some kind of timing issue.  If I change the delay time in the reading loop, things get really weird

What is the correct way to do this?  Are there some best practices I should know about?

Also, how would I Read/Write an array of waveforms?  This would be really useful since I usually am sampling 8 or so channels at the same time.

Thanks

J

Ismael Mendez's picture
Offline
Last seen: 10 months 4 days ago
Joined: 07/03/2017
Posts: 74

Can you describe what happens when you remove the wait from the loop? If you do a read with option OnlyNewSamples set to true when there is no new sample pending to be read it returns the cluster default value (numeric values set to 0 by default). Use the SampleInfo->valid data boolean to avoid this. Update the graph only when there is valid data. Another option is using blocking read with a 100 ms timeout? Blocking read feature is only available in Toolkit 3.0.0. Can you try it?

If the issues still persistCould you upload the VIs so I can have a look?

Offline
Last seen: 3 years 8 months ago
Joined: 03/12/2021
Posts: 10

Thanks, The SampleInfo->validdata boolean did the trick