Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
pt:avr:usart [2015/12/02 11:24] – Criação deste novo documento. articapt:avr:usart [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== USART ====== ====== USART ======
  
-USART is a universal synchronous serial interface; UART, is a simplified version - universal asynchronous serial interfaceThe difference being that USART also uses a clock signal line to synchronize databut UART only uses data lines. AVR's USART allows the use of full duplex communication, 5- to 9-bit data words (8-bit word = byte), 1 or stop bits, three parity modes and a wide variety of baud rates. AVR microcontrollers typically have up to 2 USART interfacesalthough some may have no USARTData transmission is performed one word at a time - AVR converts the word it gets from the user to bits on the hardware level and transmits it independently and vice versa. The user controls USART by reading and writing configuration, status and data registers.+Um USART é uma interface serial síncrona universal; um UART, é uma versão simplificada interface serial assíncrono universal. A diferença é que um USART usa também uma linha de sinal do relógio para sincronizar os dadosmas um UART só usa linhas de dadosO USART do AVR permite o uso de comunicação full duplex, com palavras de dados de bits (8 bits de palavras = byte), 1 ou 2 bits de paragemtrês modos de paridade e uma grande variedade de taxas de transmissãoOs microcontroladores AVR têm normalmente até interfaces USART, embora alguns possam não tê-losA transmissão de dados é realizada usando uma palavra de cada vez AVR converte a palavra que recebe do utilizador para bits ao nível de hardware e transmite-a de forma independente e vice-versa. O utilizador controla o USART lendo e escrevendo a configuraçãostatus e registos de dados.
  
-Every configuration option has corresponding registerswhich are quite easy to configure using the datasheet. The baud ratethoughis a bit more difficult to setThe clock signal for data transmission is generated from the controller's own clock, and the user can specify number from to 4096, by which the controller's clock cycle is dividedThe result is additionally divided by 2, 8 or 16, depending on the modeThe problem is, not all clock frequencies can be divided so that the result is a standard baud rateWith some frequenciesthe baud rate can differ from the standard by up to 10%. AVR datasheets contain tables with typical clock frequenciesbaud ratesthe needed multiplier to reach that baud rate and the possible calculation error.+Cada opção de configuração tem registos correspondentesque são muito fáceis de configurar usando a datasheet. A taxa de transmissãoporémé um pouco mais difícil de definirO sinal de relógio para transmissão de dados é gerada partir próprio relógio do controlador, e o utilizador pode especificar um número de 4096, pelo qual ciclo de relógio do controlador é divididoO resultado é adicionalmente dividido por 2, 8 ou 16, dependendo do modoO problema é que nem todas as frequências de relógio podem ser divididas de modo que o resultado seja uma velocidade de transmissão padrãoEm algumas frequênciasa taxa de transmissão pode ser diferente do padrão até 10%. A datasheet de um AVR contêm tabelas com freqüências de relógio típicastaxas de transmissãoo multiplicador necessário para chegar a essa taxa de transmissão e o erro de cálculo possível.
  
-Since data transmission takes place independently of the processor and much slowerit is necessary to confirm that the interface is ready for the next word before transmittingThis can be done by keeping an eye on the transmit buffer'ready bit, which signifies if the buffer is ready to accept a new word or notThe controller starts with the ready bit enabledAs soon as a word is transmitted and the buffer is emptythe ready bit is set high.+Uma vez que a transmissão de dados ocorre de forma independente do processador e de forma muito mais lentaé necessário confirmar que a interface está pronta para a próxima palavra antes de a transmitirIsso pode ser feito tendo em conta o ready bit do buffer de transmissãoque significa que o buffer está pronto para aceitar uma nova palavra ou nãoO controlador começa com o ready bit habilitadoLogo que uma palavra é transmitida e o buffer está vazioready bit é estabelecido.
  
-The arrival of a word is signified also by a special status bit. In addition to thatthere are status bits to signify framing errorsparity errors and receive buffer overflows. Buffer overflow can occur when the last word is yet to be read from the buffer while new one arrives this is why it is always important to read the incoming words to the program as soon as possiblefor exampleby using an interruptThere are three possible interrupt reasonstransmit buffer readytransmit successful and receive successful.+A chegada de uma palavra é sinalizada também por um bit de status especialAlém dissohá bits de status para sinalizar erros de enquadramentoerros de paridade e para receber overflows do bufferoverflow do buffer pode ocorrer quando última palavra ainda está para ser lida a partir do buffer, enquanto uma nova chega é por isso que é sempre importante ler as palavras de entrada para o programa tão rapidamente quanto possívelpor exemploutilizando uma interrupçãoHá três razões possíveis de interrupção: buffer de transmissão prontotransmissão bem sucedida e recepção bem sucedida.
  
-The transmit and receive buffers are physically separate registersbut share the same memory address and nameWhen writing to the shared registerthe data is stored in the transmit bufferand when reading from itthe data is read from the receive bufferWhen using 9-bit wordsthe 9th bit is transmitted and read using one of the configuration registers.+Os buffers de transmissão e recepção são registos fisicamente separadosmas partilham o mesmo endereço de memória e nomeQuando escrevemos para o registo comumos dados são armazenados na memória intermédia de transmissãoe quando lemos a partir deleos dados são lidos a partir da memória intermédia de recepçãoAo usar palavras bitso nono bit é transmitido e lido usando um dos registos de configuração.
  
-~~PB~~+<pagebreak>
  
-<box 100% round #EEEEEE|Example>+<box 100% round #EEEEEE|Exemplo>
  
 Task: Configure an 8 MHz ATmega128's USART0 interface to transmit 8-bit words asynchronously using 9600 bps baud rate, 1 stop bit and no parity bits. Send the symbol "X". Task: Configure an 8 MHz ATmega128's USART0 interface to transmit 8-bit words asynchronously using 9600 bps baud rate, 1 stop bit and no parity bits. Send the symbol "X".
pt/avr/usart.1449055487.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0