03-29-2010 12:36 PM - edited 03-29-2010 12:40 PM
Solved! Go to Solution.
03-29-2010 12:56 PM
03-29-2010 12:59 PM - edited 03-29-2010 01:00 PM
@Mark I did and it also works fine when you place your VI's parallel to each other, see the last image from my openings post,... this however limits your array.... try keeping code up to date where you have 99 VI's parallel to each other.
Thats why I created the for-loop in which the VI stands. For each element and thus iretation the VI must be newly created in the memory. This however doesn't happen, even when you set the reentrent.
03-29-2010 02:28 PM
Save the sub-VI as a template.
Open it using the reentrant switch (hex 😎 so it opens a new instance each time opened. Pass those refs to your For loop and use "VI Server call by reference" to call the right instance for each iteration.
But beeter would be to keep the array of cluster in a SR in the For loop rather than teh sub-VI and just pass in the state from the last time the sub-VI was called.
Or another approach...
Do all of teh reading and sub-VI stuff in an instance of a template, one for each counter. They can push their updates to queues so others can see what they have found.
Ben
03-29-2010 03:09 PM
Ben wrote:Save the sub-VI as a template.
Open it using the reentrant switch (hex 😎 so it opens a new instance each time opened. Pass those refs to your For loop and use "VI Server call by reference" to call the right instance for each iteration.
But beeter would be to keep the array of cluster in a SR in the For loop rather than teh sub-VI and just pass in the state from the last time the sub-VI was called.
Or another approach...
Do all of teh reading and sub-VI stuff in an instance of a template, one for each counter. They can push their updates to queues so others can see what they have found.
Ben
03-30-2010 03:09 AM
I've now the following...
This however returns a error after opening the reference, a error 7 warning...
Error 7 occurred at Open VI Reference in NBG - Encoder read array test.vi->Untitled 1.vi
Possible reason(s):
LabVIEW: File not found. The file might have been moved or deleted, or the file path might be incorrectly formatted for the operating system. For example, use \ as path separators on Windows, : on Mac OS, and / on Linux. Verify that the path is correct using the command prompt or file explorer.
VI Path: C:\ni-rt\startup\Encoder read.vi
LabVIEW Real-Time: VIs built into executables cannot be accessed through VI Server calls. Use Source Distributions to dynamically call VIs on Real-Time targets.
Now I searched for this and came here, http://forums.ni.com/ni/board/message?board.id=170&thread.id=449810&view=by_date_ascending&page=1, but the path files is not related to my problem since I don't have an executable just a VI.
I tried, http://digital.ni.com/public.nsf/allkb/A7DBA869C000B5AE862570B2007C4170?OpenDocument, where the input was the IP of the server but this doesn't work either it returns error 26
Error 63 occurred at Open Application Reference in NBG - Encoder read array test.vi->Untitled 1.vi
Possible reason(s):
LabVIEW: Serial port receive buffer overflow.
=========================
LabVIEW: The network connection was refused by the server. For TCP/IP, make sure the server is running and listening on the port you are trying to use. Firewalls can also cause a server to refuse a connection. For VI Server, make sure you have enabled VI Server from Tools>>Options>>VI Server.
I also enabled the VI server in tools options as described in the error, but that didn't worked either.
Any other idea's?
03-30-2010 03:43 AM
I did something very similar and opening the references worked without problems. Are you sure the VI is at the specified path on the RT system?
And something else, now you're opening new instances of the "Encoder read.vi" every time the VI is called, so you won't be able to use the shift register in the "Encoder read.vi". Open as many instances of "Encoder read" as you have tasks, then wire the array of references to the for loop along with the task array.
See image for a rough draft.
03-30-2010 07:05 AM
@dan_u thanks for your reply and noticing me to the SR. I know created a case which only gets executed at the first iteration, it does create then the necessary references
I don't get any errors now, but I don't get any data either. The blue line from array2 doesn't retrieve any values from the for-loop. What makes things more complicate is that I can't debug in the for-loop either because of the use of reentrent...
😞 pffffffffff
03-30-2010 07:19 AM
You can use the FP.open method after opening the VI reference to open the front panel of the VI that has just been created. Then you should be able to look into it and debug it.
03-30-2010 10:54 AM
Your For loop is being fed a non-initiialised shift register. If this array is empty, the contents of the loop will execute ZERO times (Code will not be run).
You need to initialise the shift register outside the loop.
Regards
Shane