ESTE: Universal Assynchronous Receiver and Transmitter (UART)

De MediaWiki do Campus São José
Ir para: navegação, pesquisa

This experiment is part of this project.

Here we are going to do an experiment to learn and start using the UART. UART is the universal asynchronous receiver transmitter and is one type of serial communication. Serial communication just means that only one bit of information is sent a time (as opposed to parallel communication). The UART is therefore a serial port on a board used for communication between the board and a computer or other devices and all Arduino boards have at least one serial port. At Arduino UNO, the UART are the digital pins 0 (RX) and 1 (TX) which receive and send data respectively - used for communication with other devices - and the USB - communication between the board and the computer. Thus, if you want to comunicate with other devices and you are using the RX and TX pins (0 and 1), you cannot also use those pins for digital input or output. Those pins also have corresponding LEDs on Arduino labeled RX and TX that blink when data passes. The main usages of the UART are the upload of programs to our Arduino(via USB), the communication between our micro-controller(Atmega) and our computer and the talk to some sensors/chips as graphical lcd’s and GPS modules that use almost always an serial interface. The exercise proposed here is to didactically understand the operation of the serial comunication through UART using serial monitors to visualize the results of the processes.

Pseudo code

Let's begin with a solution. The pseudo code of an echo application (actual coding is up to you) is below:

int main(void) {
    byte byte_recived;
    baud_rate = 9600;
    while(1) {
        if (data_input_field_free()) {
            byte_recived = read_data_on_input_field();
            byte_recived++;
            println(byte_recived);
        }
    }
    return 0;    
}

This pseudo-code has a comparison statement to check if the data_input_field (field where you insert characters or bytes) on the serial monitor is free to write and send new data. If so, the data recived by the serial monitor will be stored on the memory board, will be added - becoming a new character according to ASCII table - and sent back -from the board to the computer- and shown on the serial monitor.

Schematic - Part List - Asembly

  • The only equipament you will use is the Arduino Uno.

Solutions

Tools

References