RS485 ASCII-Protocoll

  • Hello
    I have a L503 with a Advantech ADAM-4017 over RS485. How i configure the L503 in Mervis to read the 8 value?
    The Adam-4017 has the RS485 ASCII protocoll. Danks for your reply


  • administrators

    @andmo Check the custom serial protocol in Example project in our download section for Mervis

  • I found only a Excel and a Text file.

  • administrators

    @andmo Yep, the text file contains an example of ST code which parses communication with a custom RS485 ASCII protocol.

  • Please can you make a example for me with the configuration off this ADAM-4017? I'm not able to do this.
    Danks Andi

  • AA is 01xh for Modul 1



  • administrators

    Hello @andmo,
    unfortunately we don't have any Modbus ASCII device at hand, so we cannot give you a working example. But I'm adding this to my tutorial TODO list and schedule it for upcoming weeks.

    Anyway, here you can find needed info, if you are keen to dive into the protocol parsing in ST by yourself. Remember - it works the same as ModbusRTU, but with different "formatting" so to speak.


  • Hi @Andmo @Martin-Kudláček ,

    Just as a correction - the protocol is not Modbus ASCII, but rather consists of a textual command-response interface, similar to e.g. AT commands - but this means it is easier to work with in Mervis! Unfortunately the example may be a bit hard to understand.

    You might find it easier to write a simple function block to send a static command string first, and then go on from there.

    The number of possible permutations of various command protocols is so high that we cannot provide support for it the same way as we can for e.g. Modbus.

    On a related note - it may be possible to switch some ADAM-4000 devices to Modbus, as per section H.1 in the user manual:

    Changing Configuration to Modbus Protocol
    The ADAM-4000 Modbus version modules may come from the factory set for which
    ADAM ASCII protocol are set as the default protocol.
    If the module is connected to a Modbus network, the Modbus network may not recognize
    the module. This may be caused by the incorrect settings. ADAM-4000 module
    should be set-up for Modbus protocol instead of ADAM ASCII protocol.
    Please follow the steps as below for configuring an ADAM-4000 module to Modbus
    1. Configure the ADAM-4000 Module with the ADAM-4000 utility (latest ADAM4000
    utility can be found at service & support.)
    2. Initialize the ADAM-4000 on a RS-485 network (the preferred method is one
    module at a time on the RS-485 network).
    3. With the module powered off, turn the switch in the “Init” position. (For some
    older Adam models, use an external wire to connect the INIT* terminal to the
    GND terminal)
    4. Power up the module
    5. Wait 10 seconds for the module to initialize.
    6. Using the ADAM-4000 utility, search (scan) for the module to change the protocol.
    (Initial COM settings: 9600 baud, N-8-1)
    7. The utility will identify the module from the search function.
    8. The ADAM-4000 utility will now permit the serial data protocol to be changed to
    the Modbus protocol.
    9. The address and COM port settings can also be changed at this time.
    10. To access the module, click on the module icon in the utility.
    11. Update the settings by pressing the “Update” button.
    12. Power off the module.
    13. Turn the switch back to NORMAL* position. (For the older Adam models,
    remove the wire between the INIT* and GND terminals)
    14. The module is now ready to be placed in the Modbus network.

    Either me or Martin would like to create a quick example function block later, but unfortunately we are otherwise quite busy at the moment so it may take some time before we do so.

  • now i try with the example. But whats the numbre of the Serialport RS485 1.1 on L503. Danks

  • administrators

    Hi @andmo,
    I'm not sure what did you try, but from the product page of the ADAM-4017+ I can see that it indeed supports the ModbusRTU, as stated by Tomas. I strongly recommend using this protocol, since there is a built in support in the Mervis.


  • I have the ADAM-4017 and not the ADAM-4017+. Now i try to implement the example custom serial protokoll.

  • @Andmo
    It should be possible, as we've implemented several similar protocols before. Unfortunately as I mentioned earlier we are quite busy at the moment to offer more detailed support.

    The port should be the same as in the example I believe, i.e.:

      def := 'serial:6:9600,8,N,1';
      handle := io.openport(def);

    But if it does not work you can try the other adjacent numbers. The numbering comes from the underlying OS, and so unfortunately it's a bit raw in terms of user-friendliness.

  • 0_1533807183907_6ddebc9c-2e84-44e5-bdf5-86ebb3111611-grafik.png



  • @Andmo
    That looks about right - could you describe in more detail the problems you are having?

    It's quite hard to tell from the screenshot.

Log in to reply