05-30-2012 09:07 AM
Is there anyway to make an xcontrol generate custom events? For example, I'm building a waveform graph that has some custom autoscaling options. When I place the control on my VI, I get the standard events including value change. However, that is only the main data type value change. I have a couple numeric controls that change the autoscale behavior. I'd like to have an event that response to that value change. This would be in my main VI, not in the facade VI. I know how to do it there, but in that case it only affects execution within the xcontrol.
05-31-2012 02:43 PM
I am wondering, what kind of "custom autoscaling options" have you implemented specifically? In what way do your numeric controls "change the autoscale behavior?"
05-31-2012 07:32 PM
My trouble with the NI autoscale implementation, is it roughly fills the plot area. Our particular signal is very noisy so it looks terrible in autoscale. We are also looking for random (though infrequent) spikes in the signal, so when one comes up, the change is harsh and difficult to watch. The autoscale I've implemented is based on a fixed range (although I've toyed with one based on the standard deviation of signal) that tracks around the mean. I also include the ability to offset the signal so the mean moves either up or down on the y-axis. The result is a signal that I can keep squished down and watch for the spikes we are interested in. I wish NI gave some parameters to adjust the autoscale like this, but as far as I can tell, the autoscale is all or nothing. Correct me if I'm wrong.
Doing this in an xcontrol is much better than my previous implementation since I can drop it in any program without having to add any code that periodically adjusts the scale. Now it will just do it everytime I write new data to the control.
05-31-2012 11:56 PM
You can create user event when initializing xcontrol and return it via property node. You'd fire the event from within xcontrol when necessary and catch it in external event structure after dynamically registering. Remember to add uninit ability to your xcontrol, where you destroy created user event.