LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SubVi Reset Data

Solved!
Go to solution
Highlighted

I have a loop that processes a queue with CAN data.
Inside I have a few SubVi's that will process the data.

The problem is, I am only processing the data from one CAN node in the network. In the SubVi I have this comparator if I have the CAN ID that I want to process, with a Switch Case. The problem is when I receive the data, everything is okay in the main loop, otherwise, when I receive a Data that is not processed in this SubVi, this SubVi returns a default value to the main loop. How I prevent this to append? I want to keep the last value in the main loop until a new decoding message is processed in the SubVi.


PMSilva_0-1600852966917.png

 

PMSilva_1-1600853094519.png

 

 

0 Kudos
Message 1 of 9
(245 Views)
Highlighted

@PMSilva wrote:

 I want to keep the last value in the main loop until a new decoding message is processed in the SubVi.


Use a shift register. Put the data in it on the right side, and use the left side to get the last value. 

0 Kudos
Message 2 of 9
(216 Views)
Highlighted

So put shift register in the main loop, correct?
But why this append? If in the SubVI the Switch Case is not executed, why the value is reset? 

Still don't work...

 

PMSilva_0-1600862295781.png

 

0 Kudos
Message 3 of 9
(208 Views)
Highlighted

Hi PMSilva,

 


@PMSilva wrote:

So put shift register in the main loop, correct?
But why this append? If in the SubVI the Switch Case is not executed, why the value is reset? 

Still don't work...


Which "value is reset"?

What means "don't work"?

Mind to attach your VIs instead of pictures of code?

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 4 of 9
(197 Views)
Highlighted

I receive a CAN frame in the Queue.

I have several SubVi's to decode the messages, each one for different messages.

When I receive a message, for example, to decode the Modes of Operation for a given CAN Address, the SubVI will check the message, and if has the same Address and the CAN message is for Modes of Operation, in the SubVi I will execute the Switch Case. Inside this Switch Case I have the decoding algorithm, that send the data out to the main loop.
Everything works fine, when the message is decoded. When the message is not decode, as suppose to... This SubVi puts the value output as a default.

Download All
0 Kudos
Message 5 of 9
(189 Views)
Highlighted
Solution
Accepted by topic author PMSilva

Hi PMSilva,

 

due to your LabVIEW version I cannot open your VIs.

 

But the solution should use something like this:

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 6 of 9
(184 Views)
Highlighted

Hi GerdW,
I believe that your suggestion works. I will implement in the other SubVi's this "buffer".
Thank you

 

 

PMSilva_0-1600866995448.png

 

0 Kudos
Message 7 of 9
(175 Views)
Highlighted

@PMSilva wrote:

Hi GerdW,
I believe that your suggestion works. I will implement in the other SubVi's this "buffer".
Thank you


If you're going to build it into subVIs, they need to be reentrant. If not, each subVI will really work as a buffer, and that's probably not what you want. The subVI instances will start to communicate with each other.

0 Kudos
Message 8 of 9
(169 Views)
Highlighted

Thanks

0 Kudos
Message 9 of 9
(150 Views)