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.

closed as unclear what you're asking by VE7JRO, Greenonline, Juraj, sempaiscuba, MichaelT Apr 27 at 22:37

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    Can you share your code here. – Vaibhav Apr 23 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.