05-02-2008 12:44 PM
Thank you both very much for answering my questions. My next question is not quite related with CLAD, it's a design question that has been with me for over a year and I couldn't figure it out, couldn't get much help from NI tech support either.
In my program, data is from an RS-232 port, this is a rather slow process, it takes over one second to get one set of data in, we can not do anything to the feeding rate, the only thing we can do is to wait until it's available. On my front panel, I need to display some charts which update every second, I want to keep the update time strict. What I'm using is parallel while loops and local variables are used to pass data between loops. In general, the programs work ok, some times the one-second update loops run late. I'm reading the design patten article from NI website. It mentioned using master/slave design pattern with notifiers. I tried it, with master sending data and slave accept data. If the master is running faster, then the slave can keep the one-second update rate and just throw away the undisplayed data points in between. But if the master is running slower than one second, the slave will wait for the data and keeps the same update rate as the master one. I tried to have time out, it will add zeros to the the series that's not whatI want to see, it will make the charts messy. What I want is if there is no new value, just use the old value.
Even though I read from the articles saying the master/slave structure is just for this kind of application, I have never figured out how I can make it work. Please give me some advice/comment. I hope I have made myself clear enough.
Best regards,
Guangde
05-02-2008 12:55 PM
You're kind of stuck there. If you need to update a value once per second, but the source of the data can't give it to you that fast, then what? What do you want the graph to show every second if the new data point has been received yet?
You could put a timeout on the queue so that it guarantees to return and finish the loop within the second. But if it times out, you have nothing but the default data (which is why the zeroes.). You could maintain the last received value in a shift register, and in a case structure, if the queue times out, plot the last data point again instead of a zero.
05-02-2008 01:10 PM
If you use a waveform data type chart, you can leave the array (in the WF) for the slow data source empty and just plot what dat you have. The Chart will plot the info you gave and connect the dots bewteen updates for each plot.
Ben
05-02-2008 01:16 PM
05-02-2008 02:19 PM
05-02-2008 02:52 PM