What is Veristand?
Veristand is National Instrument’s environment for setting up your test cell, monitoring or hardware-in-the-loop solution.If you need a refresher read up on Veristand product presentation at http://www.ni.com/veristand/ and http://www.ni.com/veristand/whatis/

What are Custom Devices?
Veristand comes with a range of functionality such as data acquisition and logging, test sequencing, simulation model integration as well as interfacing with various hardware out-of-the-box. However you may need to implement some additional functionality like interfacing with third-party hardware or using your custom FPGA designs. Such tasks can be completed by creating Custom Devices.
What would you need?
Veristand Custom Devices are created using LabVIEW. There is just one small catch: to properly build your code you would need your LabVIEW environment to be the same version as Veristand. For example: to develop Veristand 2016 custom devices you would need LabVIEW 2016 (exact fix number or service pack is not relevant). You may also need some LabVIEW add-ons or drivers depending what functionality you are implementing.
Starting from template
When you install Veristand, Custom Device template tool is being added to your LabVIEW folder. You can find it at \National Instruments\LabVIEW\vi.lib\NI VeriStand\Custom Device Tools\Custom Device Template Tool.
When you open the tool you need to specify your custom device name and path. Choose appropriate name as changing it afterward isn’t as straightforward as it may seem! You would also need to select the execution mode. “Asynchronous” is appropriate for most of your simpler custom devices.

After running the tool a new LabVIEW project is created. It includes templates for all the VIs you’ll need to start development, a xml custom device definition file and build definitions for packaging your code and adding it to Veristand Custom Device folder.

Customising the template
Custom Device consist of 4 main parts: Initialization VI, Main Page VI, Driver (or Engine) VI and XML definition file. That’s where you implement your custom device functionality.

Initialization VI
This is the VI that runs when you add your device to Veristand. It can configure how the device would present features to Veristand, configure its channels or set some initial device options.
Main Page VI
This VI (and its front panel) is a sort of configuration menu. It is shown while editing your Veristand system definition and can be utilized to set devices options such as name, description, acquisition parameters or hardware addresses that your device needs to interact with. Custom device can have as many “pages” VI as you need, but at least one – the Main Page VI is obligatory.
Driver (or Engine) VI
This is the VI that runs as a Veristand Engine process continuously when you deploy your Veristand solution. That’s where you need to implement all the data acquisition, processing and interfacing with hardware. This VI communicates with Veristand Engine and manages all data transfers to and from it, in form of Veristand channels. It also reacts to various Veristand events like system startup, shutdown or error.
This VI is created with basic architecture template (depending which execution mode was chosen in Custom Device Template Tool) which can acts as a startpoint for your development.

Definition XML
Definition XML is a file which Veristand uses while enumerating it’s custom device folder. It consists of Custom Device ID and paths where all your Custom Device components (VI) can be found by Veristand. It also defines on what kind of targets (Windows, RT Linux, Pharlap etc.) that custom device can be run.
When changing any default VI names, or adding new ones (new Page VIs for example), all the changes need to be manually updated in definition file!

Build definitions
Custom devices are distributed as LabVIEW library files (LLB). You would need at least 2 libraries: “Configuration” and “Engine”. Configuration library contains code that runs on a computer from which you deploy your Veristand solution. Initialization VI, Pages VI and all of theirs dependencies need to be included in that library.
Engine library contains target-specific code for the controller on which your Veristand solution is deployed. Engine libraries are uploaded automatically to the target at deployment and the code runs there.
If you intend your custom device to run on multiple targets you need to create multiple engine Libraries, each containing code compiled in proper target context.
Veristand is searching for custom devices only in its custom devices folder (c:\Users\Public\Documents\National Instruments\NI VeriStand\Custom Devices), so if you intend to build your code to a different folder, remember to copy it afterwards.

Running your Custom Device
To run your custom device, you need to add it you your Veristand System Definition file. To do so, open the Veristand System Explorer, by clicking on your System Definition file in Veristand Project. In System Explorer navigate to appropriate target you wish your custom device to run on. Right-click on “Custom Devices” and select your device from displayed context menu. System explorer is also where all your custom device configuration takes place. Once done, save and close your system definition file.
Your Custom Device will now run automatically when you deploy your Veristand Solution!

Want to learn more?
Check out National Instruments tutorial on building custom devices at: http://www.ni.com/tutorial/9348/en/