Objectives. Basics of Serial Communication. Simplex vs Duplex. CMPE328 Microprocessors (Spring 2007-08) Serial Interfacing. By Dr.



Similar documents
a8251 Features General Description Programmable Communications Interface

PART B QUESTIONS AND ANSWERS UNIT I

Application Note 83 Fundamentals of RS 232 Serial Communications

Serial Communications

USART and Asynchronous Communication

Data Cables. Schmitt TTL LABORATORY ELECTRONICS II

RS-232 COMMUNICATIONS

Serial Communications

2.8.3 / (Z80 Serial I/O)

RS-422/485 Multiport Serial PCI Card. RS-422/485 Multiport Serial PCI Card Installation Guide

Parallel IO. Serial IO. Parallel vs. Serial IO. simplex vs half-duplex vs full-duplex. Wires: Full Duplex. Wires: Simplex, Half-duplex.

Using Xbee in Serial Communication

UART IP Core Specification. Author: Jacob Gorban

Manual Serial PCI Cards

Elettronica dei Sistemi Digitali Costantino Giaconia SERIAL I/O COMMON PROTOCOLS

8051 Serial Port. Crystal TXD. I/O Device RXD. Embedded Systems Peripherals

The Secrets of Flow Control in Serial Communication

PCMCIA 1 Port RS EDITION OCTOBER 1999

isco Connecting Routers Back to Back Through the AUX P

DECT Module UM-9802 Datasheet

RS232C < - > RS485 CONVERTER S MANUAL. Model: LD15U. Phone: / 97 / 98 (M)

WHQL Certification Approval...2 User Interface...3 SUNIX s COMLab..4

SyncLink GT2/GT4 Serial Adapter

RS-485 Protocol Manual

Data sheet Wireless UART firmware version 4.02

Cabling Guide for Console and AUX Ports

BLUETOOTH SERIAL PORT PROFILE. iwrap APPLICATION NOTE

AVR317: Using the Master SPI Mode of the USART module. 8-bit Microcontrollers. Application Note. Features. Introduction

UMBC. ISA is the oldest of all these and today s computers still have a ISA bus interface. in form of an ISA slot (connection) on the main board.

USB2.0 <=> I2C V4.4. Konverter Kabel und Box mit Galvanischetrennung

SC16C754B. 1. General description. 2. Features. 5 V, 3.3 V and 2.5 V quad UART, 5 Mbit/s (max.) with 64-byte FIFOs

INFORMATICA INDUSTRIALE

Teleservice via RS232 interface XC100/XC200

Programming and Using the Courier V.Everything Modem for Remote Operation of DDF6000

INFORMATICA INDUSTRIALE

The Analyst RS422/RS232 Tester. With. VTR, Monitor, and Data Logging Option (LOG2) User Manual

DK40 Datasheet & Hardware manual Version 2

LINDY ELECTRONICS LIMITED & LINDY-ELEKTRONIK GMBH - SECOND EDITION

Cable Specifications and Information

HAC-LM Series Low Power Data Radio Module

Why you need to monitor serial communication?

The Secrets of RS-485 Half-duplex Communication

Advanced Data Capture and Control Systems

COMPUTER HARDWARE. Input- Output and Communication Memory Systems

What is Easy-Radio? Devices Covered. Frequency Hopping Transceiver. Where x00 denotes frequency of operation. E.g. 400 = 433MHz

USB TO SERIAL ADAPTER

How to setup a serial Bluetooth adapter Master Guide

RJ45 Shielded (standard) port pinout. CS9000, Jetstream , Lanstream 2000, RTA8/RJX, RRC16, MTA8/RJX & SXDC8/RJX

When we look at the connector pinout of the RS232 port, we see two pins which are certainly used

1.1 Connection Direct COM port connection. 1. Half duplex RS232 spy cable without handshaking

Modbus Communications for PanelView Terminals

Cable Guide. Click on the subject to view the information. Digi Cables Building Cables General Cable Information

RS-232 Communications Using BobCAD-CAM. RS-232 Introduction

Using FPGAs to Design Gigabit Serial Backplanes. April 17, 2002

VMR6512 Hi-Fi Audio FM Transmitter Module

Industrial Multi-port Serial Cards

WHQL Certification Approval...2 User Interface K software FIFO 4 Universal PCI Interface...5 Ready for 64-bit System...5

2-Port RS232/422/485 Combo Serial PCI Card

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

Microcontroller Based Low Cost Portable PC Mouse and Keyboard Tester

Configuring IP to Serial with Auto Answer and Serial to IP

TCP/IP Converter DDS EX-9132 Operation Manual for 8051 Series

Design and Verification of Nine port Network Router

LTM-1338B. Plus Communications Manual

SC16C652B. 1. General description. 2. Features. 5 V, 3.3 V and 2.5 V dual UART, 5 Mbit/s (max.) with 32-byte FIFOs and infrared (IrDA) encoder/decoder

VSCOM USB PRO Series Industrial I/O Adapters

ELAN DIGITAL SYSTEMS LTD. SL232 PC- CARD USER S GUIDE

Single channel data transceiver module WIZ2-434

Introduction the Serial Communications Huang Sections 9.2, 10.2 SCI Block User Guide SPI Block User Guide

VDIP1. Vinculum VNC1L Module. Datasheet

MCB3101 (Class I) WiRobot Serial Bluetooth Wireless Module User Manual

Microprocessor & Assembly Language

Omron I/O Driver (Series 2) Programmable Serial Interface Card

Operation Manual of EX-9132C-2. Serial to TCP/IP Converter

Quectel Cellular Engine

USB to serial chip CH340

Application Note AN_241. FTDI_AOA_HyperTerm_User_Manual

RN-XV-RD2 Evaluation Board

Design and Implementation of Home Monitoring System Using RF Technology

ARM Thumb Microcontrollers. Application Note. Software ISO 7816 I/O Line Implementation. Features. Introduction

LOW COST GSM MODEM. Description. Part Number

Below is a diagram explaining the data packet and the timing related to the mouse clock while receiving a byte from the PS-2 mouse:

Software User Guide UG-461

SUDT AccessPort TM Advanced Terminal / Monitor / Debugger Version 1.37 User Manual

Objectives. Units of Memory Capacity. CMPE328 Microprocessors (Spring ) Memory and I/O address Decoders. By Dr.

TRP-C31M MODBUS TCP to RTU/ASCII Gateway

Dial-Up / Leased-Line Modem. User Manual. AGM Electronics, Inc Dial-Up / Leased-Line Modem, Series ( ) Manual Rev A + - DLM CTS RTS DTR DSR

[WIR-1186] 865MHz-869MHz Wireless Module(version 3.0) (3.3V)

Low Speed Modems for Dial and Leased Circuits 2400E-2 (Stand Alone) 2400R-2 (Rack Mount) 2400E-4 (Stand Alone) 2400R-4 (Rack Mount)

Communication Unit 560CMU05 Data sheet

AVR32100: Using the AVR32 USART. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

Cable Specifications and Information

TASCAM SS-CDR200/SS-R200 CONTROL I/O Terminals RS-232C Protocol Specifications

Implementing SPI Master and Slave Functionality Using the Z8 Encore! F083A

PCI 2 Port Fast Serial Communication Adapter Card User Manual

ULC Technology: High-performance gate array package using multiple metal layer CMOS technology featuring sub-micron channel lengths (0.

INTERNATIONAL TELECOMMUNICATION UNION

HAC-UM Series SHENZHEN HAC TECHNOLOGY CO., LTD. HAC-UM Series. Version 2.3C SHENZHEN HAC TELECOM TECHNOLOGY CO., LTD

CENTRONICS interface and Parallel Printer Port LPT

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC Microprocessor & Microcontroller Year/Sem : II/IV

Transcription:

CMPE328 Microprocessors (Spring 27-8) Serial Interfacing By Dr. Mehmet Bodur Objectives Upon completion of this chapter, you will be able to: List the advantages of serial communication over parallel communication Explain the difference between synchronous and asynchronous communication Define the terms simplex, half duplex, and full duplex and diagram their implementation in serial communication Describe how start and stop bits frame data for serial communication Compare the measures baud rate and bps (bits per second) Describe the RS232 standard Compare DTE (data terminal) versus DCE (data communication) equipment Describe the purpose of handshaking signals such as DTR, RTS, and CTS Describe the operation of a USART and use and 825 IC Dr.Mehmet Bodur, EMU-CMPE 2 Basics of Serial Communication Simplex vs Duplex Microprocessors are based mostly on 8-bit registers. Thus, their fastest I/O is 8-bit parallel ports. But, wiring cost of a long distance communication is very expensive if you carry 8-wires. Remedy is to transfer data serially in bits instead of in bytes or words. In Simplex Mode data flow is in one direction only. In Half Duplex Mode data flows in one direction, at a given time, A protocol and switches connect the devices both to receive and also to transmit. In Full Duplex mode, transmitted data and received data goes simultaneously through two channels. r r r r r Dr.Mehmet Bodur, EMU-CMPE 3 Dr.Mehmet Bodur, EMU-CMPE 4

Asynchronous vs Synchronous How can the receiver get each data bit when it is delivered by the transmitter? In synchronous transmission an explicit clock signal describes the instants of valid data. A single data bit is sent at each clock. Minimum three signal lines required for full duplex, -DATA, -DATA, and CLOCK. In asynchronous transmission clock is derived using a-priory parameters and a start bit. Transfer rate known, internal clock starts to pulse with the start bit, at the known transfer rate. Ony two signal lines required for full duplex -DATA and -DATA Dr.Mehmet Bodur, EMU-CMPE 5 Asynchronous Transmission Start and Stop Bits Start bit is required to synchronize the internal clock of receiver. Stop bit is required to test the clock frequency. Only DATA is transmitted, internal clock is generated locally. TTL DATA internal clock Start Internal clock starts with the start bit. D D D2 D3 D4 D5 D6 D7 Stop Bits are sampled at the rising edge of the internal clock bit#: 7 6 5 4 3 2 Data is b =65h. It is ASCII e Voltage levels are and 5V (TTL signal) Internal clock stops with the stop bit. If Stop bit is not high, it gives framing error. Dr.Mehmet Bodur, EMU-CMPE 6 time Computers may be connected to eachother at COM port or TTL signal levels as well. CPU System Bus Phone Telecommunication Media 488 and 489 UART Asynchronous Communication System TTL Level Signals MODEM BUS DRIVER MODEM RS232 Level Signals COM port BUS DRIVER UART Phone Line System Bus CPU RS232 TTL Level Level Signals Signals Dr.Mehmet Bodur, EMU-CMPE 7 Data Transfer Rate Both devices shall know the data transfer rate of the communication to synchronize the internal clocks correctly. Data transfer rate is measured in BAUD Baud = bit/second number of bits TX or RX per second (including start, stop, data, parity etc.) kilo Baud = Baud. (not 24 Baud) Mega Baud = Baud Dr.Mehmet Bodur, EMU-CMPE 8

Baud Rate Calculations If each bit takes T seconds, the baud rate is B= /T. Standard Baudrates are 5, 3, 6, 2, 24, 48, 96, 92, etc. Baudrate tolerance for a-bit frame is 5%. Example: T=29μs B= /T = 4785 Baud it is 48 Baud within 5% tolerance. Start T one frame period D D D2 D3 D4 D5 D6 D7 Stop bits 7 6 5 4 3 2 the transmitted data value is b = 65h = e time Dr.Mehmet Bodur, EMU-CMPE 9 Packet transmission time If a system sends a packet of 5 bytes at 2 Baud, using 8-data, no-parity, one stop bits, what is the transmission time of the whole packet: -byte frame is -start + 8-data + -stop bit = bits/byte. packet is transferred by 5 x bits = 5 bits on the serial communication line. T packet = 5 bits / 2 Baud =.47sec. = 47 milliseconds. Dr.Mehmet Bodur, EMU-CMPE Recommended standard describe two kind of sockets. DTE: Device Terminal Equipment. Computers, Terminals, etc. DCE: Device Communication Equipment Modem (modulator-demodulator). Equipment connections: DTE is connected to DCE without crossing. DTE is connected to DTE cross-wired. RS232 Socket Pins DTE DTE DCE DTE Handshaking Signals Modem-Terminal handshaking signals: Device status signals DTR: Data terminal ready (DTE is ok.). DSR: Data Set ready (DCE is ok.) Flow control signals RTS: Request to Send (DTE sends char.) CTS: Clear to Send (DCE accepts RTS) Dr.Mehmet Bodur, EMU-CMPE Dr.Mehmet Bodur, EMU-CMPE 2

Section 7.4 UART 825 A processor may transmit/receive data in serial format without any extra hardware. But it costs to the processing time of the processor. A UART (Universal Asynchronous r ) is a hardware device that shifts out data bits to transmit a data byte, and also shifts-in data bits to receive a data byte. Register addressing ~CS C/~D= (data) writes to the transmit buffer reads from the receive buffer ~CS C/~D= (control) writes to the mode register right after a reset. command register after mode is written. reads from the status register. Section 7.4 825 UART Device 825 USART D[..7] C/~D ~RD ~WR ~CS TXRDY TXE ~TXC TXD RXD RXRDY ~RXC SY/BR ~ DSR ~DTR ~CTS ~RTS Dr.Mehmet Bodur, EMU-CMPE 3 Dr.Mehmet Bodur, EMU-CMPE 4 Section 7.4 Section 7.4 825 system bus connection Data buffer address is 38h Control/Status address is 39h, TXRDY and RXRDY are for interrupted operation. D[..7] A ~IOR ~IOW Address Decoder ~38h ~39h 825 USART D[..7] C/~D ~RD ~WR ~CS TXRDY TXE ~TXC TXD RXD RXRDY ~RXC SY/BR ~ DSR ~DTR ~CTS ~RTS Clock serial data Clock Clock Generator modem handshaking 825 Clock Signals is system clock input TXC and RXC are transmit-receive clock inputs. There are three baudrate factors divide by, 6 and 64. Example. Find RXC oscillator frequency for 2 Baud operation with baudrate factor /64. Solution: f RXC =2*64 Hz = 76.8 khz. Example: What shall be the baudrate factor for 48 Baud operation if RXC is connected to 9.2 khz? Solution: 9.2kHz/4.8kHz = 4, /4 825 USART D[..7] C/~D ~RD ~WR ~CS TXRDY TXE ~TXC TXD RXD RXRDY ~RXC SY/BR ~ DSR ~DTR ~CTS ~RTS Dr.Mehmet Bodur, EMU-CMPE 5 Dr.Mehmet Bodur, EMU-CMPE 6

Section 7.4 825 Reset Sequence 825 reset sequence is write three successive zeros to control address to assure writing a reset to the command register. write command 4h to reset (reset chip) After the reset, 825 expects mode settings. write the mode settings to control address There after 825 needs command settings. write command for command settings. Now the device is ready for transmit and receive operations Dr.Mehmet Bodur, EMU-CMPE 7 Section 7.4 825 mode/control settings and status bits 825 USART Mode Register format for asynchronous mode: b7 b6 = { S2S: nr.of stop bits : invalid / :stop / :.5stop / : 2stop }, b5 = { EP: parity type : odd / : even }, b4 = { PEN: parity enable : no-parity-bits / : parity-bits-present }, b3 b2 = { L2L: nr.of data bits : 5-bit / : 6-bit / : 7-bit / : 8-bit }, b b = { B2B: baud rate factor : sync-mode / : / / : /6 / : /64 } Control Register format for asynchronous mode: b7 = { EH: Enter hunt mode to search sync char : enable / : disable } b6 = { IR: Internal reset : resets the 825A } b5 = { RTS: Request to send, : RTS-output-forced-to-low } b4 = { ER: Error Reset : reset error flags PE,OE,FE } b3 = { SBRK: Send break char : forces TxD low } b2 = { RxE: r enable : enable, : disable } b = { DTR: Data terminal ready : DTR-output-forced-to-low } b = { TxE: enable : enable, : disable } Status Register format for asynchronous mode: b7 = {DSR : DSR pin is active (low)} b6 = {SY/BD : sync-or-break char detected} b5 = {FE : Framing error occurs} b4 = {OE : Overrun error occurs} b3 = {PE : Parity error occurs} b2 = {TxE : Tx finished transmitting all data} b = {RxRDY : Data-in buffer is full} b = {TxRDY : Data-out buffer is empty} Dr.Mehmet Bodur, EMU-CMPE 8 Section 7.4 For the circuit with ports 38h, 39h enabling 825, write a code a) to initialize it for 2 baud when TXC connected to 9.2kHz, to transmit characters to a DCE with 8-bit data, no parity, one stop bit configuration. b) to read port 3h, and transmit the value in serial format 825 initialization Mode Register b7 b6 = { S2S: nr.of stop bits : inval./ :stop / :.5stop / : 2stop }, b5 = { EP: parity type : odd / : even }, b4 = { PEN: parity enable : no-parity-bits / : parity-bits-present }, b3 b2 ={ L2L: nr.of data bits : 5-bit / : 6-bit / : 7-bit / : 8-bit }, b b ={ B2B: baud rate factor : sync-mode / : / : 6 / : 64 } Control Register b7 = { EH: Enter hunt mode to search sync char : enable / : disable } b6 = { IR: Internal reset : resets the 825A } b5 = { RTS: Request to send, : RTS-output-forced-to-low } b4 = { ER: Error Reset : reset error flags PE,OE,FE } b3 = { SBRK: Send break char : forces TxD low } b2 = { RxE: r enable : enable, : disable } b = { DTR: Data terminal ready : DTR-output-forced-to-low } b = { TxE: enable : enable, : disable } Mode register shall be b = 4Eh Control register shall be b = 33h handshaking to modem is enabled. receiver is disabled. only transmitter enabled. Dr.Mehmet Bodur, EMU-CMPE 9 For the circuit with ports 38h, 39h enabling 825, write a code a) to initialize it for 2 baud when TXC connected to 9.2kHz, to transmit characters to a DCE with 8-bit data, no parity, one stop bit configuration. b) to read port 3h, and transmit the value in serial format Status Register format for asynchronous mode: b7 = {DSR : DSR pin is active (low)} b6 = {SY/BD : sync-or-break char detected} b5 = {FE : Framing error occurs} b4 = {OE : Overrun error occurs} b3 = {PE : Parity error occurs} b2 = {TxE : Tx finished transmitting all data} b = {RxRDY : Data-in buffer is full} b = {TxRDY : Data-out buffer is empty}.model small.code ; reset 825 mov dx,39h mov al, mov al,4h ; set mode mov al, 4Eh ; set command mov al, 33h 825 coding mainloop. ; read the port mov dx,3h in al,dx mov ah,al ; save it ; send the char, ; wait if buffer is full mov dx,39h wdataout: in al,dx ; status byte and al,h jz wdataout ; now send character mov al,ah mov dx,38h ; continue looping jmp mainloop end Dr.Mehmet Bodur, EMU-CMPE 2

Solve the following two Final Exam questions. Final Fall 6 Final Fall 7 Exercise Dr.Mehmet Bodur, EMU-CMPE 2