03-13-2017 07:45 AM
Hello:
I am using Mr. Troy's can recieve( forums.ni.com/t5/forums/postpage/board-id/170 )
But when I try to use it as a subvi connecting it directly; none of the outputs work.... I have connected them as I normaly do with a sub VIWhat is the correct way to fix this..... Can someone help me
03-13-2017 07:50 AM
First of foremost: NEVER implement a NEVERENDING loop on Windows targets!
Second: What is that boolean button you connect to the boolean input of that VI?
Hint: your link is malformatted. At least, i have no access right on the link you provided and i assume that most people here share my fate in regard to that.....
03-13-2017 08:28 AM
hello
Here is the link again!
It is the stop of the original vi
03-13-2017 09:08 AM - edited 03-13-2017 09:12 AM
@LP_C wrote:
[...]
It is the stop of the original vi
There you have your explanation. A subVI only returns values if it stops. EDIT: As you pass the button value to the subVI when the subVI is called and the button is false (unpressed), the subVI will never stop, no matter how often you press the button on the caller. If the button was true (pressed) at the moment of the call, the subVI will iterate one time and then finish execution.
In order to use that example as a subVI you have to rework the way it stops or you have to add mechanisms to transfer data in parallel (e.g. queue).
03-14-2017 05:30 AM
Norbert_B escribió:
@LP_C wrote:
[...]
It is the stop of the original vi
There you have your explanation. A subVI only returns values if it stops. EDIT: As you pass the button value to the subVI when the subVI is called and the button is false (unpressed), the subVI will never stop, no matter how often you press the button on the caller. If the button was true (pressed) at the moment of the call, the subVI will iterate one time and then finish execution.
In order to use that example as a subVI you have to rework the way it stops or you have to add mechanisms to transfer data in parallel (e.g. queue).
How Could I transfer the data in parallel?
That would work wonders!
Troy the creator of the original VI, told me this:
@@LP_C It looks to me like you're trying to do too much in your single "SUB VI".
The problem is that you're constantly opening and closing the port/channel. It's only open for a very short period of time before it's closed again so your missing all the messages. You need to keep the channel activated so the messages get stored in the receive queue, then you can read them out in the next loop iteration. Have a look where the while loop is in my receive example. You have to do something like that or make an "Action engine" style VI that stores the active port handle and state inside it etc.
So could you help me solve it please!
03-14-2017 09:47 AM - edited 03-14-2017 09:48 AM
Hello LP_C
As Nortbert_B mentioned you need to implement an architecture that communicates with queues. For example, the Producer/Consumer. http://www.ni.com/white-paper/3023/en/
As well, we strongly suggest avoiding nested loops (A loop inside a loop) so it is an important idea to take in consideration when developing code.
Diego H
National Instruments.
03-21-2017 02:39 AM
Hi guys
I still haven't understand or managed how to make it work............. 😞
03-22-2017 11:24 AM
LP_C
Start by reviewing this document.
Tutorial: SubVIs
http://www.ni.com/white-paper/7593/en/
Diego H
National Instruments
03-22-2017 02:38 PM
Start with the example that works. From there you can make changes and add features. The examples included in that library are perfect for Initializing, Writing, Closing, and one for Initializing, Reading in a Loop, Closing.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
03-27-2017 03:42 AM
I didn't managed to make it work. So I will run it without a sub VI.... I tried and tried.....