Jump to content

Serial ASCII and Modbus RTU on the same line


Recommended Posts

Hello everyone,

I have two devices on the same RS485 line: one is a standart MODBUS RTU device, the second uses its own protocol in ASCII code. COM2 is configured to 9600 n 8 1 and I use positive pulses with 1 sec timing to activate Protocol Configuration FB and MODBUS Configuraton FB. The cycle starts with the ASCII device, then after getting the reponse I switch to MODBUS and get the required data, but when I switch back to the first ASCII device, even though OPLC sends the data, I receive no response. If I try to send the same data again, I get the response and proceed to MODBUS request and so on and so on, but the fist ASCII request after MODBUS gets no response, while the second request straightaway gets the data.

Both the device work perfectly well independently, and I have tested the above described cycle both automatically and manually, so I am pretty sure it is not a timing issue.

Would anyone kindly advise me on the situation?

Is it an OPLC issue (something to do with buffer clearing in Modbus mode) or maybe it is a Modbus slave issue (ie commnication ports dont close or else)?

Unfortunately I am not that good with Modbus yet, and googling the problem didnt help.

Link to comment
Share on other sites

  • MVP 2014

Firstly this is an unusual situation, and I would only expect limited success when trying to do this. Since they are on RS485, both devices will see each other's data, and it is a matter of "chance" as to whether the devices can tolerate seeing data that they do not recognise (of course it is not really "chance", but comes down to how the devices are designed, but you don't usually get this information up-front).

One possibility is that the ASCII device does not know what to do when it sees the Modbus data. The Modbus device on the other hand, should just ignore the ASCII data, since it would not be a legal Modbus packet.

It seems like the ASCII device gets confused by the Modbus data, then is not ready for the ASCII data. The first ASCII request after Modbus helps clear the situation and then the device is ready for the second ASCII request.

Depending on the settings of the ASCII device, you may be able to change its settings to more quickly discard data it doesn't recognise, for example with timeouts, character delays, etc (make them shorter). Maybe the ASCII device is waiting for a specific terminating character?

Otherwise I would suggest separate serial ports.

If you only have one port, there are serial switches available that require a control code to switch their output. Since you are already using the FB Protocol blocks, that device is also a reasonable option, assuming you can use RS232 on both devices (http://www.bb-elec.com/product_family.asp?FamilyId=102).

  • Upvote 1
Link to comment
Share on other sites

Simon, thank You for the insight!

As for the ASCII device, the manual states that in case for it to work with other device on the same bus, error messaging has to be turned off. Unfortunately, no other communication options are available.

Well, I guess I will have to stick with the "send the message two times" routine, since I request data only 1 time per second, there should be enough time for that.

Thanks for the help!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...