AdvancedHMI Modbustcp problems with RS-485 network

p8t4

Member
Join Date
Aug 2012
Location
Spain
Posts
2
Hello to all the forum, I'm trying to run the Arduino UNO with AdvancedHMI with modbus library does not work, I'm using a ModbusTCP server and with other software like mango m2m or ScadaBR that works very well.The use of 485 to ModbusTCP is Moxa nport5130.
I put some pictures of the configurations and arduino code, the errors also gives me the AdvancedHMI.

Arduino basic scheme with MAX485:

Converter RS485--->ModbusTcp--->IP:192.168.1.64/Port:4001


Configuration MosbusTcp in ScadaBR:


Points details and adress in ScadaBR:


Running on Scadabr with ModbusTCP protocol:



Configuration ModbusTcpCom1 in AdvancedHMI:



Configuration Digitalpanelmeter in AdvancedHMI:



AdvancedHMI error adress 30000:



AdvancedHMI error adress 30001:



Finally hit arduino code I am using and referring to the library used:

Code:
#include <ModbusSlave.h>
/* 
*  ModBus Slave Library *Example*
*  By André Sarmento Barbosa
*  [email protected]
*  Check whole project at:
*  http://www.diybrasil.com.br/projetos/rede-de-automaacaao-rs-485modbus-com-arduino
*
*  History:
*  I had modified original library Arduino Modbus Slave:
*  http://sites.google.com/site/jpmzometa/arduino-mbrt/arduino-modbus-slave
*  adding:
*  - Function 0x01 - Read Coils
*  - Function 0x02 - Read Input Status
*  - Function 0x04 - Read Input Registers
*  - Function 0x05 - Write Single Coil
*  - New methods for setup arrays of holding registers, input registers, coils and discrete inputs.
*  - Arduino 0.22 and 1.0 support
*  
*  I did this example to test the new library and show integration with ScadaBR software:
*  http://www.sacadabr.com.br

/* First step MBS: create an instance */
ModbusSlave mbs;

/* slave holding registers - int (read/write) */
enum {        
        MB_CTRL,        /* Led control on, off or blink */
        MB_CTRL1,       /* Control Ventilador (Fan) */
        MB_TIME,        /* blink time in milliseconds */
        MB_CNT,         /* count the number of blinks */
        MB_REGS         /* total number of holding registers on slave */
};

/* slave input registers - int (read only) */
enum {        
        MB_REG0,        /* Potenciometro 0 al analog 0 */
        MB_REG1,        /* Lectura de voltaje 0-15 con divisor de tensión al analog 1 */
        MB_REG2,        /* Lectura de intensidad efecto hall al analog 2 */
        MB_INPUTREGS    /* total number of input registers on slave */
};

float voltaje=0;
int analogInPin = A2; // Analog input pin that the carrier board OUT is connected to
float sensorValue = 0; // value read from the carrier board
float outputValue = 0; // output in milliamps
int regs[MB_REGS];
int inputregs[MB_INPUTREGS];

int ledPin13 = 13;
int Ventilador = 4;
unsigned long wdog = 0;         /* watchdog */
unsigned long tprev = 0;         /* previous time*/

void setup() 
{
        
/* the Modbus slave configuration parameters */

  const unsigned char SLAVE = 1;      /* slaveId */
  const long BAUD = 9600;             /* baud rate */
  const char PARITY = 'n';             /* n=none; e=even; o=odd */
  const char TXENPIN = 2;              /* output driver enable pin */

  /* Second step MBS: configure */
  mbs.configure(SLAVE, BAUD, PARITY, TXENPIN);

  mbs.setup_regs(regs, MB_REGS);
  mbs.setup_inputregs(inputregs, MB_INPUTREGS);
    
  pinMode(ledPin13, OUTPUT);
  pinMode(Ventilador, OUTPUT);

}

void loop()
{ 
  
        /* Third and las step MBS: update in loop*/
        if(mbs.update())
                wdog = millis();
                voltaje = map(analogRead(A1), 0, 1023, 0, 15000);
        // read the analog in value:
                sensorValue = analogRead(analogInPin)-512;

        // convert to milli amps
                outputValue = ( ((long)sensorValue * 5000 / 1024) ) * 1000 / 66;
                

        if ((millis() - wdog) > 1000)  
            inputregs[MB_REG0] = analogRead(A0); /* lectura potenciometro A0 */
            inputregs[MB_REG1] = voltaje; /* lectura voltaje 0-15v A1 */
            inputregs[MB_REG2] = outputValue; /* lectura intensidad efecto hall A2 */
            
             if (regs[MB_CTRL] == 0)
                    digitalWrite(ledPin13, LOW);
                    
             if (regs[MB_CTRL] == 1)
                    digitalWrite(ledPin13, HIGH);
                    
             if (regs[MB_CTRL1] == 0)
                    digitalWrite(Ventilador, LOW);
                    
             if (regs[MB_CTRL1] == 1)
                    digitalWrite(Ventilador, HIGH);

                  
            
                    }
The problem is I have no communication with AdvancedHMI, 've tried different values​​,40000,400001,400002 etc ... and nothing.Me and would love to run this with AdvancedHMI, because I think a powerful software.

Thank you and sorry for my English.
 
No one knows? any idea why it does not work AdvancedHMI with arduino?
I think it should work.
Greetings from Spain.
 
I can't see serial side network settings (Frame mode,parity,stopbit) in both device and Serial converter.
 

Similar Topics

I would like to temporarily install AdvancedHMI on the same computer as FactoryTalk View SE. I am waiting for another contractor to finish the FTV...
Replies
3
Views
530
Hi all, just wanna ask if anyone has used an M221 controller and successfully connected to AdvancedHMI
Replies
1
Views
1,292
MessageDisplayByValue question is there a way to embed a tag value in the messages of the MessageDisplayByValue function ??? Similar to what is...
Replies
10
Views
2,782
Hi All I have been switching between 2017 and 2019, all depending on which one i found more stable, at the moment I use 2019 I was just...
Replies
1
Views
1,458
I tried to use AdvancedHMI as a Modubius Client and it does poll the data from a Modbus server. But I am unable to use AdvancedHMI as a server...
Replies
10
Views
3,018
Back
Top Bottom