Hi, i,am trying days and days to connect my HMI MT8071IP Weintek to a arduino, i want to control some leds and reles by the hmi, i have one module RS485, but always and always say "Device or clp no response", if anyone did it, or know how to do it please help me
@richardgusmao071, your topic has been moved to a more suitable location on the forum.
As we have no idea of your wiring or your code, I suggest that you enlighten us about both.
A link to the hmi device might also be useful.
Please post you code, and a schematic of how you have hooked everything up.
This is de code i am using
#include <modbus.h>
#include <modbusDevice.h>
#include <modbusRegBank.h>
#include <modbusSlave.h>
modbusDevice regBank;
modbusSlave slave;
#define RS485TxEnablePin 2
#define RS485Baud 9600
#define RS485Format SERIAL_8E1
#define LED1 4
void setup()
{
//Assign the modbus device ID.
regBank.setId(1);
/*
modbus registers follow the following format
00001-09999 Digital Outputs, A master device can read and write to these registers
10001-19999 Digital Inputs, A master device can only read the values from these registers
30001-39999 Analog Inputs, A master device can only read the values from these registers
40001-49999 Analog Outputs, A master device can read and write to these registers
Analog values are 16 bit unsigned words stored with a range of 0-32767
Digital values are stored as bytes, a zero value is OFF and any nonzer value is ON
*/
//Add Analog Input registers to the register bank
regBank.add(1);
slave._device = ®Bank;
slave.setBaud(&Serial,RS485Baud,RS485Format,RS485TxEnablePin);
pinMode(LED1, OUTPUT);
}
void loop()
{
digitalWrite(LED1, regBank.get(1));
slave.run();
}
I´m connecting RO - RX(0)
DI - TX(1)
DE AND RE - D2
A (PIN 2)
B (PIN 1)
I tryed to change pin A and B some times but doesnt work
That's not a wiring diagram. Way too much is missing.
Please read the first topic telling how to get the best from forum.
Hi, i,am trying days and days to connect my HMI MT8071IP Weintek to a arduino, i want to control some leds and reles by the hmi, i have one module RS485, but always and always say "Device or clp no response", if anyone did it, or know how to do it please help me
This is de code i am using
#include <modbus.h>
#include <modbusDevice.h>
#include <modbusRegBank.h>
#include <modbusSlave.h>
modbusDevice regBank;
modbusSlave slave;
#define RS485TxEnablePin 2
#define RS485Baud 9600
#define RS485Format SERIAL_8E1
#define LED1 4
void setup()
{
//Assign the modbus device ID.
regBank.setId(1);
/*
modbus registers follow the following format
00001-09999 Digital Outputs, A master device can read and write to these registers
10001-19999 Digital Inputs, A master device can only read the values from these registers
30001-39999 Analog Inputs, A master device can only read the values from these registers
40001-49999 Analog Outputs, A master device can read and write to these registers
Analog values are 16 bit unsigned words stored with a range of 0-32767
Digital values are stored as bytes, a zero value is OFF and any nonzer value is ON
*/
//Add Analog Input registers to the register bank
regBank.add(1);
slave._device = ®Bank;
slave.setBaud(&Serial,RS485Baud,RS485Format,RS485TxEnablePin);
pinMode(LED1, OUTPUT);
}
void loop()
{
digitalWrite(LED1, regBank.get(1));
slave.run();
}
I´m connecting RO - RX(0)
DI - TX(1)
DE AND RE - D2
A (PIN 2)
B (PIN 1)
I tryed to change pin A and B some times but doesnt work
@richardgusmao071 Your 2 topics on the same subject have been merged
Please do NOT cross post / duplicate as it wastes peoples time and efforts to have more than one post for a single topic.
Continued cross posting could result in a time out from the forum.
Could you also take a few moments to Learn How To Use The Forum.
Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.
oh sorry man, i will remove, thanks
Now, a clear photo, and a drawn diagram of how everything is wired together,showing power, pin numbers and ALL parts you are using.
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.