LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I get my child class to write and then read data from an external bus while within the same "parent vi"?

My goal is that my main software is built with only a parent class. All devices have to do the same steps on the parent level, but I will always load in the specific child dynamically during run time, where it does its specific actions (different prep during initialisation or the like). 

Now the device needs to communicate with a CAN BUS. That communication I handle via User events. The wall I am hitting atm is that I cannot get the child to request new data and/or update the data since in the main I am still within the "init.vi" of the parent. Normally I would simply just update a global variable or an FGV, but the child being dynamically loaded prevents me from using it. Since whenever I tried, it wouldnt connect to the "same" variables. 
It is possible that what I am trying to do is simply not possible from a design perspective. Or there is a known way to solve this specifically. Either way I am grateful for any input.


Both the parent and the child classes are in separate PPL.

 

 

0 Kudos
Message 1 of 2
(161 Views)

Hi Thien, not sure if I'm getting everything correctly. But you are writing a hardware abstraction layer and want to add a CAN-Class to it.
I'm not getting what you need user events for or global variables. I think you would want to use NI-XNET inside the CAN Class Init.vi to do the device initialization, then wait a bit (maybe give the init.vi a timeout-input if the time can vary strongly) and return to the calling application.
If you assume that the initialization takes very long you could outsource it to a separate module/loop and then communicate a result back to the main application if something happened, but in many cases you would want your application to wait for all devices to be loaded before starting, anyway.
Hope this helps, feel free to explain your setup a little further.
Best, Jan

0 Kudos
Message 2 of 2
(78 Views)