Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

RS-485 ModBus with NI-9871 on cRIO-9074

I'm trying to communicate with a device (Carlo Gavazzi EM21) via RS-485 ModBus using a NI-9871 module on a cRIO-9074. I've started with Modbus Communication Reference Example for cRIO and I've changed the example project to work with my hardware. I've compiled the FPGA 4-port serial.vi under my FPGA Target and run the cRIO Modbus Example (Host).vi to communicate.

The link between the NI-9871 module and the device is done using a Half Duplex cable with resistors in the beginning and in the end of the line. The cable has no more than one meter.

To run the main VI, I've this configuration according to the device manual:

Mode: RTU

Baud Rate: 9600 bps

Flow Control: None

Parity: None

Slave Address: 3 (Device with Address 3)

Function Code: Read Input Registers (04h)

Starting Address: 0028h (To read the power sum in Watts from the device)

Quantity: 1

Data: 0

Discrete: Off

 

With this I only get under the Result in Registers: 2800h. If my Starting Address is 0015h I get 1500h, if it is 002bh I get 2b00b and so on. I never get the proper reading from the device.

To understand what's going on the line between the NI-9871 module and the device, I've installed a RS-485 to USB Connector in the same line. With this I can read that the NI module is sending 03 04 00 28 00 01 B0 20, where the 03 is the Slave Address, the 04 the Function Code, the 00 28 the Starting Address, the 00 01 the Quantity of registers to read, and finally the CRC16 code which is right. However I can't see any response from the device.

When disconnecting the device from the NI module, and sending the same Request Frame 03 04 00 28 00 01 B0 20 with the RS-485 to USB Connector using the Terminal by Br@y++, I can get the Frame: 03 04 02 FE A8 81 2E. The 03 is the Slave Address, the 04 the Function Code, 02 the Quantity Response of Registers, the FE A8 the Register value witch is 65192 in decimal, and the 81 2E the CRC16 which is right. In the Response Frame the value must be divided be 100 which means 65,192 Watts that is right.

The example VI is always sending the same Request Frame and never get a Response Frame from the device.

If some one know something to solve this communication problem, please let me know. I couldn't found any other examples for this type of hardware from National Instruments. I'm sending in attach my entire communication project.

Many thanks.

Best regards.

 

André Quintino

ISR

0 Kudos
Message 1 of 17
(11,379 Views)

Hello Quintino,

 

 it seems you still have the same problem than the one you mentionned in your previous topic.

 

Did you resolve it already?

 

Sincerely

 

Romain

 

Romain DUVAL || RF & Semiconductor Staff System Engineer || CLA || CTA
National Instruments France

0 Kudos
Message 2 of 17
(11,268 Views)

Hello Romain.

Yes, I'm having the same problem because the software available from the NI web site does not work with ModBus using the NI-9871 module. The National Instruments support could only inform me that the software in now working with the NI-9870 and that they are working to solve communication problem using the NI-9871.

For now I bought one low cost RS-232 to RS-485 converter (about 20€) and I'm using the RS-232 Serial Port available on the cRIO-9074.

Thank you very much.

Best regards.

 

André Quintino.

0 Kudos
Message 3 of 17
(11,264 Views)

Hello,

 

Are you using the scan mode interface for the NI-9871 modules?  You can install NI-Serial v3.7 and the NI-987x module support, include the module in your project under scan mode, and then the ports on the module will show up as built in serial ports on the controller.  You can access these ports using VISA.

 

Using this method greatly simplifies code when multiple ports need to be used at once.

 

http://joule.ni.com/nidu/cds/view/p/id/2316/lang/en

 

Thanks,

Steven T.

0 Kudos
Message 4 of 17
(11,236 Views)

Hello Steven,

 

may I ask You a question? I have the same problem (trying to build RS-485 ModBus with NI-9871). I installed NI-Serial 3.7 and NI-9871 scan engine support as You suggested. But unfortunately it doesn't work. Now I discover the NI-9871 module in my project but the ports are still missing. Can You help me?

 

Thanks, best regards!

 

Johnny

0 Kudos
Message 5 of 17
(11,200 Views)

You may be missing a step that deploys the personality to the module.  Right click on the module and select Deploy.  You may be doing this already.  In that case, we would need to look into it a little further.  What does the output of the VISA Find Resources return when run on the cRIO RT Target?

 

Thanks,

Steven T.

0 Kudos
Message 6 of 17
(11,185 Views)

I finally found out that one software update was missing. Sorry. Thank You very much!

0 Kudos
Message 7 of 17
(11,162 Views)

Hello Johnny,

 

I seem to have the same problem, I can see the NI-9871 in the project, but not the ports.

"VISA Find Resources" does not return any ports from NI-9871.

 

How did you solve your problem?

Which software update did you use?

 

Thank you

0 Kudos
Message 8 of 17
(11,052 Views)

Hey,

 

I reinstalled LabView (Fall 2010 update) including all that real time, scan engine and fpga stuff, then I installed the latest NI drivers (february 2011, all device driver dvd, You can find it in the download area, huge file!) and I downloaded and installed all useful patches and updates using the NI update manager. Finally I deleted and reinstalled all the software on the CRio and amazingly it works now. I hope that helps You a little bit. Good luck!

 

Greetings

 

Johnny

0 Kudos
Message 9 of 17
(11,041 Views)

Thanks for your help 🙂

 

I somehow managed to get 9871 working :). I created a new project and left it in the scan mode (did not add an FPGA target), and did "deploy all" for the project and it surprisingly worked.

 

But the next day in the first powerup, after having 9871 working, cRIO stopped working by flashing Status Led 4 times repeatedly. Then I formatted it and tried to reinstall software. But I cannot install Network Variable Engine because it returns error messages and says some components in this install "requires LogosXT 5.2.1". 

 

In the driver dvd of Feb. 2011, I could not see the version of LogosXT setup file , anyway I reinstalled it but problem is not solved yet. I need to find LogosXT 5.2.1 setup file, according to error message. But couldnt find it on the internet 😞

0 Kudos
Message 10 of 17
(11,017 Views)