Author Topic: Modbus RTU question  (Read 7814 times)

BC SYSTEMS

  • Full Member
  • Posts: 146
    • View Profile
Modbus RTU question
« on: August 31, 2006, 07:19:22 AM »

Hi,

I'm using the following code to read some Modbus ASCII data no problems

READMB2 3, 5, 101, DM[3],4

When I change the code to Modbus RTU I get no comms

READMB2 13, 5, 101, DM[3],4

I'm assuming that Comm 13 is COM3 RTU?

I'm using Wintech's modsim32, which works fine when configured as ASCII protocol but when I change to RTU, I get no data.

I use the setbaud function on a first scan

SETBAUD 3, &h03 ' SET COMM 3 RS485 8,1,N 9600

I would like to use standard RTU, as this is the most commonly used protocol in our control panels

Marcus


support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re:Modbus RTU question
« Reply #1 on: August 31, 2006, 09:29:48 AM »
READMB2 3, xx, xx,xx,xx uses MODBUS ASCII to read from slave. If it works, it means your slave is using MODBUS ASCII.

We are not familiar with MODSIM. Is it a modbus SLAVE emulator? If you define it as MODBUS RTU slave, then you should be able to use READMB2 13,xx,xx,xx,xx to read from the modbus slave.  It is probably a setting issues between the PLC and the slave. Continue to play around until you get all the settings correct and it should work.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

BC SYSTEMS

  • Full Member
  • Posts: 146
    • View Profile
Re:Modbus RTU question
« Reply #2 on: August 31, 2006, 03:24:13 PM »
Hi,

yes it is a slave emulator (www.win-tech.com).

The only settings are via a "tick box" wait for DTR from master, and wait for CTS from master.  each having a adjustable time delay (ms)?

I use the same program without the boxes ticked for the READMB2 3  command i.e. com3 ASCII with no problems?!?!

Do I need the CTS & / or the DTR for Modbus RTU from the T100?

Marcus
« Last Edit: August 31, 2006, 03:25:52 PM by Marcuspett »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re:Modbus RTU question
« Reply #3 on: August 31, 2006, 06:05:33 PM »
T100MD+ PLC don't use RTS/CTS at all. Is there a setting for the protocol type to determine whether the emulator is using RTU or ASCII protocol mode? The emulator must be an RTU slave in order for READMB2 13,xx,xx,xx,xx to work.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

BC SYSTEMS

  • Full Member
  • Posts: 146
    • View Profile
Re:Modbus RTU question
« Reply #4 on: August 31, 2006, 11:09:03 PM »
Hi,

Yes.  when I select ASCII - no problems.  when I select RTU, I get no comms?

Can you recommend a slave emulator?

Marcus

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re:Modbus RTU question
« Reply #5 on: September 01, 2006, 09:03:04 AM »
We don't use MODBUS slave simulator so I don't know of any I can recommend. The best way is to use a true MODBUS RTU device to test. You can use another T100MD+ PLC as modbus slave if you don't have other RTU devices on hand.

Win-Tech also made Modscan program which is the MODBUS master program (both ASCII and RTU are supported). We tested Modscan and works well with T100MD+as RTU slave.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

BC SYSTEMS

  • Full Member
  • Posts: 146
    • View Profile
Re:Modbus RTU question
« Reply #6 on: September 01, 2006, 10:33:41 AM »
Hi,

I also use Modscan for testing most slave modbus devices.

  used this on the T100 to look at the data tables in RTU no problem.  I just can't get it to work as a master in RTU -ARHHHH.

The quest continues.....

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re:Modbus RTU question
« Reply #7 on: September 01, 2006, 10:59:24 AM »
We have quite a number of users using the T100MD+ as MODBUS RTU master to talk to other devices (e.g. energy meter, M-70xx DAQ devices) so the T100MD+ has no problem acting as RTU master.

Did you try READMODBUS and WRITEMODBUS in RTU mode? These two commands work on one register at a time.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

BC SYSTEMS

  • Full Member
  • Posts: 146
    • View Profile
Re:Modbus RTU question
« Reply #8 on: September 01, 2006, 12:50:07 PM »
Hi,

I tried this string with no luck.

DM[3] = READMODBUS (13, 5, 101) COM3 RTU

I tried this string and it worked straight away!!!!!!

DM[3] = READMODBUS (3, 5, 101)  COM3 ASCII !!

I think need to find a device.

Marcus
« Last Edit: September 01, 2006, 12:55:28 PM by Marcuspett »

BC SYSTEMS

  • Full Member
  • Posts: 146
    • View Profile
Re:Modbus RTU question
« Reply #9 on: September 01, 2006, 02:58:58 PM »