LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

progrmmatically change boolean switch value in labview when logic condition is set

Hi

 forums.ni.com give me good knowledge during my LabVIEW Programming Thanks to all supporting to me to develop an application. 

I have using boolean switch or rind control in event structure with while loop,when user press particular button/switch it is activated,its working fine.My problem statement is that when particular logic function is set for the same boolen switch,how to change status of partular switch with in the event structure,i searched in forums we have to use property node for that onebut its not updating .I have attached snap/photo for this Vi 

0 Kudos
Message 1 of 5
(5,617 Views)

The logic in the event structure doesn't make sense.  You should look at the context help for the Select.  In your code, you'll always pass the value of drive through.  If you delete the select, both constants, and the associated wires, you'd get the same results.

 

What do you want to do with the visibility of the drive?  You can right-click the property node and change it to write.  Then, you can wire a boolean into it to modify the visibility.  But, that doesn't seem to be like what you'd want.  

 

If you want to use a boolean, do so.  Don't use an integer.  An integer is NOT "boolean 1."  It's an integer.  Yes, you can do bitwise logic.  But, that doesn't make it a boolean.  Use logic that is simple.  When you start adding complexity for the sake of complexity, your code becomes unreadable.  There's zero benefit, only drawback.

 

It sounds like you're trying to make the logic on the right trigger an event in the left loop.  If this is the case, change the property you're looking at to Value (Signaling) and change it to write.  Once you've done that, replace the local variable you have with the Value (Signaling) property node and you should see the behavior you desire.

0 Kudos
Message 2 of 5
(5,609 Views)

Hi 

   As you explained i used  event structure  with when particular logic function bPowerHI=1 it's  should set Drive status of boolean switch value to  the TRUE i.e bPowerHi=1 it's set Drive status =TRUE Value or bPowerHi=0 it's set Drive status =FALSE Value., is there another way to set the TRUE or FALSE Condition boolean switch.Previously I have used CVI Ansi C programming there i have use two function setcontrolvalue or setcontrolattribute.AS shown like


if(CCS->bPowerFault)
{
SetCtrlAttribute (pnMain, PN_MAIN_CMD_DRIVE_ON, ATTR_DIMMED, TRUE);
SetCtrlAttribute (pnMain, PN_MAIN_CMD_DRIVE_OFF, ATTR_DIMMED, TRUE);
}
else
{
SetCtrlAttribute (pnMain, PN_MAIN_CMD_DRIVE_ON, ATTR_DIMMED, FALSE);
SetCtrlAttribute (pnMain, PN_MAIN_CMD_DRIVE_OFF, ATTR_DIMMED, FALSE);
if(CCS->bPowerOn)
{
SetCtrlVal(pnMain, PN_MAIN_CMD_DRIVE_ON, TRUE);
if(!CCS->bPowerHi)
{
SetCtrlAttribute (pnMain, PN_MAIN_CMD_DRIVE_ON, ATTR_ON_COLOR,
VAL_GREEN);
SetCtrlAttribute (pnMain, PN_MAIN_CMD_DRIVE_ON, ATTR_ON_TEXT,
"Drive Hi");
}
else
{
SetCtrlAttribute (pnMain, PN_MAIN_CMD_DRIVE_ON, ATTR_ON_COLOR,
VAL_YELLOW);
SetCtrlAttribute (pnMain, PN_MAIN_CMD_DRIVE_ON, ATTR_ON_TEXT,
"Drive Lo");

}
}
else
{
SetCtrlVal(pnMain, PN_MAIN_CMD_DRIVE_ON, FALSE);
SetCtrlAttribute (pnMain, PN_MAIN_CMD_DRIVE_ON, ATTR_OFF_TEXT,
"Drive On");
}

LIKe that i have boolean switch Value set TRUE or FALSE when patrticular logic function set.I have to attached modified VI picture of progrmmatically Switch or Change boolean switch value namely (Drive status) in labview when perticular logic condition is set.

0 Kudos
Message 3 of 5
(5,565 Views)

Your code is still a total mess (Lots of Rube Goldberg style constructs!).

 

Please attach the VI instead of pictures.

 

What changes the state of "bPowerHi"? What is a "logic function"?

 

 

0 Kudos
Message 4 of 5
(5,552 Views)

Please try to understand what I said before telling me what I said.

 

stopit.png

 

You can use the snippet or the attached VI.  In either case, you'll see you get the same value whether you have the select in there or not.  If you're EVER wiring a constant into the selection portion of a select, you're doing it wrong.  Stop it.

 

Read this: http://zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/caveatsrecmndtnsevnts/

 

You need to start taking tutorials before you jump right in.  You're making tons of mistakes that are going to cause you worlds of frustration later.  You don't know enough about LabVIEW to use two event structures.  If you need more than one, you're generally doing something wrong.  Why would you EVER go through all the effort to check if a value is equal to 1 before feeding it into a case structure?  Feed the value into the terminal instead.  Have a case for 0 (default) and 1.  Use the same F/T logic you have now for those two cases.  Get rid of all the nonsense in front of it.

0 Kudos
Message 5 of 5
(5,519 Views)