01-16-2014 12:54 PM
Hello,
I have used GetCtrlVal command at different part of my program without any problems. But now I have problems.
First when I add a BINARYSWITCH and trry to run the program. It gives me the error message
"Undeclared identifier "PANEL_BINARYSWITCH_27". I have about 27 of these toggle switches in my display.
So I removed the new switch and used one that was already there as a spare. This eliminated the error msg.
Now I try to read the switch by using the command
GetCtrlVal (panelHandle, PANEL_BINARYSWITCH_27, &FSTAT)
The FSTAT is defined as an "int" everywhere in the program. The Control setting of the switch is also uses "int" for it.
Then I just want to test the value read using a printf comand or turning a LED on or off depending if the value read
is a 1 or a 0.
But the value read is always a 0 no matter how many time I toggle the switch.
Any ideas?
01-16-2014 02:00 PM
Hello bobby_y,
Could you please provide us with more code? What version of LabWindows/CVi are you using? My suspicion is that you might not call the GetCtrlVal in the right place.
Best regards,
= Nelu F. || National Instruments.
01-16-2014 02:27 PM
Hi
Can you try
SetCtrlVal (panelHandle, PANEL_BINARYSWITCH_27, 1);
sleep(1);
SetCtrlVal (panelHandle, PANEL_BINARYSWITCH_27, 0);
and check you see the switch move?
01-16-2014 03:43 PM
I have attached three files.
1) One shows you where I load and display the Main display. The function is called TEST.
2) Once the Binary switch 12 is toggled. Th eprogram calls the next function. that is called Manual_FLCV
3) Finally you can see that I read the switch and print it.
I know that it senses me toggling the switch because it calls the function and prints. But it always comes back
with a zero.
Thanks
Bobby
01-16-2014 03:45 PM
I just found out something interesting.
I tried the SetCtrVal command on that switch. But a different switch responded.
Never seen that before.
Any Ideas
Thanks
Bobby
01-17-2014 01:48 AM
Your observation suggests that something with your constants may be wrong...
- did you manually edit the include file of the UI resource file? (You never should) You may check that the file is ok: load the UI file into the UI editor and use the menu View / Preview User Interface Header File (do not modify it): every control should have it's unique name (per panel)
- are you using several (tab) panels? In this case make you need to make sure that you also reference the correct (tab) panel: controls are only unique on a per panel basis
- check spelling of the relevant constants, i, 1, l are easily mistyped
hope it helps
01-17-2014 12:01 PM
Check it. It looks fine.
Also there is no spelling issues.
The name of the file you asked me to check is "Untitled1.h".
Is that what it should be?
Thanks
Bobby
01-17-2014 02:29 PM
Hello,
I just find the problem. For some reason the "Include Paths" under the
"EDIT Project" menu was pointing to the wrong directory. This probably happened when I transfered the Project
from my LAP top to my desktop computer.