UART Serial Port Programming

Slides:



Advertisements
Similar presentations
Serial Interface Dr. Esam Al_Qaralleh CE Department
Advertisements

Serial Communications Interface (SCI) Michael LennardZachary PetersBao Nguyen.
H. Huang Transparency No.9-1 The HCS12/MC9S12 Microcontroller Copyright © 2010 Delmar Cengage Learning Chapter 9: Serial Communication Interface – SCI.
SCI: Serial Communications Interface Presented by: Sean Kline Chad Smith Jamie Cruce.
Serial Communication Interface
RS-232 Port Discussion D7.1. Loop feedback RS-232 voltage levels: +5.5 V (logic 0) -5.5 V (logic 1)
Eng. Husam Alzaq The Islamic Uni. Of Gaza
Chapter 9 Serial Communication Interface  SCI. Why Serial Communication? Parallel data transfer requires many I/O pins. This requirement prevents the.
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
RS-232 Port Lecture L9.3. Loop feedback RS-232 voltage levels: +5.5 V (logic 0) -5.5 V (logic 1)
1 The 9-Pin Connector Pin abbreviations (numbers in parentheses are the 25D pin numbers): 1. CD (8) 2. RD (Rx) (3) 3. TD (Tx) (2) 4. DTR (20) 5. SG (Ground)
Harrison Jones Alexis Noel William Allen SERIAL COMMUNICATION INTERFACE (SCI)
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.
1 SCI Serial Communication Interface Gerrit Becker James McClearen Charlie Hagadorn October 21, 2004.
Serial Communication Interface (SCI) Kevin Stuart Matt Betts March 27, 2007 ME 6405, Sp 07.
University of Tehran 1 Interface Design Serial Communications Omid Fatemi.
Computers in Surveying SVY2301 / E4006 Automated Surveying.
EET 2261 Unit 11 Serial Communications Interface  Read Almy, Chapter 24.  Homework #11 and Lab #11 due next week.  Quiz next week.
The 8051 Microcontroller and Embedded Systems
Serial Port I/O Serial port sends and receives data one bit at a time. Serial communication devices are divided into: Data Communications Equipment (DCE),
Lecture Set 9 MCS-51 Serial Port.
Universal Synchronous/Asynchronous Receiver/Transmitter (USART)
“Describe the overview of hardware interfacing and the serial communication interface. Describe the PIC18 connections to RS232. Explain the serial port.
Universal Asynchronous Receiver/Transmitter (UART)
Microprocessors 2 lesson Subjects lesson 7 Planning Interrupts Serial communication /USART Questions.
CHAPTER SERIAL PORT PROGRAMMING. Basics of Serial Communication Computers transfer data in two ways: ◦ Parallel  Often 8 or more lines (wire conductors)
Serial Communications
Scott Baker Will Cross Belinda Frieri March 9 th, 2005 Serial Communication Overview ME4447/6405.
Advanced Microprocessor1 I/O Interface Programmable Interval Timer: 8254 Three independent 16-bit programmable counters (timers). Each capable in counting.
 8251A is a USART (Universal Synchronous Asynchronous Receiver Transmitter) for serial data communication.  Programmable peripheral designed for synchronous.
Universal Asynchronous Receiver/Transmitter (UART)
Serial Communication Interface Ta Kim Nicholas Earnhart Razid Ahmad ME 6405 – Fall 2008 November 6, 2008.
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
1 October 26, 2006ME 6405 MechatronicsSerial Communication Interface Brian Guerriero Jon Rogers Robert Thiets.
Serial Communications Interface Module Slide #1 of 19 MC68HC908GP20 Training PURPOSE -To explain how to configure and use the Serial Communications Interface.
ESCI Base. Serial Communication TX RX 8bits Interrupt on Receiver Full 4 Enhanced Serial Communication Interface (eSCI) in the PXR40 eSCIB is used for.
CE-2810 Dr. Mark L. Hornick 1 Serial Communications Sending and receiving data between devices.
8251 USART.
BASICS OF SERIAL COMMUNICATIONS BIRLA VISHWKARMA MAHAVIDYALAYA ELECTRONICS & TELECOMMUNICATION DEPARTMENT PRESENTING BY: ABHISHEK SINGH AMANDEEP.
SCI Communication Proudly Presented By: Adam Cardi & Aaron Enes.
Lecture 15. Modem Controller Register 4310 DTR 0 = Polling Operator 1 = Interrupts Enabled RTS 1 =Self Test 0 =Normal.
Lecture # 14. RS – 232C Standard Standard for physical dimensions of the connectors. PC (DTE) Modem RS – 232C Cable Connected via serial port (DCE)
Chapter 4 UART Serial Port Programming 1. Serial vs. Parallel Data Transfer 2.
The HCS12 SCI Subsystem A HCS12 device may have one or two serial communication interface. These two SCI interfaces are referred to as SCI0 and SCI1. The.
Serial mode of data transfer
UART Serial Port Programming
RS-232 Communications.
CS-401 Computer Architecture & Assembly Language Programming
EET 2261 Unit 10 Serial Communications Interface
Homework Reading (linked from my web page) Machine Projects Labs
Serial I/O and Data Communication.
SERIAL PORT PROGRAMMING
RS-232 Communications.
Serial Communication: RS-232 (IEEE Standard)
Programming Microcontroller
Serial Communication Interface
UART Serial Port Programming
Serial Communication Interface: Using 8251
SPI Protocol and DAC Interfacing
Serial Communication Interface
UART Protocol Chapter 11 Sepehr Naimi
Преглед Начин функционисања Имплементације
Interrupt and Exception Programming
CHAPTER SERIAL PORT PROGRAMMING. Basics of Serial Communication Computers transfer data in two ways: ◦ Parallel  Often 8 or more lines (wire.
Chapter 6 Transmission of Digital Data Interfaces and Modems
EUSART Serial Communication.
PIC Serial Port Interfacing
8051SERIAL PORT PROGRAMMING
Figure Serial versus Parallel Data Transfer
PIC Serial Port Interfacing
Presentation transcript:

UART Serial Port Programming Chapter 4 UART Serial Port Programming

Serial vs. Parallel Data Transfer

Parallel In Serial Out

Serial In Parallel Out

Simplex, Half-, and Full-Duplex Transfers

Framing ASCII "A" (0x41)

MAX232

MAX233

RS232 Pins Pin Description 1 Data carrier detect (DCD) 2 Received data (RxD) 3 Transmitted data (TxD) 4 Data terminal ready (DTR) 5 Signal ground (GND) 6 Data set ready (DSR) 7 Request to send (RTS) 8 Clear to send (CTS) 9 Ring indicator (RI)

9-Pin Male Connector

DTE-DCE and DTE-DTE Connections

Null Modem Connection with Flow Control Signals

Freescale FRDM board

ICDI USB Port

a Simplified Block Diagram of UARTn

OpenSDA USB Port

Partial list of UART0 Registers and their addresses Register Name Register Function Register Address UART0_BDH Baud Rate High 4006 A000 UART0_BDL Baud Rate Low 4006 A001 UART0_C1 Control 1 4006 A002 UART0_C2 Control 2 4006 A003 UART0_S1 Status 1 4006 A004

a Simplified Block Diagram of UARTn

SIM_SOPT2 Register

Clock Circuit of UART0

UARTx_BDH

UARTx_BDL

UARTx_C4 Register

UARTx_C4 Register Bit Field Descriptions 7 MAEN1 Match Address Enable 1: In your programs set the bit to 0. For more information see the KL25 user manual. 6 MAEN2 Match Address Enable 2: In your programs set the bit to 0. 5 M10 10-bit Mode select: 0: Receiver and transmitter use 8-bit or 9-bit data characters 1: Receiver and transmitter use 10-bit data characters 0-4 OSR Over Sampling Ration (the value can be between 00011 to 11111)

UART0 SBR Values for Some Baud Rates using default OSR=15 and FLL clock output of 41.94 MHz. SBR (in decimal) SBR (in hex) 4,800 546 0x0222 9,600 273 0x0111 19,200 137 0x0089 38,400 68 0x0044 115,200 23 0x0017

UART Control 1 (UARTx_C1) register

UART Control 1 (UARx_C1) register Field Bit Description LOOPS D7 0 = Normal operation. RX and TX use separate pins. 1 = LOOP operation enabled. See KL25Z manual DOZEEN D6 Doze Mode Using this we can disable or enable UARTx in wait mode 0 = UART enabled in Wait mode 1 = UART disabled in Wait mode RSRC D5 Receiver source bit. Used only when LOOPS=1 (see KL25Z manual) 0 = for internally connected loop 1 = for externally connected loop M D4 Data format mode bit. We must use this to select 8-bit data frame size 0 = select 8-bit data frame, one stop bit and one start bit 1 = Select 9-bit data frame, one stop bit and one start bit WAKE D3 Wake-up condition bit. See the KL25Z manual 0 = Idle line wakeup 1 = Address mark wake-up ILT D2 Idle line type bit. See the KL25Z manual 0 = Idle character bit count begins after start bit 1 = Idle character bit count begins after stop bit PE D1 Parity Enable bit. This will allow us to insert a parity bit right after the 8th (MSB) bit. 0 = no parity bit 1 = parity bit PT D0 Parity bit type (used only if PE is one.) 0 = even parity bit 1 = odd parity bit Note: The most important bit in this register is the M bit. The vast majority of the applications use M=0 for 8-bit data size. The rest of the bits are for testing purpose and we do not use them unless we are writing UART diagnostic test software. For that reason, we make them all zeros and we use UARTx_C1 = 0x00.

UART Control 2 (UARTx_C2) register

UART Control 2 (UARTx_C2) register Field Bit Description TIE D7 Transmit Interrupt Enable bit. Used for interrupt-driven UART. See Chapter 6. 0 = TDRE Interrupt Request is disabled. 1 = TDRE Interrupt Request is enabled. TCIE D6 Transmission Complete Interrupt Enable bit. Used for interrupt-driven UART. See Chapter 6. 0 = TC Interrupt Request is disabled. 1 = TC Interrupt Request is enabled. RIE D5 Receiver Full Interrupt Enable bit. Used for interrupt-driven UART. See Chapter 6. 0 = RDRF Interrupt Request is disabled. 1 = RDRF Interrupt Request is enabled. ILIE D4 Idle Line Interrupt Enable bit. Used for interrupt-driven UART. 0 = IDLE Interrupt Request is disabled. 1 = IDLE Interrupt Request is enabled. TE D3 Transmitter Enable bit. We must enable this bit to transmit data. 0 = Transmitter is disabled. 1 = Transmitter is enabled. RE D2 Receiver Enable bit. We must enable this bit to receive data. 0 = Receiver is disabled. 1 = Receiver is enabled. RWU D1 Used for wake-up condition in stand-by mode. See the KL25Z manual. 0 = Normal operation 1 = RWU is enabled. SBK D0 Used for break bit. See the KL25Z manual. 0 = No break character 1 = Transmit break character Note: The most important bits in this register are the TE and RE bits. In applications using the polling method we make the interrupt request bits all zeros. For the polling method, we use UARTx_C2 = 0x0C. The rest of the bits are for testing purposes. To use interrupt-driven UART, see Chapter 6.

UART Data (UART_D) register

UART Status Register (UARTx_S1)

UART Status Register (UARTx_S1) Field Bit Description TDRE D7 Transmit Data Register Empty 0 = The shift register is loaded and shifting. An additional byte is waiting in the Data Register. 1 = The Data Register is empty and ready for the next byte. TC D6 Transmit Complete flag 0 = Transmission is in progress (shift register is occupied) 1 = No transmission in progress (both shift register and Data Register are empty) RDRF D5 Receive Data Register Full flag. This indicates a byte has been received and is sitting in UART Data Register and ready to be picked up. 0 = No data is available in UART Data Register. 1 = Data is available in UART Data Register and ready to be picked up. IDLE D4 Idle line flag. See the KL25Z manual. OR D3 D3 Overrun error 0 = No overrun 1 = Overrun error NF D2 Noise Flag error bit 0 = No noise 1 = Noise error FE D1 Framing Error bit 0 = No framing error 1 = Framing error PF D0 Parity flag error bit 0 = No parity error 1 = Parity error

SIM_SCGC4 (System Clock Gating Control) Register

PORTx_PCRn Alternate Function Selection register

Pins available for UARTs FRDM I/O Pin KL25Z Pin ALT2 ALT3 ALT4 J1 02 PTA1 UART0_RX   J1 04 PTA2 UART0_TX ― PTA14 PTA15 PTA18 UART1_RX PTA19 UART1_TX PTB16 PTB17 J1 05 PTC3 J1 07 PTC4 J2 08 PTD2 UART2_RX J2 10 PTD3 UART2_TX J1 06 PTD4 J2 04 PTD5 J2 17 PTD6 J2 19 PTD7 J2 20 PTE0 J2 18 PTE1 J10 01 PTE20 J10 03 PTE21 J10 05 PTE22 J10 07 PTE23

UART1 and UART2 SBR Values for Some Baud Rates using bus clock of 13 UART1 and UART2 SBR Values for Some Baud Rates using bus clock of 13.98 MHz Baud rate SBR (in decimal) SBR (in hex) 4,800 182 0x00B6 9,600 91 0x005B 19,200 46 0x002E 38,400 23 0x0017