Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus RTU Communication through NI-9871 Serial Module on FPGA

I have a C-RIO with a NI-9871 RS-485 Serial module that I am trying to setup to communicate with remote data acquisition devices through Modbus RTU.  Has anyone been able to accomplish this? Does anyone know of any modbus VIs that are specific to the FPGA that take care of structuring the data for a modbus read or write request?  I have been trying to develop these communication VIs without success.  Any help or examples would be a tremendous help.

 

Thanks,

Dan

0 Kudos
Message 1 of 7
(8,706 Views)

Hi Dan,

 

I don't think we have anything that can do that.  There is a Modbus library, but will require a VISA resource, while the 9871 requires you to go through the FPGA rather than VISA.   Hopefully someone else may have already done this, but otherwise you might have to write your own code.  If you do have to write your own, I'd recommend you keep the FPGA interface as simple as possible to save space, and handle the protocol details on the realtime controller.

Regards,

Jeremy_B

Applications Engineer
National Instruments
0 Kudos
Message 2 of 7
(8,696 Views)

Hi D Reck,

 

I was wondering if you had any luck with the Modbus implementation using FPGA and a 9871. I am currently evaluating the use of cRIO for a PAC, but it will require communication with two Modbus slaves. I am not sure if this will be difficult hard coding into fpga. BTW, Does anyone know if this module (and RS485) is supported through the scan engine (scan mode) available to some cRIO platforms? That would definitely help in implementing the modbus protocol without having to hardcode through FPGA.

 

Gaussy

0 Kudos
Message 3 of 7
(8,477 Views)

Hi,

 

Unfortunately none of the serial port modules are supported by scan mode at this time.
Regards,

Jeremy_B

Applications Engineer
National Instruments
0 Kudos
Message 4 of 7
(8,459 Views)

HI Jeremy_B,

 

Thanks for the reply. Would it be "difficult" to try and handle the Modbus communication through FPGA? I am relative newbie to the cRIO and FPGA platform, so I want to gauge if I'm "shooting for the stars" a little too early? I was hoping to find a rt controller that had an RS485 port built-in, but they only seem to handle RS232.

 

Thanks again.

 

Gaussy

0 Kudos
Message 5 of 7
(8,455 Views)

Gaussy,

 

You could use the FPGA and serial module as a simple I/O passthrough and still do the Modbus encoding/decoding on the RT side using the existing libraries/VIs available on DevZone.

 

https://forums.ni.com/t5/Reference-Design-Content/LabVIEW-Modbus-API/ta-p/3524019

 

That attached example is an illustration on how to pass data bytes to and from the serial port on the C series module using the DMAs between the RT and FPGA. The example is just to get you started and does not do a lot of error checking or other possibly desired features.

 

 

 

authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX


  
Message 6 of 7
(8,436 Views)

Hi Christian L,

 

Great! This will definitely provide a starting point. I figured that scan mode would be able to read the buffers on the 9871, but I guess that be in future software updates. I definitely can't wait for that!

 

Thanks again,

Gaussy

0 Kudos
Message 7 of 7
(8,419 Views)