MCS51 - lecture 4. Lecture 3 1/27 Serial ports MCS51 Standard SIO Some extensions and modifications.

Slides:



Advertisements
Similar presentations
INPUT-OUTPUT ORGANIZATION
Advertisements

11-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL I/O System Design.
Chapter Microcontroller Objectives  Understand the 8051 Architecture  Use SFR in C  Use I/O ports in C.
The 8051 Microcontroller Chapter 5 SERIAL PORT OPERATION.
Serial I/O - Programmable Communication Interface
Starting with serial Chapter Ten 10.1, 10.2,
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
Chapter 6 Serial Communications Objectives Introduce the RS232 standard and position it within the crowded field of serial communications standards. Configure.
Embedded Systems UNIT 3. Pin Details of 8051 Pins 1-8: Port 1 Each of these pins can be configured as an input or an output. Pin 9: The positive voltage.
ECE 371- Unit 11 Introduction to Serial I/O. TWO MAJOR CLASSES OF SERIAL DATA INTERFACES ASYNCHRONOUS SERIAL I/O - USES “FRAMING BITS” (START BIT AND.
The 8051 Microcontroller and Embedded Systems
Lecture 10 Serial Communication.
INTERRUPTS PROGRAMMING
Chapter 6 Serial Communications Objectives Introduce the RS232 standard and position it within the crowded field of serial communications standards. Configure.
1 SCI Serial Communication Interface Gerrit Becker James McClearen Charlie Hagadorn October 21, 2004.
INPUT-OUTPUT ORGANIZATION
Microcontroller 8051.
Serial Peripheral Interface Module MTT M SERIAL PERIPHERAL INTERFACE (SPI)
The 8051 Microcontroller and Embedded Systems
Input/Output mechanisms
UART and UART Driver B. Ramamurthy.
S4525A Peripherals & Enhanced FLASH 1 © 1999 Microchip Technology Incorporated. All Rights Reserved. S4525A Peripherals & Enhanced FLASH 1 Peripherals.
Lecture Set 9 MCS-51 Serial Port.
Universal Synchronous/Asynchronous Receiver/Transmitter (USART)
1 Microprocessor-based Systems Course 9 Design of the input/output interfaces (continue)
Universal Asynchronous Receiver/Transmitter (UART)
CHAPTER SERIAL PORT PROGRAMMING. Basics of Serial Communication Computers transfer data in two ways: ◦ Parallel  Often 8 or more lines (wire conductors)
Serial Communication Lec note 9.
Scott Baker Will Cross Belinda Frieri March 9 th, 2005 Serial Communication Overview ME4447/6405.
1. Registers Used in Timer/Counter  TH0, TL0, TH1, TL1  TMOD (Timer mode register)  TCON (Timer control register) 2.
Advanced Microprocessor1 I/O Interface Programmable Interval Timer: 8254 Three independent 16-bit programmable counters (timers). Each capable in counting.
Example. SBUF Register SCON Register(1) SCON Register(2)
 8251A is a USART (Universal Synchronous Asynchronous Receiver Transmitter) for serial data communication.  Programmable peripheral designed for synchronous.
NS Training Hardware. Serial Controller - UART.
Universal Asynchronous Receiver/Transmitter (UART)
8051 Micro controller. Architecture of 8051 Features of 8051.
MCS51 - lecture 6. Lecture 6 1/32 Extending MCS51 system Built-in peripherals MCS51 family.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
MCS51 - lecture 5. Lecture 5 2/28 Interrupts in MCS51 Step work Power consumption reducing.
MCS51 - lecture 3. Lecture 3 2/30 Timers/counters MCS51.
Serial Communications Interface Module Slide #1 of 19 MC68HC908GP20 Training PURPOSE -To explain how to configure and use the Serial Communications Interface.
8051SERIAL PORT PROGRAMMING
8255:Programmable Peripheral Interface
Communicating. The ATmega16 communicates through one of the following ways: Serial Peripheral Interface (SPI) Universal Synchronous and Asynchronous serial.
CE-2810 Dr. Mark L. Hornick 1 Serial Communications Sending and receiving data between devices.
8251 USART.
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
Tiva C TM4C123GH6PM UART Embedded Systems ECE 4437 Fall 2015 Team 2:
Serial I/O Port.
Chapter 6 Serial Communications
Serial mode of data transfer
Source: Serial Port Source:
SERIAL PORT PROGRAMMING
BVM Engineering College Electrical Engineering Department : Microprocessor and Microcontroller Interfacing Interrupts of 8051 Prepared by:
Introduction to Micro Controllers & Embedded System Design Interrupt
Introduction to Micro Controllers & Embedded System Design I/O Processing and Serial Port Operation Department of Electrical & Computer Engineering Missouri.
Computer Organization and Design
Source: Serial Port Source:
Serial Communication Interface: Using 8251
Serial Communication Interface
NS Training Hardware.
Interrupt Source: under
Programmable Data Communication Blocks
Interrupt Source: under
Source: Serial Port Source:
CHAPTER SERIAL PORT PROGRAMMING. Basics of Serial Communication Computers transfer data in two ways: ◦ Parallel  Often 8 or more lines (wire.
Serial Communication 19th Han Seung Uk.
Prof Afonso Ferreira Miguel
Source: Serial Port Source:
8051SERIAL PORT PROGRAMMING
Presentation transcript:

MCS51 - lecture 4

Lecture 3 1/27 Serial ports MCS51 Standard SIO Some extensions and modifications

MCS51 - standard SIO 2/27 Standard SIO features: possible half-duplex 8-bit data synchronous communication at constant speed; possible full-duplex 8- or 9-bit data asynchronous communication at constant or programmable speed; communication with shorter data words (5, 6, 7 bits) - only with special software single buffer for receiver and transmitter; data accessible through buffer register SBUF; controlled by register SCON & bit SMOD in reg. PCON; possible multiprocessor communication; end of receiving and transmitting signalling by flags RI & TI; interrupt request as logical RI or TI.

MCS51 - standard SIO 3/27 Control register: SM0,SM1,SM2 - working mode selection: mode 0 - synchronous mode 1 - asynchronous mode 1 - asynchronous with waiting for correct stop bit mode 2 - asynchronous mode 2 - asynchronous with ignoring received data, which 9th bit is cleared mode 3 - asynchronous mode 3 - asynchronous with ignoring received data, which 9th bit is cleared SM0 9F SM1 9E SM2 9D REN 9C TB8 9B RB8 9A TI 99 RI 98 SCON98h

MCS51 - standard SIO 4/27 REN - receiver enabling bit TB8 - 9th data bit to send (in mode 2 & 3) RB8 - received 9th data bit (in mode 2 & 3) TI - transmitter interrupt flag, set after sending last bit, should be cleared by software RI - receiver interrupt flag, set after receiving last bit, should be cleared by software SMOD---GF1GF0PDIDL PCON87h 99hSBUF SMOD - double speed bit of SIO port in mode 1,2 i 3 SBUF - buffer data register

MCS51 - standard SIO 5/27 Mode 0 - synchronous

Mode 0 communication MCS51 - standard SIO 6/27

MCS51 - standard SIO 7/27 Mode bit, asynchronous

MCS51 - standard SIO 8/27 Mode 1 - communication

MCS51 - standard SIO 9/27 Mode 2 & bit, asynchronous

MCS51 - standard SIO 10/27 Mode 2 & 3 - communication

MCS51 - standard SIO 11/27 Possible baud rates: 1. synchronous mode: f B = f CLK /12 2. asynchronous mode 1 & 3: f B = 2 SMOD  f TF1 /32 3. asynchronous mode 2: f B = 2 SMOD  f CLK /64 Using timer/counter 1 with 8-bit automatic reload: f B = 2 SMOD  f CLK : 12 : 32 : (256-TH1) Using timer/counter 2 with 16-bit reload: f B = f CLK : 32 : (65536-RCAP2)

MCS51 - standard SIO 12/27

MCS51 - standard SIO 13/27 Baud rate ( f B ) tuning during receiving: Receiving with match frequencies f B = f B * : Receiving with f B > f B * : Receiving with f B < f B * : receive start (falling edge) clearing divider ‘:16’ new synchronization No-error condition: correct read last data bit (RB8) & STOP_bit=1

MCS51 - standard SIO 14/ A B C D E F divider ‘:16’ content during bit detection in mode 1,2 i 3 RxD input A B C D E F A B C D STOP (11 bit of frame) (10+6/16)1/f BMAX (10+10/16)1/f BMIN 10  1/f B * 11  1/f B *

MCS51 - standard SIO 15/27 Receiver frequency f B tolerance estimation:

MCS51 - standard SIO 16/27 Baud rate ( f B ) tuning during transmitting Transmitting with match frequencies z f B = f B * : Transmitting with higher f B > f B * : Transmitting with lower f B < f B * : transmitting start new synchronization No-error transmit/receive condition: correct read last data bit (RB8) & STOP_bit=1

MCS51 - standard SIO 17/ A B C D E F divider ‘:16’ content during bit detection in mode 1,2 i 3 RxD input A B C D E F A B STOP (11 bit of frame) 11  1/f BMAX 10  1/f BMIN (10+6/16)  1/f B * (10+10/16)  1/f B *

MCS51 - standard SIO 18/27 Transmitter frequency f B tolerance estimation : Receiver tolerance range is less, so it becomes obligatory:

MCS51 - standard SIO 19/27 Possibilities of achieving correct baud rates f B  on different f CLK

MCS51 - standard SIO 20/27 Multiprocessor communication RxD TxD  C1 RxD TxD  C2 RxD TxD  Ck distributed system data exchange; processes synchronization; data acquisition...

MCS51 - standard SIO 21/27 SIO port in multiprocessor communication: connect terminal RxD & TxD to single transmission line; utilize mode 2 & 3 with bit SM2=1 - it allows to receive only frames with set 9th bit (RB8); only one microcontroller can be superior; superior microcontroller has cleared bit SM2; subordinate microcontrollers should have bit SM2=1; each microcontroller should have individual 8-bit address; “common address” can be used for broadcasting; in SIO interrupt service routine, if RI=1 at the first calling address should be checked.

MCS51 - standard SIO 22/27 Exemplary algorithm: 1. Superior processor send the frame with calling (or common) address and set TB8 bit - address describes destination for following data. 2. All other processor, acting as subordinate, have set SM2 bit and will receive this calling frame - calling address will be placed in SBUF and flag RI is set. 3. SIO service routine starts in each microcontroller and according to state: RI=1 & SM2=1 compares content of SBUF with local or common address. 4. If any processor recognize the address, it clear his SM2 bit and finishes service routine, other processors finish their SIO service with SM2=1. 5. Data exchange between superior processor and addressed subordinate one starts at SM2=0 & cleared TB8/RB8 bits. SIO of other processors ignore such data frame. 6. At the end of communication subordinate processor sets SM2=1.

MCS51 - extended SIO 23/27 Additional functions: 1. STOP bit error detection - the absence ‘1’ at expected moment - so called frame error, additional bit FE, which can be checked by reading SM0 bit from SCON. 2. Automatic calling address matching during multiprocessor communication - enabled by SM2=1; 3. In mode 1 all received bytes with correct STOP bit are analysed, and in mode 2 & 3 - only these with RB8=1.

MCS51 - extended SIO 24/27 RI flag is set only if received byte matches to programmed address mask. 2 additional SFR registers: SADDR0A9h SADEN0B9h Received address-byte matches with pattern, if : (received_byte  SADDR)  SADEN = 00h Example: in  C1 were set:in  C2 were set: SADDR= SADEN= active address= x110000x1 So calling address activate only  C1, address only  C2, address both  C, and any address matched with xxxxxx11 will be ignored.

MCS51 - additional SIO 25/27 For example Siemens’ microcontroller Functions: only asynchronous communication (modes 1,2 & 3; own baud rate generator; registers like in standard (S1BUF i S1CON)

MCS51 - other serial interfaces 26/27 SPI - full-duplex synchronous bus, to communication with specialised peripherals, configuration memories, or to programming ISP. Served by set of registers (SPDR, SPSR, SPCR) I2C - half-duplex synchronous bus, to communication with specialised peripherals, configuration memories. Two variants are met: 1. hardware support at byte level (for example registers S1DAT, S1CON, S1SRA i S1ADR in C552) 2. hardware support at bit level (for example registers: S1INT, S1BIT & S1SCS in C524, or I2CON, I2DAT, I2CFG & I2STA in C751,C752)