arduino serial monitor, symbols from modbus ?

Hi everyone,

Just getting to grips with some Arduino Modbus master code,

I have been learning the HalfDuplex 485, and managed to get the communication up and running.

I would like to export the reading to excel for logging using the plx-daq version2 .

I would like to ask for some help with this if anyone out there has had the following problem.

I have a problem where the serial monitor does print the correct hex value I require to send to the plx-daq, however the serial print , prints some unknown symbols before it prints the actual value,

(please see the attachment)

what you see in the serial monitor should only be the hex value , the symbols need to be erased.

These symbols prevent the plx-daq from performing its task to log the actual value I need logging.

It seems as though its something to do with the Arduino master to Modbus slave communications ,

When i try usual analogue or digital signals the serial monitor it’s faultless .

I have included the code I’m using

Any reply would be greatly received .

Many thanks

Paul

MODBUS_2_REG_to_send.ino (1.43 KB)

I have also worked with the library and sketch you used. The problem is that in line 30 you are telling the library to use the Hardware Serial to communicate with the Modbus slave. and then you also use it to print data to the serial monitor. You should use different serials for it to work. Try downloading the AltSoftSerial library. You should have something like

AltSoftSerial mySerial; mySerial.begin(19200);//ue this to communicate with the slave Serial.begin(9600);//Use this to print your data to the monitor

node2.begin(2,mySerial);