The 86Duino hardware has built-in support for serial communication on pins 0 and 1. The native serial support happens via a piece of hardware (built into the chip) called a UART. This hardware allows 86Duino’s CPU to receive serial communication even while working on other tasks.
The SoftwareSerial library has been developed to allow serial communication on other digital pins of the Arduino, using software to replicate the functionality (hence the name 'SoftwareSerial '). It is possible to have multiple software serial ports with speeds up to 115200 bps. SoftwareSerial Library Download: SoftwareSerial is included with Arduino Real UART Serial The hardware UART Serial port should always be used, if possible, before considering SoftwareSerial. On Teensy, the hardware UART serial port completely separate from the USB port.
The SoftwareSerial library allows serial communication on other digital pins of the 86Duino, using software to replicate the functionality (hence the name “SoftwareSerial”). A parameter enables inverted signaling for devices which require that protocol.
This library is included in 86Duino Coding 103 and later.
The library has the following known limitations:
- SoftwareSerial()
- available()
- begin()
- isListening()
- overflow()
- peek()
- read()
- print()
- println()
- listen()
- write()
The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.
In certain cases we need to use more than one Serial port in the case of arduino, I use the arduino mega 2560 which has 4 serial ports including the programming port, in the case of arduino’s as the nano has a single programming port and as a solution Have created the softwareserial library, given the incompatibility of certain functions the softwareserial library for arduinodoes not work on esp8266.
I have tested with ESP8266 NodeMCU and SoftwareSerial library of the espsoftwareserial repository created or supplied by plerupthanks for your contribution to the community.
In the case that these libraries that create a uart in code must be taken into account that at high speeds it is possible to have bit errors since they use interrupts and the microcontroller you are in many tasks at a time, in my case and the tests that I have I configured the port at Maximo 9600 Bauds, it is a relatively low speed but I consider it to be safe.
To verify the operation of the softwareserial library, I downloaded the library for espand I have temporarily replaced the serial software version for arduino.
This test creates a bridge between the 2 serial ports.
2 4 6 8 10 12 14 16 18 20 22 24 26 | SoftwareSerial mySerial(13,15,false,256); //Mas informacion http://pdacontrolen.com/ { // Open serial communications and wait for port to open: while(!Serial){ ;// wait for serial port to connect. Needed for Leonardo only Serial.println('Connect! - Conexion '); mySerial.begin(9600); mySerial.println('Connect! - Conexion SOFTWARESERIAL'); { Serial.write(mySerial.read()); mySerial.write(Serial.read()); |
Although this is a basic test, it requires more complete tests regarding the configuration of more serial serial ports.
The idea is to use this library in future integrations in Modbus RTU, Recommended TrialCommand.