Robotic Motor Controller - Arduino Serial Port
Serial Port data in and data out
- The information transfers in or out one bit at a time through serial communication interface is called a serial port.
- A virtual serial port is a computation of the standard serial port.
- This port is created by software which permit extra serial ports in an operating system without additional hardware installation (such as expansion cards, etc.).
- It is possible to create a large number of virtual serial ports in a PC. The only limitation is the amount of resources, such as operating memory and computing power, needed to compete with many serial ports at the same time.
![Arduino connected to computer](https://wikitechy.com/final-year-project/dotnet/robotic-motor-controller/img/robotic-motor-controller-images/arduino-connected-to-computer.png)
Arduino connected to computer
Serial Port data in (Transmitting)
- Transmitting is defined as a sending bytes data out of the serial port away from the computer.
- When the computer wants to send a byte out the serial port (to the external cable) the CPU sends the byte on the bus inside the computer to the I/O address of the serial port.
- The serial port takes the byte, and sends it out in one bit at a time (a serial bit-stream) on the transmit pin of the serial cable connector.
- when a byte has been fully transmitted out the transmit wire of the serial port and the shift register is now empty the following 3 things happen almost simultaneously:
- The next byte is moved from the transmit buffer into the transmit shift register.
- The transmission of this new byte (bit-by-bit) begins.
- Another interrupt is issued to tell the device driver to send another byte and now empty transmit buffer.
- A major improvement has been the increase the buffer size of the serial port from 1-byte to 16-bytes. This means that when the CPU gets an interrupt it gives the serial port up to 16 new bytes to transmit.
- The 16-byte buffer is actually a FIFO (First In First Out) queue and is often called a FIFO.
Serial Port data out (Receiving)
- Receiving bytes by a serial port is parallel to sending them only it's in the opposite direction. Serial port data out is also interrupt driven.
- when a byte is fully received from the external cable it goes into the 1-byte receive buffer.
![Serial Port data out](https://wikitechy.com/final-year-project/dotnet/robotic-motor-controller/img/robotic-motor-controller-images/serial-port-data-out.png)
Serial Port data out