LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

GetCtrlVal

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?

0 Kudos
Message 1 of 8
(5,153 Views)

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.

0 Kudos
Message 2 of 8
(5,148 Views)

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?

0 Kudos
Message 3 of 8
(5,142 Views)

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

 

Download All
0 Kudos
Message 4 of 8
(5,134 Views)

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

 

0 Kudos
Message 5 of 8
(5,133 Views)

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

0 Kudos
Message 6 of 8
(5,107 Views)

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

0 Kudos
Message 7 of 8
(5,069 Views)

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.

 

 

 

0 Kudos
Message 8 of 8
(5,053 Views)