Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus Communication w/ Multigen M820

My setup:

cRIO 9082 running the attached VI in RT Engine

NI 9148 Ethernet RIO Expansion Chassis

NI 9871 RS485 module in the expension chassis

Multitek Multigen M820 meter with an RS485 output

I am trying to read in the voltage and current values output by the Multitek. I have wired the +/- RS485 output on the back of the Multitek to both the green pair and orange pair on an ethernet cable and plugged the ethernet cable in to the NI9871 module. I wired both green and orange because I don't need to transmit, so I wired both together just to be extra sure I got the right pair on there.

 

Application:

I have attached the VI I made to test this communication. I initialize the VISA ports as a 2Wire configuration and initilize the modbus protocol with matching settings to how I've set up the Multitek.

I have also attached the Operating Manual for the Multitek. RS485 setup starts on page 23 and the registers I want to read are on page 80. I have matched all RS485 settings and outputs the the VI I made.

When I run the application, I get no errors during initialization. The only error I get is a timeout error on the Modbus Read VI and nothing out of the registers.

 

Is there anyone on here who has more experience than I do with modbus who can point something out that I'm doing wrong?

Thank you,

 

 

 

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 1 of 12
(7,439 Views)

Hi,

 

Sorry for this but starting to answer your post I think this will be a long way............

 

First of all you have to be sure that your RS-485 connection operates OK. I can make you a VI that reads 1 register.

But first tell me more about the communication device your are using.  Sorry this is already mentioned in your post. I will look at it and be back with a test VI.

 

Also take a look at sample VI's and training material or read a book to better understand how you should create a LabVIEW program.

 

Kees

0 Kudos
Message 2 of 12
(7,401 Views)

K C,

 

I've read through examples and modbus-specific articles and, from what I can tell, my application should work. I'm not sure what else to try.

 

Thanks,

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 3 of 12
(7,367 Views)

First you have to be sure that the interface is operating OK.

I made a small VI that reads 1 register from address 0. You must set the slave address and the COM parameters.

Can you try this?

 

Kees

0 Kudos
Message 4 of 12
(7,352 Views)

@K C wrote:

First you have to be sure that the interface is operating OK.

I made a small VI that reads 1 register from address 0. You must set the slave address and the COM parameters.

Can you try this?

 

Kees


KC,

 

Thanks for the help and supplying me with that VI. I ran it and got no response from the device. The only thing I got back was the exact string that I sent out because I have the Rx and Tx wires wire together. This proves at least that I have the COM port selected properly.

 

I'm assuming this means I'll need to contact the manufacturer because the device should have given me something, right?

 

Thank you,

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 5 of 12
(7,339 Views)

Hi,

 

You receive the transmitted data, you say.

That is not possible with RS-485 interface. I think I forgot to set the port to 2 wire interface. You can add this in my test vi. No LV on Android tablet yet.  Smiley Sad

 

Still not clear to me how you connected the interface. 

You should connect Rx+ an Tx+ of the NI interface to the + of the device. Same for the -

Also adding the 0V connection can help sometimes.

Normally you should also add termination resistors (120Ohm) at both sides.

 

Kees

0 Kudos
Message 6 of 12
(7,326 Views)

KC,

 

Sorry for the delay, I got pulled away for another project and haven't had a chance to try this stuff out at the client's facility.

I attached a picture of the way I wired the RS485. Please ignore the sloppy wiring, I twisted everything together to save time and will go back and prettyit up once it's working.

 

As the picture shows, I have the + and - wired up and then I took two 68Ohm resistors in series across the terminals. The other end of the cable is just a regular ethernet connector that is plugged in to the cRIO module.

 

Before I added the resistors, I was getting nothing back after changing to the 2-wire configuration.

After I added the resitors, I started getting a VISA error "-1073807298", which is "Could not perform operation because of I/O error" along with 1byte "00".

This 1 byte may mean the resistors helped?

 

Thanks again for the help,

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 7 of 12
(7,272 Views)

Hi James,

 

Not surprised that the resistor make a difference. I have seen a lot of strange things with RS-485 (and even so much discussions with the selling party and manufacturers)

 

To make it more clear a drawing. The top schematic is, I think your situation. The other one is how it should be. I know that this is not always possible.

 

btw. the ethernet cable you are using is not a RS-485 cable. But for a few meters it will be OK

 

Kees

0 Kudos
Message 8 of 12
(7,239 Views)

I don't think the 2nd configuration from your drawing is possible in my situation. Is this necessary to get rid of the error? Also, are you suggesting that the "00" value I get back is the machine actually communicating with me?

 

With the resistors like they are now, I tried using the Modbus VIs, but they errror out. The error I get is in the Create Master Instance VI with code "-1073807298".

 

The code I get with your VI is code "-1073807298" upon VISA Read.

 

Thank you,

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 9 of 12
(7,217 Views)

They are both giving you the same error. That is something.

 

I think you get this error because there is no data to read. It is just a simple VI.

 

Did you already tried to switch the A and B wire. Some manufacturers do that.

 

Kees

 

0 Kudos
Message 10 of 12
(7,207 Views)