Author Topic: Modbus RTU communication  (Read 11660 times)

martin.degrave

  • Newbie
  • *
  • Posts: 3
  • I'm a llama!
    • View Profile
Modbus RTU communication
« on: February 21, 2013, 08:19:47 AM »
Hi,

I am using a TRI-PLC FMD88-10 and I am trying to communicate with a drive (optidrive E2). I use the RS485 serial port with the RTU protocol.
The drive parameters are : address : 1, baud rate : 38400 and time out : 100ms.

So, I wrote this :

' WRITE PARAMETERS TO THE DRIVE
WRITEMODBUS 13,1,0,DM[5] 'Command word
WRITEMODBUS 13,1,1,DM[6] 'Speed reference


' READ PARAMETERS FROM THE DRIVE
DM[1] = READMODBUS(13,1,5)'Status word
DM[2] = READMODBUS(13,1,6)'Motor real speed
DM[3] = READMODBUS(13,1,7)'Motor current
DM[4] = READMODBUS(13,1,23)'Drive temperature


I can read all the values but I can't write anything.

Do you see any mistakes?

Many thanks

Martin Degrave

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Modbus RTU communication
« Reply #1 on: February 21, 2013, 04:50:14 PM »
Hi Martin,

It looks like your drive has two Modbus configuration options, which is mentioned in the P-12 section of the table on page 16 of the drive user manual.

The first option (set to 3) seems to only provide Modbus with partial control, so that could be why you are not able to write data. The second option (set to 4) seems to allocate full control to Modbus commands.

Another possibility is that the drive only responds to Modbus Function 6 and not Function 16, which the WRITEMODBUS command uses by default. If your PLC is r77 or higher, you can run the

SETSYSTEM 6,6

command to switch to Modbus function 6. Then WRITEMODBUS will use function 6 until the PLC is reset or a different SETSYSTEM 6 value is used (ie. SETSYSTEM 6, 16)
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

martin.degrave

  • Newbie
  • *
  • Posts: 3
  • I'm a llama!
    • View Profile
Re:Modbus RTU communication
« Reply #2 on: February 22, 2013, 02:09:50 AM »
Thank you for your response

I just added the SETSYSTEM 6,6 and that works