Hello ... Since the Mega162 has already 2 hardware serial ports, I wonder if it should be possible to define up to 3 additional software ports ? And should these ports be numbered 1, 2, 3 or 3, 4, 5 ? Thanks for any answer ...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Software Serial (Optimised) uses the numbering scheme of 1, 2 and 3. You therefore can use the two hardware serial plus the three software serial. And, you would address using the defined scheme.
Meanwhile I tested the PRINCIPLE with a Mega8515, the Nextion connected to Hardware port1, an Emic 2 connected to the pins used by serial port2 on the Mega 162 (2 and 3 on PortC), with these pins defined as software port1 : IT WORKS ! And thanks to Chris Roper, but I will use all serial communications in Subs, so the main program will not be "contaminated" ...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello ... Since the Mega162 has already 2 hardware serial ports, I wonder if it should be possible to define up to 3 additional software ports ? And should these ports be numbered 1, 2, 3 or 3, 4, 5 ? Thanks for any answer ...
Software Serial (Optimised) uses the numbering scheme of 1, 2 and 3. You therefore can use the two hardware serial plus the three software serial. And, you would address using the defined scheme.
HSerPrint "usart1", 1
HSerPrint "usart1", 2
Ser1Print "sw usart1"
Ser2Print "sw usart2"
Ser3Print "sw usart3"
This should work.
Thanks, I will test as soon as I have all the hardware available ...
If you wanted to use your number sequence Then use Anobiums code as above but to make your code readable you can additionally use #Define like this:
Clever.... very clever. But, all the constants would be in UPPERCASE. :-)
So, you define the constants to redefine all five serial comms line. Should work!
What a clever idea.
Meanwhile I tested the PRINCIPLE with a Mega8515, the Nextion connected to Hardware port1, an Emic 2 connected to the pins used by serial port2 on the Mega 162 (2 and 3 on PortC), with these pins defined as software port1 : IT WORKS ! And thanks to Chris Roper, but I will use all serial communications in Subs, so the main program will not be "contaminated" ...