Configuration and Programming

Slides:



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

EUSART Serial Communication.
Serial Communications Interface (SCI) Michael LennardZachary PetersBao Nguyen.
11-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL I/O System Design.
ECT 357 Ch 18 UART. Today’s Quote: Be careful that your marriage doesn’t become a duel instead of a duet. Be careful that your marriage doesn’t become.
The 8051 Microcontroller Chapter 5 SERIAL PORT OPERATION.
SCI: Serial Communications Interface Presented by: Sean Kline Chad Smith Jamie Cruce.
Serial I/O - Programmable Communication Interface
Microprocessor based Design for Biomedical Applications MBE 3 – MDBA IV : The ATmega8 Basic Features (3)
COMP3221: Microprocessors and Embedded Systems Lecture 22: Serial Input/Output (II) Lecturer: Hui Wu Session 1, 2005.
USARTS CS423 Dick Steflik. USART ● Universal Synchronous Asynchronous Receiver Transmitter ● used to send and receive small packets over a serial line.
USART and Asynchrono us Communica tion The USART is used for synchronous and asynchronous serial communication. USART = Universal Synchronous/Asynchronous.
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
Network and Systems Laboratory nslab.ee.ntu.edu.tw.
The Arduino Platform A “development module”
1 SCI Serial Communication Interface Gerrit Becker James McClearen Charlie Hagadorn October 21, 2004.
EE138 Serial Communication
Serial Peripheral Interface Module MTT M SERIAL PERIPHERAL INTERFACE (SPI)
Serial Communication ETEC 6416.
Universal Synchronous/Asynchronous Receiver/Transmitter (USART)
Microprocessor based Design for Biomedical Applications MBE 3 – MDBA III : The ATmega8 Basic Features (2)
Universal Asynchronous Receiver/Transmitter (UART)
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.
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.
CE-2810 Dr. Mark L. Hornick 1 Using the USART Configuration and Programming.
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.
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose:  This course provides an overview of the serial communication.
ELE22MIC Lecture 9-12 Serial Communications AVR USART –Universal Synchronous Asynchronous Receiver Transmitter (ACIA: Asynchronous Communications 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.
Chap.6.3 UART.
8251 USART.
Tiva C TM4C123GH6PM UART Embedded Systems ECE 4437 Fall 2015 Team 2:
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.
Digital Logic Design Alex Bronstein
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 I/O Port.
Serial mode of data transfer
CS-401 Computer Architecture & Assembly Language Programming
Source: Serial Port Source:
Serial I/O and Data Communication.
SERIAL PORT PROGRAMMING
ATMEGA 32 CONNECTIONS TO RS232; UDR AND UCSR REGISTERS
1 Input-Output Organization Computer Organization Computer Architectures Lab Peripheral Devices Input-Output Interface Asynchronous Data Transfer Modes.
COMP2121: Microprocessors and Interfacing
E3165 DIGITAL ELECTRONIC SYSTEM
Atmega32 Serial Programming Basics
Computer Organization and Design
Source: Serial Port Source:
USART Universal Synchronous Asynchronous Receiver Transmitter
UART Serial Port Programming
Serial Communication Interface: Using 8251
UART Protocol Chapter 11 Sepehr Naimi
COMP3221: Microprocessors and Embedded Systems
Lecturer: Reza Arjmandi Autumn 2015
Преглед Начин функционисања Имплементације
NS Training Hardware.
Programmable Data Communication Blocks
Source: Serial Port Source:
EUSART Serial Communication.
Serial Communication 19th Han Seung Uk.
Source: Serial Port Source:
Introduction Communication Modes Transmission Modes
AVR UART The UART, or Universal Asynchronous Receiver Transmitter, provides hardware support for a serial port on AVR processors Signaling is compatible.
Presentation transcript:

Configuration and Programming Using the USART Configuration and Programming CE-2810 Dr. Mark L. Hornick

Connection between two communicating serial devices The Tx (transmit) line of one device is connected to the Rx (receive) line of the second device Both devices have to be configured identically Same baud rate, parity, #data bits, #stop bits Tx Tx Rx Rx CS-280 Dr. Mark L. Hornick

Configuration of the USART Various I/O registers are used to Control the configuration of the USART Baud rate (bits/s) Parity (even/odd/none) Number of data bits (4-9) Framing ( 1 or 2 stop bits) Represent the status of a recent transmission or reception Frame errors Data overrun errors Tx complete Rx complete CS-280 Dr. Mark L. Hornick

Lots of registers… UCSRA – USART Control/Status Register A Mainly status flags UCSRB – USART Control/Status Register B Flags for enabling transmitting, receiving, interrupts UCSRC – USART Control/Status Register C Mode selection UBRRH, UBRRL– USART Baud Rate Registers Baud rate selection UDR– USART Data Register Does two things at once: Contains data to be transmitted, or Data that is received CE-2810 Dr. Mark L. Hornick

Duality of UDR register UDR– USART Data Register TXB and RXB I/O addresses overlap When UDR is read, the contents of the Receive Buffer (RXB) are first shifted into UDR, so that UDR contains the contents of RXB When UDR is written, the contents are shifted to the Transmit Buffer (TXB) CE-2810 Dr. Mark L. Hornick

USART Baud Rate Registers URSEL – Register select UCSRC I/O address overlaps with address of UBRRH. Set to 0 if writing this Register as UBRRH; otherwise UCSRC UBRR11:0 – Baud Rate select 12-bit register specifying the USART transmit/receive baud rate. Use the following table for calculating the value to place in these bits. BAUD is in bits/sec, fosc is the Atmega32 clock frequency. CE-2810 Dr. Mark L. Hornick

USART Control/Status Register B RXCIE – Receive complete interrupt enable Set to enable Receive Complete Interrupt. Disable to avoid conflicts with Atmon. TXCIE – Transmit complete interrupt enable Set to enable Transmit Complete Interrupt. Disable to avoid conflicts with Atmon. UDRIE – Data Register Empty interrupt enable Set to enable UDRE Interrupt. Disable to avoid conflicts with Atmon. RXEN – Receiver Enable Set to enable the USART Receiver TXEN – Transmitter Enable Set to enable the USART Transmitter CE-2810 Dr. Mark L. Hornick

USART Control/Status Register A contains status bits you read RXC – Receive complete Set when data is received in the Receive Buffer (RXB) TXC – Transmit complete Set when data in the Transmit Buffer has been completely transmitted and no new data in UDR; manually cleared by writing a 1 to this bit UDRE – Data Register Empty Set when Transmit Buffer is ready to accept new data to be transmitted FE – Frame Error Set when Data in Receive Buffer had a frame error detected DOR – Data Overrun Set when Receive Buffer is full (but unread), and new data is coming in PE – Parity Error Set when Data in Receive Buffer had a parity error detected (if parity checking was enabled) CE-2810 Dr. Mark L. Hornick

USART Control/Status Registers B and C UCSZ2, UCSZ1, UCSZ0 – Character size select Together, these set the number of data bits being transmitted or received Set these to (0:1:1) for 8 data bits; see reference manual for other settings URSEL – Register select UCSRC I/O address overlaps with address of UBRRH. Set to 1 when reading this Register as UCSRC; otherwise UBRRH UMSEL – Mode select Set to 0 for Asynchronous mode UPM1, UPM0 – Parity mode select Parity disabled (0:0), Even (1:0), Odd (1:1), Reserved (0:1) USBS– Stop bit select Set to 0 for framing using a single Stop Bit CE-2810 Dr. Mark L. Hornick

How to use the USART Set baud rate via UBRRH and UBRRL Enable Transmit and Receive via UCSRB Disable all USART interrupts via UCSRB (to avoid Atmon conflicts) Set Parity, #Data bits, #Stop bits, Async via UCSRC To Receive: Poll UDRE bit in UCSRA until set Received char in UDR Repeat To Transmit: Place character to be written in UDR Poll TXC bit in USCRA until set CS-280 Dr. Mark L. Hornick

The USART can receive while it is transmitting But the TXB and RXB buffers can each hold only one character So you must keep polling RXC to avoid dropping received characters And you must poll UDRE before sending another character to ensure that TXC has been emptied CS-280 Dr. Mark L. Hornick