Read Modbus Registers

Discussion in 'UDOO NEO' started by Nuwan Bandara, Dec 6, 2017.

  1. Nuwan Bandara

    Nuwan Bandara New Member

    Joined:
    Nov 8, 2017
    Messages:
    2
    Likes Received:
    0
    Hi
    I have a trouble with reading ModBus Registers
    I'm using a Udoo Neo Full Board along with Linksprite RS485Sheild V2.1
    The embedded arduino is used with ModBus Master Library.
    Tx LED Blinks in the Shield but only thing I get is 226
    ----
    My arduino Sketch
    #include <ModbusMaster.h>
    ModbusMaster node;

    void setup() {
    // put your setup code here, to run once:
    Serial0.begin(9600);
    Serial.begin(9600);
    node.begin(1, Serial0);
    }

    void loop() {
    // put your main code here, to run repeatedly:
    static uint32_t i;
    uint8_t result;
    i++;
    node.setTransmitBuffer(0, lowWord(i));
    node.setTransmitBuffer(1, highWord(i));
    result = node.readHoldingRegisters(2, 2);
    Serial.println(result);
    delay(1000);
    }

    Please Help !!!
     
  2. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
  3. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    And what if you use another Modbus Library like this: https://github.com/angeloc/simplemodbusng

    The Arduino Neo is not fully compatible with normal Arduino's so you have to try some libraries until you hopefully find a working one.
     
  4. Gorgo

    Gorgo UDOOer

    Joined:
    Nov 9, 2016
    Messages:
    159
    Likes Received:
    17

Share This Page