Overview
The availability of multifunctional devices on the market, such as "Multifunction RIO", offers the possibility to update existing test benches advantageously replacing a series of devices such as: Digital Pulse Generator Digital I / O, RS232/485 serial card, etc...
The proposed demo solution shows that, in an object-oriented application developed in LabVIEW according to a device-oriented architecture (i.e. structured in classes for each device), you can reuse all the software already written modifying only the part relating to the resources allocation and, of course, a minimal hardware interface that is not the subject of this article.
In other cases, a Multifunction RIO device can replace any previously existing digital devices.
Furthermore this approach, in addition to offering a tool to solve problems related to the replacement of devices with other multi-function, allows designing software architectures with a greater level of flexibility and abstraction.
The attached file contains the files of the example shown.
The MultiDevices_demo_app.vi is related to the initial project to control three digital pulse generators and a digital I/O card.
The MultiFunctionRIO_demo_app.vi is that changed to control the single board RIO.
Description
The example, representative of a real application, shows the modifications needed to adapt already developed software to handle the initially used devices (three Digital Pulse Generator and a Digital I/O card) to the new hardware configuration that consists in a single Multifunction RIO board.
Starting from a LabVIEW object-oriented application software based on classes written for the management of three Digital Pulse Generators and one Digital card the following figures show the differences with the upgraded code that manages only the Multifunction RIO.
This example highlights that the refactoring is achieved by changing only the resources allocation area that typically represents a tiny portion of the software application, reusing the functional code entirely.
The process to achieve this result is composed by the following steps:
This procedure will ensure the override of all methods and the linking of the new methods of the Multifunction RIO class.
to obtain...
At this point, run the programs and a series of messages will inform you about the executed method.
Requirements
Software: LabVIEW 2011
Hardware: None
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.