Hi,
I would like to read float values from Arduino Nano using RS485 protocol.
Arduino nano is interfaced with Modbus poll using Max 485 TTL module.
With help of a library application, I'm able to read integer values using Modbus Poll software... But can someone help me with reading analog values(Float) from Arduino Nano.
#include <ModbusRtu.h>
// assign the Arduino pin that must be connected to RE-DE RS485 transceiver
#define TXEN 4
// data array for modbus network sharing
uint16_t au16data[16] = {
3, 1415, 9265, 4, 2, 7182, 28182, 8, 0, 0, 0, 0, 0, 0, 1, -1 };
/**
* Modbus object declaration
* u8id : node id = 0 for master, = 1..247 for slave
* port : serial port
* u8txenpin : 0 for RS-232 and USB-FTDI
* or any pin number > 1 for RS-485
*/
Modbus slave(1,Serial,TXEN); // this is slave @1 and RS-485
void setup() {
Serial.begin( 19200 ); // baud-rate at 19200
slave.start();
}
void loop() {
slave.poll( au16data, 16 );
}
In reply to can you help me to read the by Tune pannunga
This is the transmit enable pin of the Mudbus device that is being controlled by the Arduino pin 4.
Could you share the function defination of slave.poll inside the ModbusRtu.h
Tune pannunga
Joined March 23, 2021 1Tuesday at 05:44 PM
can you help me to read the int data from modbus slave using aurdino uno...because i don't understand # define TXEN 4