Answer the question
In order to leave comments, you need to log in
How to transfer modbus from arduino through the interface?
I'm trying to send arduino data via modbus (485 over 2 wires) a bunch
of arduino -- XY-017 -- moxa to ETH and then process them.
I tried to use the ModbusRtu.h library, but I see with an oscilloscope that data is not being sent and TxRX does not blink on moxa or on arduino.
XY-017 is connected to pins 0 and 1. (Changed in places does not help)
Moxa is of course a master. instead of moxa, I connected the Uport1130 and read it "Modbus Poll" from the com port of the arduino, the data is coming, and silence from the converter.
#include "ModbusRtu.h"
#define ID 1 // адрес ведомого
//Задаём ведомому адрес, последовательный порт, выход управления TX
Modbus modbus(ID, 0, 1);
uint16_t MBdata[11]; // массив данных modbus
void setup() {
modbus.begin( 9600 );
}
void loop() {
float current = 55;
modbus.poll( MBdata, 11); // обработка сообщений
MBdata[0] = current;
MBdata[8] = modbus.getInCnt();
MBdata[9] = modbus.getOutCnt();
MBdata[10] = modbus.getErrCnt();
}
Answer the question
In order to leave comments, you need to log in
modbus(485 over 2 wires)
You unhook this contraption and check that your arduin generally gives out something by uart on the given legs. When you achieve that the arduina will transmit and receive, you can connect this converter and look further.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question