1 / 17

UART

UART. By: Jonathan Levesque. Table of contents. System view Applications Hardware vs. firmware spec: Atmel AVR, protocol, programming options C functions. What is UART. Computer hardware Transfers data Can also communicate synchronously. Features of UART.

keely
Download Presentation

UART

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. UART By: Jonathan Levesque

  2. Table of contents • System view • Applications • Hardware vs. firmware • spec: Atmel AVR, protocol, programming options • C functions

  3. What is UART • Computer hardware • Transfers data • Can also communicate synchronously

  4. Features of UART • There is no clock for UARTs • Data (D) is transmitted one bit at a time

  5. Why use UART? • Cheap • Good when high speed isn’t required • PC devices such as mice and modems used to often be asynchronous serial devices

  6. Uses • Communication between computers • Internet access • Mainframe access

  7. Pros/Cons Pros: Cons: • Low cost • Simple hardware • Low maintenance • Slow • Unreliable • Becoming less comon

  8. Timing and Baud Rate • Crystal or External Clock • Standard Clock Frequencies 1.8432MHz, 3.6864MHz, 7.3728MHz 14.7456MHz, 18.432MHz, 22.1114MHz • 16X timing for internal operation • Standard Data rates: 110 to 921.6Kbps • Baud Rate Calculation: Baud Rate = (Clock Frequency / 16 ) / (Divisor)

  9. Hardware Transmitter Receiver

  10. Transmitter • Parallel-to-serial conversion • Parity generation • 16X timing for bit shifting • Character Framing

  11. Receiver • Serial-to-Parallel Conversion • 16X timing clock for mid bit sampling and verification • Parity sampling & verification • Stop bit sampling & verification • Data-bit sampling

  12. Software • Transmit (TBIT = 1 bit period) - Send 0, wait TBIT -Send D0, wait TBIT -Send D1, wait TBIT -. . . -Send D7 or parity, wait TBIT -Send 1, wait TBIT

  13. Software • Receive (TBIT = 1 bit period) - Wait for 0 -Wait 1/2 TBIT, If 0 continue else restart -Wait TBIT, get D0 -Wait TBIT, get D1 -. . . -Wait TBIT, get D7 or parity -Wait TBIT, If 1 okay else frame error.

  14. Communication standards/protocols • USB • Bluetooth • HTTP • FTP • RS232 • CAN • LIN • RS485 • SPI • TTL Serial (our UART) • Parallel Ports • TCP/IP • I2C • Zigbee • SimplicTI • WiFi • 802.15.4 • RF

  15. C function • #include "reg_c51.h" • char uart_data; • /** • * FUNCTION_PURPOSE: This file set up uart in mode 1 (8 bits uart) with • * timer 1 in mode 2 (8 bits auto reload timer). • * FUNCTION_INPUTS: void • * FUNCTION_OUTPUTS: void • */ • void main (void) • { • SCON = 0x50; /* uart in mode 1 (8 bit), REN=1 */ • TMOD = TMOD | 0x20 ; /* Timer 1 in mode 2 */ • TH1 = 0xFD; /* 9600 Bds at 11.059MHz */ • TL1 = 0xFD; /* 9600 Bds at 11.059MHz */ • ES = 1; /* Enable serial interrupt*/ • EA = 1; /* Enable global interrupt */ • TR1 = 1; /* Timer 1 run */ • while(1); /* endless */ • } • /** • * FUNCTION_PURPOSE: serial interrupt, echo received data. • * FUNCTION_INPUTS: P3.0(RXD) serial input • * FUNCTION_OUTPUTS: P3.1(TXD) serial output • */ • void serial_IT(void) interrupt 4 • { • if (RI == 1) • { /* if reception occur */ • RI = 0; /* clear reception flag for next reception */ • uart_data = SBUF; /* Read receive data */ • SBUF = uart_data; /* Send back same data on uart*/ • } • else TI = 0; /* if emission occur */ • } /* clear emission flag for next emission*/

  16. Manufacturers • Intersil • Maxim • Micrel semiconductor • National semiconductor • NXP • Texas Instruments

  17. Thank You

More Related