Confusing MODBUS Issue

E

Thread Starter

Elimathew

Hey guys,

I am interfacing delta HMI with arduino mega (serial 3 for MODBUS) implementing using MODBUS master library (baud 19200, 8 bit even parity 1 stop bit, 1000ms timout, retry count 10, polling rate 10ms) and alas it is working fine (read holding registers and working fine). So now I tweaked the code to implement function 1 to read 16 points or coils. I am using MODBUS slave simulator on laptop (interfaced arduino using USB TO RS232) to observe the packets. Here's the problem observed.

1] master arduino sends the desired request (checked)

2] slave software processes the request and sends the correct reply (checked). You might be guessing then whats left.

3] master doesn't receive the reply :smiley-eek:

4] also the master request lasts for about 1 second only and during this period the slave responds too (observed by RX and TX led blinking on the USB TO RS232 cable). I have attached the log of this exchange below.

I'm like at the dead end, as function 3 is implemented on the same setting. what should I do now? any hints as such as to what might be at fault?

<b>Moderator's note:</b> You cannot attach files to messages on Control.com, so the log file does not appear.
 
C

Curt Wuollet

Sounds a lot like a timing issue. I'd try a datascope program so you
can see the effect of changes.

Regards
cww
 
Thank you for the suggestion. If timing was the issue, function 3 wouldn't work right? As I was reading 1 holding register both response contains 7 byte so there's no difference as such. I would try your suggestion but what is datascope program?

> Sounds a lot like a timing issue. I'd try a datascope program so you can see the effect of changes.
 
C

Curt Wuollet

You shouldn't be too fast to decide A implies B. A different command can have different overhead.

A datascope program lets you put a PC on the wire between the master and slave and lets you see who sent what when.

There are lots around. Datascope actually is misleading, it was a solution long ago so such things kinda got the name. Try a google for rs232 monitor and you will be given lots of choices, some of which are bogus and some are spam, but you should be able to find something free. It will tell you what actually got on the wire. Tomorrow from work I can send the name of the last one I used.

Regards
cww
 
C

Curt Wuollet

> A datascope program lets you put a PC on the wire between the master and slave and lets you see who sent what when.

Addendum:

The free program I last used is called simply 232Analyzer. They, of course, have a pay version which I haven't used.

Regards
cww
 
L

Lynn August Linse

Also watch out for flow-control, as if your 'driver' assumes XON/XOFF, then sending any Modbus command with 0x13 can do bad things. I've seen no evidence that's your problem, but as example I've seen it hit people who say:

- when I poll register #6 it works, but #7 fails (because #7 happens to have an 0x13 in and it causes the master's serial port to XOFF).

Also, in older Modicon PLC, certain Modbus commands COULD be handle with or without proper 232 hand-shaking, while certain commands demanded correct DSR/DTR and RTS/CTS behavior (Yes, is odd - but True).
 
Top