LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

display new panel ,timer to plot?

1.I want to display an new panel before main panel when clicking an button, then input and operate on the new panel ,and before closing the new panel,the main panel is unreachable,what should I do ? ?would you lieke to give me some examples,I am a beginner. thank you!!

2.Another question is how to use a timer to draw curved line dynamically, for example,every 10ms read the memory,then according to the variable to plot . thank you!!

0 Kudos
Message 1 of 8
(4,314 Views)

1. you can use the button to call a subvi, at the same time hidden main vi'front panel using vi reference and property node.

2. Using timed structure could ensure that you read from a variable every 10ms or other pre-confgured time.

0 Kudos
Message 2 of 8
(4,286 Views)

There are two steps for displaying panels to the user.  First, they must be loaded into memory using LoadPanel() which gives you access to them, and secondly displayed to the user using DisplayPanel() or InstallPopup().  These do not have to be one after the other.  So for number 1, I would load both panels into memory right away, which gives you access to both of them, then display the first one then the main panel later.


I'm not sure what you want for 2, but to do something periodically you should create a timer control on the main panel with a callback that fires every 0.01s, then put the code into the callback to read the data and plot it.  


0 Kudos
Message 3 of 8
(4,281 Views)
ok  ,with using installpopup to dislay a modle dialog.   thank you!
0 Kudos
Message 4 of 8
(4,262 Views)

timer to plot ?

the piriod is not that i want.  timer is 0.05s;

case EVENT_TIMER_TICK:

                             i[0]=i[0]+0.05;//时间步长0.05s50ms

                             y=50.0*sin(2.0*3.1415926*0.1*i[0]);//正弦函数的周期是10s

                             yyy[0]=y;//第一条曲线即正弦;

                             yyy[1]=0;//第二条曲线暂时设置为零;

         PlotStripChart(mainPanel, MAIN_PANEL_INNER_STRIPCHART, yyy, 2, 0, 0, VAL_DOUBLE);

 

but the actual curve is not a 10s sin curve wave,2.JPG

0 Kudos
Message 5 of 8
(4,259 Views)
2.JPG
0 Kudos
Message 6 of 8
(4,257 Views)
The strip chart control, by default, expects that a point to be plotted to it once per second.  In the "Edit Axis Settings" for the X axis, the "Gain" setting is the change in time (delta-time) between each point.  Currently it is set to 1.000, for your application it should be set to 0.050, then it will behave the way you would expect.
0 Kudos
Message 7 of 8
(4,234 Views)
great!!!!  thank you thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0 Kudos
Message 8 of 8
(4,228 Views)