LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple string data to same local variable >> to CAN write

Hi labview community,

 

I've got a Xnet Write Frame:

CAN data 2.png

 

With as input a Data 2,

To this input i wanted to simulate buttons, every button has its own code:

 

CAN data.png

 

so, my qeustion is: how can i put only one button at a time on, because now every button is connected to ''Data 2'' and they send all codes at the same time

 

Thanx Community

 

kind regards,

 

NAsrih

0 Kudos
Message 1 of 3
(2,534 Views)

Hi,

 

I suggest you use a radio button (don't know the real english name). It is in the boolean palette. Only one of its entries may be selected at a time.

If you're set on single buttons you could always monitor their value changes with an event structure.

 

I'd also suggest to get a little more familiar with LabVIEW's dataflow paradigm.

What your pictures show seems like an abuse of local variables and introduces trouble like race conditions into your code.

0 Kudos
Message 2 of 3
(2,527 Views)

Yup think with data flow, if you could do this with just one while loop many issues will go away.  Doing it wrong will make other issues but still it is the more correct way of doing this type of task.

 

In the past when I needed to do something like this I would have on my main UI an enum of the modes, and then a Send button.  The user picked the mode, then clicks send, and that goes into a case where the enum value is read and that value can be written.  If you want more than one of these to go out at once you may want to look into using the XNet Signal API which will periodically send the message for you, so you don't need to keep calling it.  Then your loop doesn't even need to run and can just sit waiting for user interaction.

0 Kudos
Message 3 of 3
(2,506 Views)