From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
11-21-2012 05:11 AM
It might also be a good idea to have a look at the 'Getting Started with LabWindows/CVI' manual, it's latest version can be found here
Exercise 1 should have answered most of the questions discussed here ...
05-25-2013 03:27 AM
Hi again :). I tried to make my led blinking if the switch is on but I failed. I don't how to make a loop to run the 2 states of that led until the switch is on. Can you help me with this ?
05-25-2013 04:12 AM
You may use a timer control. You may want to start with looking at the example timer.cws
05-25-2013 05:28 AM - edited 05-25-2013 05:29 AM
int CVICALLBACK switch_f (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
GetCtrlVal(panelHandle, PANEL_switch, &switchstate);
break;
}
return 0;
}
int CVICALLBACK timer_f (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
int state;
switch (event)
{
case EVENT_TIMER_TICK:
GetCtrlVal ( panel2, PANEL_2_LED, &state);
if (switchstate == 1)
{
state ^= 1;
SetCtrlVal (panel2, PANEL_2_LED, state);
break;
}
else if (switchstate ==0)
{
SetCtrlVal (panel2, PANEL_2_LED, 0);
}
}
return 0;
}
I solved.
Led is on another panel: panel2(PANEL_2)
Switch is on : panelHandle(PANEL)
state ^= 1; change to the opposite state
Thanks Wolfgang
05-25-2013 10:04 AM
Now I have another problem. I have a picture ring(control mode: hot) and a another picture ring (set to indicator). First picture ring have 2 pictures and second more pictures. When I run the program and change the picture of first, the picture ring 2 must change with another picture. I put values on pictures on every ring but doesn't work. I tried with GetCtrlVal and SetCtrlVal. I think i need to use another function. Any idea?
05-25-2013 10:21 AM
SetCtrlIndex
In general it is a good idea to consult the help file that comes with CVI; in this case there is a section called Programming with Picture Ring Controls