Im using Arduino MEGA and using Hardware serial 1 and one software serial interface for communicate two different devices Nextion HMI(hardware serial 1) and Modbus temperature controller(software serial pin 12 as RX and 13 as TX).

In the code software serial requesting(sending) data to temperature controller every 500ms.

Sometime when I pressed a button on HMI it cant capture correctly because of software serial request.

How can I eliminate this problem and please explain relationship between software and hardware serial.

  • 3
    Can you share your code here. – Vaibhav Apr 23 '19 at 6:46

I suggest you don't use software serial at all. The Mega has 4 hardware serial ports: Serial (connected to the USB adapter to the PC), Serial1, Serial2, Serial3. Use one of the other hardware serial ports to connect to the Modbus. Serial1 is pins 18/19, Serial2 is 16/17, Serial3 is 14/15.

Not the answer you're looking for? Browse other questions tagged or ask your own question.