From Friday, January 17th 11 PM CDT (January 18th 5 AM UTC) through Saturday, January 18th 11:30 AM CDT (January 18th 5:30 PM UTC), ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Send LVClass content between loops

Hi all,

 

I just started learning Classes and I have doubt when converting my existing project to OOP based.

To read Digital Input from NI devices, normally I make a parallel loop that keep acquire the boolean array and shove it into an FGV, then use it wherever I need. I intended to translate it into something like this (just ignore the local variable :D) 

Snippet.png

 

1) (Aside from the Parent/Child selector) Is this okay, or it's not recommended? I read in another thread that FGV and OOP shouldn't be used together in one architecture for easier trace and debugging. Though personally I prefer option 2 to prevent clutter when using more devices. I put the global outside the class method just in case i want to use more than 1 device, but basically it's part of the class that should be configured be used when someone using this class.

 

2) Since DVR doesn't work with dynamic dispatch, is there any way to work around it? Let's say I want to change the hardware from NI to something that use Modbus, which of course have different initialization and read method.

 

I want to make sure I get the basic right before continuing. Any input is appreciated and thanks!

0 Kudos
Message 1 of 9
(3,113 Views)

Your picture is too small and to blurry.  And I can't open a .rar.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 2 of 9
(3,081 Views)

@paul_cardinale wrote:

Your picture is too small and to blurry.


Hover over the picture and click on the icon that shows up at the upper right.  That will open the picture full size in a new tab.

 

(Newly added forum feature in the last few weeks.)

0 Kudos
Message 3 of 9
(3,072 Views)

Sorry paul,

Here is the .zip version. As for the picture, that's a vi snippet though. I can click to zoom it on my laptop.

 

Note: I'm using LV2018 on Win10 Home

0 Kudos
Message 4 of 9
(3,069 Views)

It seems kind of odd to have a loop that's constantly reading devices and then putting the data someplace to be read later.

I'm generally opposed to mirroring data (unless there's a really good reason to do so).

Why not just read the devices as you need the data?

 

As for workarounds for no DD with DVRs, there's not much.  You can use an In Place Element structure to dereference the DVR, or

you can use the attached files.

"If you weren't supposed to push it, it wouldn't be a button."
Download All
0 Kudos
Message 5 of 9
(3,007 Views)

Seems like you should just be using a simple Producer/Consumer.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5