Presentation is loading. Please wait.

Presentation is loading. Please wait.

Serial Communication 19th Han Seung Uk.

Similar presentations


Presentation on theme: "Serial Communication 19th Han Seung Uk."— Presentation transcript:

1 Serial Communication 19th Han Seung Uk

2 Parallel Communication
Transmit Multiple Bit at a time Low rate Electronic-Magnetic Interfarence Not equal Destination Time Printer Port, IDE, PCI

3 Serial Communication Transmit One Bit at a time High rate
Synchronization RS-232, SPI, I²C, Universal Serial Bus, Ethernet, Serial ATA, PCI Express High rate >> Multiple Bit

4 Serial Communication SPI USART I2C UART High speed, Complex H/W
Cheap, Simple H/W

5 USART, UART The Universal Synchronous and Asynchronous serial Receiver and Transmitter (USART) is a highly flexible serial communication device. The main features are: • Full Duplex Operation (Independent Serial Receive and Transmit Registers) • Asynchronous or Synchronous Operation • Master or Slave Clocked Synchronous Operation • High Resolution Baud Rate Generator • Supports Serial Frames with 5, 6, 7, 8, or 9 Data Bits and 1 or 2 Stop Bits • Odd or Even Parity Generation and Parity Check Supported by Hardware • Data OverRun Detection • Framing Error Detection • Noise Filtering Includes False Start Bit Detection and Digital Low Pass Filter • Three Separate Interrupts on TX Complete, TX Data Register Empty, and RX Complete • Multi-processor Communication Mode • Double Speed Asynchronous Communication Mode

6 USART, UART

7

8

9 RS-232 USART, UART : 0V ~ 5V RS-232 : -12V ~ 12V
Long Range, More safe to Noise

10 Serial Peripheral Interface
The Serial Peripheral Interface (SPI) allows high-speed synchronous data transfer between the ATmega128 and peripheral devices or between several AVR devices. The ATmega128 SPI includes the following features: • Full-duplex, Three-wire Synchronous Data Transfer • Master or Slave Operation • LSB First or MSB First Data Transfer • Seven Programmable Bit Rates • End of Transmission Interrupt Flag • Write Collision Flag Protection • Wake-up from Idle Mode • Double Speed (CK/2) Master SPI Mode

11 By MASTER’s Command FREE MASTER SLAVE

12

13 I2C (Two-wire Serial Interface)
Features • Simple yet Powerful and Flexible Communication Interface, only Two Bus Lines Needed • Both Master and Slave Operation Supported • Device can Operate as Transmitter or Receiver • 7-bit Address Space allows up to 128 Different Slave Addresses • Multi-master Arbitration Support • Up to 400 kHz Data Transfer Speed • Slew-rate Limited Output Drivers • Noise Suppression Circuitry Rejects Spikes on Bus Lines • Fully Programmable Slave Address with General Call Support • Address Recognition Causes Wake-up when AVR is in Sleep Mode

14

15

16 I2C (Two-wire Serial Interface)
__interrupt void TWI_ISR(void) { case TWI_MRX_DATA_ACK: // Data byte has been received and ACK tramsmitted TWI_buf[TWI_bufPtr++] = TWDR; case TWI_MRX_ADR_ACK: // SLA+R has been tramsmitted and ACK received if (TWI_bufPtr < (TWI_msgSize-1) ) // Detect the last byte to NACK it. TWCR = (1<<TWEN)| // TWI Interface enabled (1<<TWIE)|(1<<TWINT)| // Enable TWI Interupt and clear the flag to read next byte (1<<TWEA)|(0<<TWSTA)|(0<<TWSTO)| // Send ACK after reception (0<<TWWC); // }else // Send NACK after next reception (0<<TWEA)|(0<<TWSTA)|(0<<TWSTO)| // Send NACK after reception } break; __interrupt void UART_Recived(void) { Buf = UDR; }

17 Summary UART is Simple for Programer and H/W man
But High Price, Target for Long Range Communication SPI, I2C is Cheap and Simple H/W But Match for One Direction Communiaction(ADC, Senser...)


Download ppt "Serial Communication 19th Han Seung Uk."

Similar presentations


Ads by Google