02-18-2016 05:59 PM
Hi,
I am running Labview 2015
I am currently trying to connect a Square D Pm820 (power meter) to a NI 9871 module in a 9076 crio. The project is meant to read the power data in the registers of the meter (current, voltage, etc) using the rs485 port on the back of the meter.
The pm820 has a 2 wire rs485 pinout with 1 ( - ) 2 ( + ) and a 3rd Shielding/ground wire. The pm820 meter is a slave device that has several different protocols that it can run on (Modbus RTU/ACII8/7 and JBUS).
The meter setting are:
Protocol: Modbus RTU
Address: 1
Baud Rate: 9600
Parity: None
I am using the 9871 module for the communication device to the cRio
I am using the cord that came with the 9871 module RJ50 to db9 and have the 4 and 8 pins jumpered (RXD+, TXD+) and then wired to the ( + ) of the meter and 5 and 9 pins jumpered (RXD-,TXD-) and then wired to the ( - ) of the meter and the ground run to pin 1. I have read that is is how you wire the db9 to a 2 wire rs485 connection.
My first goal is just to get communication with the power meter so that the value i see in the register is what i should be seeing.
I started off by using an example VI for reading holding registers (modbus master on RT target) that labview had prebuilt and modified it so that its input would be from the port 1 on the 9871 as well as created controls for my serial configuration. Other than that i left the rest of the VI as it was opened.
When i run the VI i see numbers appear in the register list however they have no relation to the power meter. I unplugged the power meter and still got the same result however if you remove the cord from port 1 of the 9871 the VI will have an error (as expected). I have a feeling the labview is talking to itself through the 9871 but i am not sure. I have looked at other posts trying to find a solution and came across a mention of having to set the wire mode, however i cannot find a way to do this using the modbus library. Using visa i see there is a way to do this however i couldn't find a VISA example on reading registers.
I am attaching an image of my VI and the front panel to show what i am getting.
If i could get help either making my VI work or at least get pointed in the right direction that would be great. I am not against using the Visa library either. Also if you have any examples or resources that would help they would be greatly appreciated
This is just part of my project but just getting working communication is my main priority at the moment.
Thanks in advance,
Mike
Solved! Go to Solution.
02-18-2016 08:52 PM - edited 02-18-2016 08:54 PM
Look like you didn't set the wire mode with VISA property node to 2-wire. Try doing that to the VISA resource. It starts default as 4-wire with the 9871 module, which then will read bogus data if wired in two wire mode.
02-18-2016 09:52 PM - edited 02-18-2016 09:54 PM
MarkCG
The program uses the modbus VI example so when i try to connect a property node to the VI the visa property node to changes to a modbus property node which does not have wire mode as an option. If you know of a way to change the wire mode on modbus or possibly read holding registers with the visa properties that would help out. I still appreciate your response though its nice having another set of eye to try and spot my issue. The reason im using the modbus master example in labview is because it almost matched the testing software that schneider electric uses for their meter but this could be standard.
Thanks,
Mike
02-19-2016 01:35 PM
02-21-2016 03:58 AM
Hello Mike,
In my last project I have implemented exactly the same functionality. I was communicating with Modbus power meter with NI 9871 module, on NI 9064 chassis.
Actually I have implemented communication on the FPGA, using NI-987x Serial Loopback example, just RT part was modified to convert RS485 serial packages to Modbus messages.
You can set also Transceiver mode of the module ports from the properties, from shortcut menu of the module in the project. It should be set to "2 wire auto".
Thanks,
Arev
CTO | RAFA Solutions
02-21-2016 03:21 PM
I will take a look at these solutions on monday to see if i can find a working solution. Thank you for your replies i will post back here if the suggestions can help solve my issue or at least update my situation.
Thanks,
Mike
02-23-2016 01:38 PM
I was able to get my program to read the value from the register by adding a property node to set the wire mode to 2 wire auto before the new modbus serial master subvi. This allowed for communiaction between the my computer and my power meter. The value were still not correct but i was able to confirm that the communication was working. I was then able to determine that the starting address was 1 value off what the register was sending back so when the VI said it was looking at register value 1120 it was returning the value for register 1121 which did not exist. That was an easy fix so now my project is working.
Thank you for all your help,
Mike