Mudanças entre as edições de "ESTE: UART - Interrupts and Circular Buffer"

De MediaWiki do Campus São José
Ir para navegação Ir para pesquisar
Linha 50: Linha 50:
  
 
==References==
 
==References==
*[http://www.embarcados.com.br/arquitetura-de-desenvolvimento-de-software-ii/ Embarcados: Arquitetura de desenvolvimento de software]
+
*[http://db.zmitac.aei.polsl.pl/Electronics_Firm_Docs/ATMEL/Atmel/acrobat/doc1451.pdf Atmel: Using the AVR UART in C]
*[https://www.youtube.com/watch?v=Ih-wJGpFjqs Video Tutorial: UART Between the AVR Microcontroller and Computer ]
+
*[http://www.embarcados.com.br/arquitetura-de-desenvolvimento-de-software-i/ ]
*[http://deans-avr-tutorials.googlecode.com/svn/trunk/InterruptUSART/Output/InterruptUSART.pdf Deans AVR Tutorials: Interrupt Driven USART in AVR-GCC]
+
*[http://leap-embedded-system.com/?p=79 LEAP: An Interrupt Driven Circular Buffer for Serial Communication]
*[http://www.kanda.com/AVR-C-Code-UART.php Kanda: AVR UART Code]
+
*[http://www.simplyembedded.org/tutorials/interrupt-free-ring-buffer/ Simply Embedded: UART Receive Buffering]
 +
*[http://www.downtowndougbrown.com/2013/01/microcontrollers-interrupt-safe-ring-buffers/ Downtown Doug Brown: Microcontrollers: Interrupt-safe ring buffers]
 +
*[http://www.avrfreaks.net/forum/tutsoft-interrupt-driven-uart-receive-ring-fifo-buffer AVR Freaks: Interrupt Driven UART Receive Ring (FIFO) Buffer]
 +
*[https://code.google.com/p/arduino-buffered-serial/ Google Code: Arduino buffered serial]

Edição das 09h19min de 15 de outubro de 2015

This experiment is part of this project.

To complete this experiment it is recommended to see at first the UART - Basic Interrupts script.

Pseudo code

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

int main(void) {
    byte incomingByte;
    baud_rate = 9600;
    while(1) {
        led_off();
    }
    return 0;    
}
void serial_interrupt_event() {
    if (data_available_on_input_field()) {
        incomingByte = read_data_on_input_field();
        println(incomingByte);
        led_on();
    }
}

This pseudo-code has a comparison statement to check if there are data available on the input field of the serial monitor, i.e serial port. If so, the data available will be stored on the memory, printed - only for debuging- and the led will be lighted on.

Schematic

Fig. 1 Schematic of the circuit

Part List

  • 1 LED
  • 1 220 ohm resistor for the led
  • 1 Protoboard
  • 2 copper wires (tinned) or jumpers


Assembly

Fig. 2 Assembly of the circuit

Solutions

Tools

References