Serial Communication Interface

Slides:



Advertisements
Similar presentations
EUSART Serial Communication.
Advertisements

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.
DATA COMMUNICATIONS Some organisations concerned with standards: EIA - Electroonic Industries Association (RS standards including RS-232) IEEE - Institute.
1 Homework Reading –Tokheim, Section 13-6 Continue mp1 –Questions? Labs –Continue labs with your assigned section.
Serial I/O - Programmable Communication Interface
Starting with serial Chapter Ten 10.1, 10.2,
Eng. Husam Alzaq The Islamic Uni. Of Gaza
COMP3221: Microprocessors and Embedded Systems
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
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.
EEE305 Microcontroller Systems Lecture 7: Embedded C using PIC microcontrollers Serial i/o with the XC8 Teaching resources are at
University of Tehran 1 Interface Design Serial Communications Omid Fatemi.
Technology Training that Works Hands of Data Communications, Networking & TCP/IP Troubleshooting.
Serial Communication ETEC 6416.
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),
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)
“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
 8251A is a USART (Universal Synchronous Asynchronous Receiver Transmitter) for serial data communication.  Programmable peripheral designed for synchronous.
Universal Asynchronous Receiver/Transmitter (UART)
8051SERIAL PORT PROGRAMMING
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.
Criteria for choosing a microcontroller A microcontroller must meet the task at hand efficiency and cost effectively. Speed. What is highest speed of.
NARNARAYAN SHASTRI INSTITUTE OF TECHNOLOGY Prepared by: Wasu Ichcha kaur H Bhalani Nidhi M Dhakate Megha D MICROCONTROLLER.
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.
Chapter 6 Serial Communications
Serial mode of data transfer
UART Serial Port Programming
RS-232 Communications.
INT. TO EMBEDDED SYSTEMS DEVELOPMENT
Homework Reading Continue mp1 Labs Tokheim, Section 13-6 Questions?
CS-401 Computer Architecture & Assembly Language Programming
Chapter 10 PIC18 Serial Port Programming in Assembly
Serial I/O and Data Communication.
SERIAL PORT PROGRAMMING
RS-232 Communications.
UART and UART Driver B. Ramamurthy.
Serial Communication: RS-232 (IEEE Standard)
Local Asynchronous Communication (RS-232)
Source: Serial Port Source:
USART Universal Synchronous Asynchronous Receiver Transmitter
UART Serial Port Programming
Asynchronous Serial Communications
UART and UART Driver B. Ramamurthy.
UART Serial Port Programming
Serial Communication Interface: Using 8251
UART Protocol Chapter 11 Sepehr Naimi
Преглед Начин функционисања Имплементације
UART PC16550 (Universal Asynchronous Receiver/Transmitter) By Derwyn Hollobaugh
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.
Prof Afonso Ferreira Miguel
Source: Serial Port Source:
PIC Serial Port Interfacing
8051SERIAL PORT PROGRAMMING
Figure Serial versus Parallel Data Transfer
PIC Serial Port Interfacing
AVR UART The UART, or Universal Asynchronous Receiver Transmitter, provides hardware support for a serial port on AVR processors Signaling is compatible.
Presentation transcript:

Serial Communication Interface Chapter 3

Objectives Upon completion of this chapter, you will be able to: Explain serial communication protocol Describe the serial communication features of the PIC18 Program the PIC18 serial port in C

Introduction Computers transfer data in two ways: Parallel and Serial. Parallel: Eight or more data lines, few feet only, short time Serial: Single data line, long distance The PIC18 has serial communication capability built into it.

Basics of Serial Communication The byte of data must be converted to serial bits using a parallel-in-serial-out shift register Serial versus Parallel Data Transfer

Basics of Serial Communication (cont’d) The receiving end must be a serial-in-parallel-out shift register and pack them into a byte. Two methods of serial data communication: Synchronous and Asynchronous Transfers a block of data at a time Transfers a single byte at a time

Half-and Full-Duplex Transmission

Start and Stop Bits In the asynchronous method, each character is placed between start and stop bits (framing) Framing ASCII ‘A’ (41H) LSB MSB

Data Transfer Rate Rate of data transfer: bps (bits per second) Another widely used terminology for bps is baud rate For Asynchronous serial data communication, the baud rate is generally limited to 100,000bps

RS232 Standard Input-output voltage are not TTL compatible Standard for serial comm (COM port) 1: -3V to -25V; 0: +3V to +25V Reason: for long distance wired line Input-output voltage are not TTL compatible So, we need MAX232/233 for voltage converter. Commonly known as line drivers

RS232 Pins Connectors: Minimally, 3 wires: RxD, TxD, GND Could have 9-pin or 25-pin DB-9 9-Pin Connector DB-25 25-Pin Connector

RS232 Pins (cont’d) IBM PC DB-9 Signals Pin 1 – Data Carrier Detect (DCD) Pin 2 – Received Data (RxD) Pin 3 – Transmitted Data (TxD) Pin 4 – Data Terminal Ready (DTR) Pin 5 – Signal Ground (GND) Pin 6 – Data Set Ready (/DSR) Pin 7 – Request to Send (/RTS) Pin 8 – Clear to Send (/CTS) Pin 9 – Ring Indicator (RI) DB-9 9-Pin Connector Data in Data out

PIC18 Connection to RS232 Line driver (a) Inside MAX232 (b) its Connection to the PIC18

PIC18 Connection to RS232 (Cont’d) Line driver (a) Inside MAX233 (b) Its Connection to the PIC18

The baud rate in the PIC18 is programmable SPBRG (Serial Port Baud Rate Generator) Register and Baud Rate in the PIC18 The baud rate in the PIC18 is programmable The value loaded into the SPBRG decides the baud rate Depend on crystal frequency Baud Rate SPBRG (Hex Value) 38400 3 19200 7 9600 F 4800 20 2400 40 1200 81 *For XTAL = 10MHz only!

Baud rate Formula (pg.397) X (SPBRG) = (156250/Desired Baud Rate) - 1 Example: Desired baud rate = 1200, Clock Frequency = 10MHz X (SPBRG) = (156250/1200) – 1 X (SPBRG) = 129.21 = 129 = 81H

TXREG Register 8-bit register used for serial communication in the PIC18 For a byte of data to be transferred via the Tx pin, it must be placed in the TXREG register

RCREG Register 8-bit register used for serial communication in the PIC18 When the bits are received serially via the Rx pin, the PIC18 deframes them by eliminating the START and STOP bit, making a byte out of data received and then placing in the RCREG register

TXSTA (Transmit Status and Control Register)

TXSTA (Transmit Status and Control Register) (Cont’d)

RCSTA (Receive Status and Control Register) _used to enable the serial port to receive data

RCSTA (Receive Status and Control Register) (Cont’d)

PIR1 (Peripheral Interrupt Request Register 1)

Programming the PIC18 to Transfer Data Serially TXSTA register = 20H: Indicating asynchronous mode with 8-bit data frame, low baud rate and transmit enabled Set Tx pin an output Loaded SPBRG for baud rate Enabled the serial port (SPEN = 1) Character byte to transmit is write into TXREG Keep Monitor TXIF bit To transmit next character, go to step 5

Example1 Write a C program to transfer the letter ‘G’ serially at 9600, continuously. Use 8-bit data and 1 stop bit. Assume XTAL = 10MHz.

Example 1 (cont’d)

Example2 Write a C program to transfer the message “YES” serially at 9600, continuously. Use 8-bit data and 1 stop bit. Assume XTAL = 10MHz.

Example2 (cont’d)

Example 3 Write a C program to receive bytes of data serially and put them on PORTB. Set the baud rate at 9600, 8-bit data and 1 stop bit.

Example 3 (cont’d)

End of Chapter 3