12-20-2017 09:26 AM
Hi All,
I see that the code generated for a static channel module does not include an init.vi. Where would be the right place to put any initialisation code, and how would I pass references etc to user output and input vi's?
Bruce
Solved! Go to Solution.
12-20-2017 09:43 AM
You can still add an override of the Init method for a module created from the static template, we just have not included it in the pre-scripted code since most folks do not need to change the default behavior.
Right-click on the runtime Class, choose New>>VI for Override... and select the Init method.
12-20-2017 10:46 AM
Make sure you don't delete the 'call parent method' call when you make the override. If you delete this, you'll lose the pre-scripted initialization code that creates the channels for your module. Just extend it by doing your other calls after the 'call parent method' function.
12-21-2017 05:24 AM
@MattP wrote:
Make sure you don't delete the 'call parent method' call when you make the override. If you delete this, you'll lose the pre-scripted initialization code that creates the channels for your module. Just extend it by doing your other calls after the 'call parent method' function.
Thanks Matt, my bad for not thinking OO!! Quick question, I see the user output.vi is not passed the class data structure? Why is this the case? In the static module situation, it means the user output/input etc does not have access to class data.
In the Dynamic Channel situation, there are no user methods generated.
Bruce
12-21-2017 08:41 AM
The user input, user process, and user output methods are there to completely abstract away the OO elements and just expose the data clusters. This was done to allow a user with minimal LabVIEW knowledge to drop in an existing algorithm into a DCAF module. We expect more advanced users will modify or delete them.
You don’t need to keep those methods - you can add items to their connector panes or delete the methods entirely and just edit the input, process, and output methods with whatever custom logic you desire.
12-21-2017 04:45 PM
For an example, I'm working on a DAQmx Watchdog module that is based on the static template but also requires Init, Close, etc.
You can see how I structured things (though bear in mind it is still under development and probably has some bugs in there): https://github.com/LabVIEW-DCAF/daqmx-watchdog
12-22-2017 09:19 AM
@MattP wrote:
For an example, I'm working on a DAQmx Watchdog module that is based on the static template but also requires Init, Close, etc.
You can see how I structured things (though bear in mind it is still under development and probably has some bugs in there): https://github.com/LabVIEW-DCAF/daqmx-watchdog
Okay, I seem to have it working, thanks!!