• Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. Massimogai
    M
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Best 0
    • Controversial 0
    • Groups 0

    Massimogai

    @Massimogai

    0
    Reputation
    267
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Massimogai Unfollow Follow

    Latest posts made by Massimogai

    • Neuron M203/How to read DI?

      Hello,
      last week I bought a M203. I would like to read the digital inputs with the MODBUS protocol. I tried to use the neuron_tcp_modbus_server with libmodbus but the results are wrong, they change at every reading. Here my code:

          mb = modbus_new_tcp("192.1681.1.102", 502);
          //modbus_set_slave(mb, 2);
          modbus_connect(mb);
      
          /* Read 16  bit sfrom the address 0 */
          modbus_read_bits(mb, 0, 16, tab_reg);
        
          modbus_close(mb);
          modbus_free(mb);
          for (int i = 0; i < 16; i++) {
          std::cout << static_cast<uint8_t>(tab_reg[i]) << std::flush;
          std::cout <<",";
          }
      

      Any suggestions?
      Thanks.

      posted in Unipi 1 - HW Q&A
      M
      Massimogai