11-21-2013 09:50 AM
I would like to use a NI 9871 module with NI veristand to communicate with some devices over RS485 using modbus protocol. I know that this device can be used in scan mode and VISA commands, but will not work with the EtherCat Scan Engine custom device.
I am wondering the best method to modify NI veristand.
1. Create custom FPGA personality and write the drivers to directly interface with the ports on the device by modifying cRIO Modbus.lvproject http://www.ni.com/example/31166/en/. Expose the commmands as channels passed from the FPGA personality to the workspace and command those from the workspace.Current limitation, I am unsure how to modify this into a custom device or model due to the FPGA IRQ in the RT application used for timing. Can this be included in the custom device?
2. Use the 9871 in scan-mode and write a custom device to interact with it using VISA command. Deploy Modbus I/O servier in custom device and send commands to shared variables from workspace. This would be easier and more robust driver, but I am unsure how to implement if my other 7 modules are using the scan engine custom device. I cannot implement this one in scan mode and the other seven in FPGA because of only 3 DMA.
3. Modify the Scan engine custom device to support 9871? Not sure if this is possible.
Thanks,
Mike
4. Not use the NI 9871, and use the serial port on the Crio with a custom modbus device. This leads to a timing issue as I have five devices that I would like to interact with from one port. May reduce functionality.
Solved! Go to Solution.
11-21-2013 12:10 PM
Great post!
#3 is your best bet. You dont need to use the NIVS FPGA template (2 DMA) + the Scan engine (2 DMA).. Just use the scan engine only. If you need to customize the FPGA as well as scanned IO create a "hybrid bitfile" and use user defined variables to send the data to/from NIVS instead of DMA. So you won't ever have an entry under FPGA in the system definition... just a custom bitfile selected under the scan engine device.
11-21-2013 04:01 PM
Do you have any tips/posts where to begin modifying the Scan Engine & EtherCAT custom device? Not really sure where to start.... besides downloading it.
11-21-2013 04:15 PM
No need to modify it. Just use it as is. Visit the user variables page to load your hybrid bitfile
11-25-2013 01:47 PM
Sorry, I wrote incorrectly. I meant to say #2 is your best bet. That was confusing, my apologies.
So just make a hybrid bitfile with some slots in scan, some in FPGA mode, use UDVs to send/receive data from the FPGA. Pick that bitfile from the "user variables" page in the system explorer for the scan engine custom device. Then make your own custom device to use the 9871 from VISA as a regular serial port.
11-25-2013 01:54 PM
I actually was able to find another method. I am not 100% complete, but I believe it should work. I created a labview project and created a library with a modbus I/O server on the cRIO using the ports on the 9871. I was able to deploy this library and could see the shared variables. I can configure/and open a VISA test panel from MAX on the ports, so hopefully I will be able to send some data. I made a custom device that should allow me to interact with the shared variables (similar to data dashboard add-in) from veristand. Now I just need to deploy that from the system definition and read the data from the ports to my pc with a modbus slave.
Hope to test tomorrow or wednesday.
12-17-2013 10:13 AM
An update, since I found a method that worked pretty well and was easier than I expected.
If you are using the cRIO in scan mode with the scan engine custom device, the ports will show up in MAX for the 9871 module. I didn't realize this when I initially started the post above. From there you can utilize all the functions of the ports similar to the rs232 port that is included on the NI 9074.
I wrote a custom device that opened a VISA session to my port and then was able to implement the code I needed to communicate with my rs485 device. I was using modbus protocol and all of the functions worked inside of my custom device with no modification. I could also adjust the VISA settings in MAX and could run a VI from my pc that would send/recieve data to the ports. This will be useful as an additional way to test/change parameters on my rs485 devices outside of NIVS.
One thing to note from my last post, deploying a Modbus library did not work. The shared variables from Veristand would not work correctly with the variables as they were configured in the modbus library that I deployed. I was able to manually set them from the distributed system manager. I could also make the variables standard shared variables and they would update from the NIVS workspace in the distributed systems manager, but would not change the value in the modbus server. I decided to ditch this and create a custom device that just used VISA vs. the shared variables.
11-04-2014 03:32 PM
I'm planing to use the 9871 Module to send RS-422 Commands trough VeriStand.
Can you please share your custom device? It'd be great if you can post the source code of the custom device as well, so I'll be able to customize it, if necessary.
11-04-2014 03:32 PM
I'm planing to use the 9871 Module to send RS-422 Commands trough VeriStand.
Can you please share your custom device? It'd be great if you can post the source code of the custom device as well, so I'll be able to customize it, if necessary.
08-02-2016 12:42 AM
Does anyone have an example of how to develop a custom device to write RS-422 data to a 9871 module using veristand?