Author Topic: Problem in Modbus RTU communication between FMD88-10 and Wooward MRA4 relay  (Read 8308 times)

Prayuktibid

  • Newbie
  • Posts: 15
  • I am Prayuktibid
    • View Profile
Hello,
        I was trying to read Input and holding register's values from Woodward MR4A relay through Modbus RTU communication. This woodward MRA4 relay connected with i-Trilogi FMD88-10 PLC through RS485 port and this MRA4 relay support 8data bits, 1 stop bit, even parity with baud rate 19200. I have used two custom functions to check  'command status" by using STATUS(2) and "incoming massage in comm port" by using INCOMM(ch)  but the STATUS(2) gives '0' return and b]INCOMM(ch)[/b] gives '-1' return.

This is my i-Trilogi code..

[Fast Scan]
Code: [Select]
'SETSYSTEM 1, &HFF
'SETSYSTEM 2, &HFF
SETPROTOCOL 3,1 'set port 3 for fixed ModbusRTU protocol
SETPROTOCOL 2,1 'set port 2 for fixed ModbusRTU protocol
SETBAUD 3, &H44 'set port 3  as 8 data bits, 1 stop bit, even parity, baudrate 19200
SETBAUD 2, &H44 'set port 2  as 8 data bits, 1 stop bit, even parity, baudrate 19200

[Every Scan]

Code: [Select]
SETSYSTEM 6,4 ' set seytem for modbus function code 04
READMB2 12,1,20146,DM[1],2 'read through port 2
call Checkstatus
call checkcom
TIMERPV[T1]=50
CLRIO T1
SETSYSTEM 6,3 ' set system for modbus function code 03
READMB2 12,1,32500,DM[4],6 'read through port 2
call CheckStatus1
call checkcom

custom function [checkstatus] - to check command status
Code: [Select]
FOR I=1 to 1000
A = STATUS(2)
IF A=1 RETURN:
ELSE
SETLCD 1,1,"ReadFailuire"
ENDIF
NEXT

custom function [checkcom] - to check incoming massage in port 2 or 3
Code: [Select]
FOR J=1 to 1000
D = INCOMM(2):
IF D>0 RETURN:
ELSE
SETLCD 3,1,"Nothing receive"
ENDIF
NEXT
« Last Edit: September 15, 2017, 01:14:41 AM by Prayuktibid »

Prayuktibid

  • Newbie
  • Posts: 15
  • I am Prayuktibid
    • View Profile
Re:Problem in Modbus RTU communication between FMD88-10 and Wooward MRA4 relay
« Reply #1 on: September 15, 2017, 01:12:05 AM »
Woodward MRA4 relay Modbus Data point

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3170
    • View Profile
    • Internet Programmable PLCs
Re:Problem in Modbus RTU communication between FMD88-10 and Wooward MRA4 relay
« Reply #2 on: September 19, 2017, 03:26:23 AM »
You did not specify what was the problem.

Anyway, as per our previous post if you have some doubt about communicating with a 3rd party Modbus slave, always use a PC based application such as the Modbus Poll software to test your hardware. Once you get a successful communication you would have figured out most of the parameters required for a successful communication, such as the actual binary address, the function and the communication parameters.

For RTU another way to troubleshoot the communication problem is to use a PC to monitor the communication packet exchange between the PLC and the Modbus RTU slave. What you need is a USB to RS485 adapter (e.g. the U-485) and connect to the RS485 bus between the two devices, then download and run a terminal emulation software to monitor the comm. One good and free software is the RealTerm software that can display binary data exchange.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Prayuktibid

  • Newbie
  • Posts: 15
  • I am Prayuktibid
    • View Profile
Re:Problem in Modbus RTU communication between FMD88-10 and Wooward MRA4 relay
« Reply #3 on: September 19, 2017, 09:59:20 PM »

You did not specify what was the problem.

I did specified about my problem that is I am not able to read modbus register's value of woodward MRA4 relay by using FMD88-10 plc. I had sent my code for further clarification.


Anyway, as per our previous post if you have some doubt about communicating with a 3rd party Modbus slave, always use a PC based application such as the Modbus Poll software to test your hardware. Once you get a successful communication you would have figured out most of the parameters required for a successful communication, such as the actual binary address, the function and the communication parameters.


I had done a Modbus RTU communication test of this hardware.(Woodward MRA4 relay) on Raspberry Pi before sending you this question and on that test,  I was successfully read Modbus register values from this hardware through Modbus RTU communication. So You could be sure that this hardware is okay.

I was trying to read register values from 20146 and 32500 registers with Modbus function code 4(0x04) and 16 (0x10) respectively but I was failed to read from both register. I am sending my i-trilogi .PC6 file with this reply please check it.

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3170
    • View Profile
    • Internet Programmable PLCs
Re:Problem in Modbus RTU communication between FMD88-10 and Wooward MRA4 relay
« Reply #4 on: September 20, 2017, 03:37:54 PM »
In your sample program "Initialization" you run SETBAUD to COMM1 but COMM2 was commented out. That means COMM2 (RS485) port will still be operating at default 38400,8,1,n

But your "MBRTU" function contains READMB2 12,....    which means you are trying to use COMM2  (RS485) to talk to your device.

I am not sure why there was the  line SETSYSTEM 12,1  in your initialization code. Are you trying to use Modbus TCP to talk to a device that is connected to COMM1 of the PLC using Modbus RTU? That is one purpose of SETSYSTEM 12,1, which is to act as an Modbus TCP to Modbus RTU gateway

Perhaps you want to just define one COMM port at a time for your test to avoid confusion.

Also was there any data received into DM[4], DM[5].....DM[9]?

You can remove the FOR NEXT Loop in the Checkstatus1 function because READMB2 function will run to completion and STATUS(2) will immediately indicate whether the communication was successful so there is no need to put a FOR NEXT loop to test for STATUS(2).

You can remove the checkcom function as it does not serve any purpose and only will slow down the program.

« Last Edit: September 20, 2017, 03:39:44 PM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Prayuktibid

  • Newbie
  • Posts: 15
  • I am Prayuktibid
    • View Profile
Re:Problem in Modbus RTU communication between FMD88-10 and Wooward MRA4 relay
« Reply #5 on: September 20, 2017, 09:48:59 PM »
In your sample program "Initialization" you run SETBAUD to COMM1 but COMM2 was commented out. That means COMM2 (RS485) port will still be operating at default 38400,8,1,n
Sorry, I just mistakenly commented out COMM2 but I was really trying to communication with MRA4 Relay through COMM2. I know that COMM1 for RS232 and COMM2 for RS485 in my code I have  shown you wrong but actually I was trying to communicate through COMM2. Please don't mind.

But your "MBRTU" function contains READMB2 12,....    which means you are trying to use COMM2  (RS485) to talk to your device.
Yes, absolutely.
I am not sure why there was the line SETSYSTEM 12,1  in your initialization code. Are you trying to use Modbus TCP to talk to a device that is connected to COMM1 of the PLC using Modbus RTU? That is one purpose of SETSYSTEM 12,1, which is to act as a Modbus TCP to Modbus RTU gateway
No, I just want to talk with that device through COMM2(RS485) only. FMD88-10 acts as Modbus Client and MRA4 relay as a slave.

Also was there any data received into DM[4], DM[5].....DM[9]?
No, nothing.

You can remove the FOR NEXT Loop in the Checkstatus1 function because READMB2 function will run to completion and STATUS(2) will immediately indicate whether the communication was successful so there is no need to put a FOR NEXT loop to test for STATUS(2).
Okay, I will do it. From STATUS(2) function I am getting "0" return.

You can remove the checkcom function as it does not serve any purpose and only will slow down the program.
Okay, I just use this function to check if any data received in COMM port, if READMB2 command successfully applied. But both STATUS(2) and INCOMM(2) gives "0" and "-1" returns respectively.

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3170
    • View Profile
    • Internet Programmable PLCs
Re:Problem in Modbus RTU communication between FMD88-10 and Wooward MRA4 relay
« Reply #6 on: September 21, 2017, 07:42:09 AM »
The best way to troubleshoot communication problems between two devices is to be able to see the communication going on.

So you should use a USB-RS485 adapter (e.g. U-485) connected to a PC. Connect the RS485 port of the U-485 to the RS485 bus connecting the FMD PLC and the device. Now run a terminal emulation software that can display binary data and trigger the custom function to send Modbus command from the FMD PLC. You should observe the correct Modbus command packet sent from the PLC to the device.

If the PLC has correctly sent the Modbus packet and the slave is of the same communication parameters and correct ID you should see a response packet returned by the slave device.

If there is something wrong with the communication then you may be able to figure out what went wrong.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Prayuktibid

  • Newbie
  • Posts: 15
  • I am Prayuktibid
    • View Profile
Re:Problem in Modbus RTU communication between FMD88-10 and Wooward MRA4 relay
« Reply #7 on: September 21, 2017, 09:19:41 PM »
So you should use a USB-RS485 adapter (e.g. U-485) connected to a PC. Connect the RS485 port of the U-485 to the RS485 bus connecting the FMD PLC and the device. Now run a terminal emulation software that can display binary data and trigger the custom function to send Modbus command from the FMD PLC. You should observe the correct Modbus command packet sent from the PLC to the device.
Okay, I will do it.

I have one question.  Is FMD88-10 PLC able to read/write floating point data from Modbus Registers?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3170
    • View Profile
    • Internet Programmable PLCs
Re:Problem in Modbus RTU communication between FMD88-10 and Wooward MRA4 relay
« Reply #8 on: September 22, 2017, 07:29:19 AM »
Modbus register are all organized as 16-bit integer.

The PLC can only read these as 16-bit number or can read two adjacent 16-bit number to form a 32-bit integer.

However the FMD PLC does not support floating point so it cannot treat the 32-bit number as single precision floating point number.

Only the Fx1616-BA, Fx2424 or SmartTILE-Fx based PLC can interpret the 32-bit number as single precision floating point number.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS