09-23-2020 04:26 AM
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.
Solved! Go to Solution.
09-23-2020 06:29 AM
@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.
09-23-2020 06:47 AM - edited 09-23-2020 06:58 AM
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...
09-23-2020 07:01 AM
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?
09-23-2020 07:12 AM
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.
09-23-2020 07:24 AM - edited 09-23-2020 07:24 AM
09-23-2020 08:17 AM
Hi GerdW,
I believe that your suggestion works. I will implement in the other SubVi's this "buffer".
Thank you
09-23-2020 08:29 AM
@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.
09-23-2020 11:10 AM
Thanks