e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Serial Port Communication Module No: CS/ES/11 Quadrant 1 e-text

Similar documents
8051SERIAL PORT PROGRAMMING

Sender Receiver Sender

Serial Communication Prof. James L. Frankel Harvard University. Version of 2:30 PM 6-Oct-2015 Copyright 2015 James L. Frankel. All rights reserved.

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: 8051 Architecture Module No: CS/ES/5 Quadrant 1 e-text

Lecture-65 SERIAL DATA COMMMUNICATION The data bus of a microcomputer system is designed to transfer data to and from I/O device in parallel - all

Chapter 11: Input/Output Organisation. Lesson 05: Asynchronous RS232C Serial Port data transfer

MCS-51 Serial Port A T 8 9 C 5 2 1

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Serial Port Programming in Assembly Module No: CS/ES/12 Quadrant 1 e-text

ELEG3923 Microprocessor Ch.10 Serial Port Programming

Serial Interfaces Part 1. ECE 153B Sensor & Peripheral Interface Design Winter 2016

8051 Serial Communication

8051 Timers and Serial Port

Fig.12.5 Serial Data Line during Serial Communication

1. Pin diagram of 8051 and ports

8051 Serial Port. EE4380 Fall02 Class 10. Pari vallal Kannan. Center for Integrated Circuits and Systems University of Texas at Dallas

Serial communication

Serial Communications

e-pg Pathshala Subject: Computer Science Paper: Embedded System Module: Interfacing External Devices using Embedded C Module No: CS/ES/22

CoE3DJ4 Digital Systems Design. Chapter 5: Serial Port Operation

RS-232 DATA COMMUNICATIONS WITH THE TANDY COLOR COMPUTER

EECS 373 Design of Microprocessor-Based Systems

To be familiar with the USART (RS-232) protocol. To be familiar with one type of internal storage system in PIC (EEPROM).

EECS 373 Design of Microprocessor-Based Systems

UNIT-V COMMUNICATION INTERFACE

ECE251: Thursday November 8

Serial I-O for Dinesh K. Sharma Electrical Engineering Department I.I.T. Bombay Mumbai (version 14/10/07)

4.3 Digital Communication

Embedded Systems and Software. Serial Communication

SARDAR RAJA COLLEGES SARDAR RAJA COLLEGE OF ENGINEERING ALANGULAM

Embedded Systems and Software

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Introduction to Computing Module No: CS/ES/1 Quadrant 1 e-text

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Microcontrollers and Embedded Processors Module No: CS/ES/2 Quadrant 1 e-text

Parallel-to-Serial and Serial-to-Parallel Converters

ELE492 Embedded System Design

Input-Output Organization

Informatics for industrial applications

EECS 373 Design of Microprocessor-Based Systems

Course 10: Interfaces Agenda

Growing Together Globally Serial Communication Design In Embedded System

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

Basics of UART Communication

Amarjeet Singh. January 30, 2012

Asynchronous Transmission. Asynchronous Serial Communications & UARTS

Microcontrollers. Fig. 1 gives a comparison of a microprocessor system and a microcontroller system.

Serial Interfacing. Asynchronous Frame

Serial I/O. 4: Serial I/O. CET360 Microprocessor Engineering. J. Sumey

Microcontroller & Interfacing

UNIT 2-Data Communication Concept

Serial Communication. Spring, 2018 Prof. Jungkeun Park

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

Serial Communication. Simplex Half-Duplex Duplex

Chapter Four. Making Connections. Data Communications and Computer Networks: A Business User s Approach Seventh Edition

Hierarchy of I/O Control Devices

EASY219 / IEC CANopen Master / Slave

ENG-7680: SCADA Laboratory Experiments

Interfacing Techniques in Embedded Systems

Select a Data Communication Interface

Interrupt Programming: Interrupts vs. Polling Method:

Environmental Data Acquisition Using (ENC28J60)

GSM Based Electronics Notice Board

chapter 3: PC based ECG acquisition system

(renamed the "EIA232 Standard" in the early 1990 s)

Advanced Electronic Communications Systems Wayne Tomasi Sixth Edition

Advantages and disadvantages

Embedded Systems Lab Lab 1 Introduction to Microcontrollers Eng. Dalia A. Awad

TRAINING GUIDE LEVEL 3 MODBUS WRITE IMPORT COMMAND

PD215 Mechatronics. Week 3/4 Interfacing Hardware and Communication Systems

Parallel Data Transfer. Suppose you need to transfer data from one HCS12 to another. How can you do this?

3 PHASE FAULT ANALYSIS WITH AUTO RESET FOR TEMPORARY FAULT AND TRIP FOR PREMANENT

AC : INFRARED COMMUNICATIONS FOR CONTROLLING A ROBOT

Lecture 25 March 23, 2012 Introduction to Serial Communications

USART. USART stands for Universal Synchronous Asynchronous Receiver Transmitter. Full-duplex NRZ asynchronous serial data transmission

Real-Time Embedded Systems. CpE-450 Spring 06

SCB-C08 USB to RS232/422/485 Converter

Integrity Instruments Application Notes. Release 1

Data Communications & Computer Networks. Digital Data Communications Techniques

EET203 MICROCONTROLLER SYSTEMS DESIGN Serial Port Interfacing

Data Communication/MIDI. Juan P Bello

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI UNIT IV I/O INTERFACING PART A (2 Marks)

Maxim > Design Support > Technical Documents > Application Notes > Microcontrollers > APP 4465

Serial Communication. Simplex Half-Duplex Duplex

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

8051 Microcontroller

Introduction the Serial Communications Parallel Communications Parallel Communications with Handshaking Serial Communications

1. LCD (Liquid Crystal Display)interface

Chapter C2051 Architecture and Serial Communication Link

Experiment# 8: Photo-Interrupter Control

Serial Interfacing. Pulse width of 1 bit

EEM336 Microprocessors I. I/O Interface

POWER THEFT DETECTION USING WIRELESS SYSTEM: A DISTRIBUTED APPROACH FOR POWER THEFT PREVENTION

or between microcontrollers)

PPP. Point-to-Point Protocol

Features: Analog to Digital: 12 bit resolution TTL outputs, RS-232 tolerant inputs 4.096V reference (1mV/count) 115K max speed

Microcontroller basics

Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso

Microcontroller Based Data Acquisition System

DEV-1 HamStack Development Board

Learn how to communicate

Serial Communications

Infineon C167CR microcontroller, 256 kb external. RAM and 256 kb external (Flash) EEPROM. - Small single-board computer (SBC) with an

Transcription:

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Serial Port Communication Module No: CS/ES/11 Quadrant 1 e-text In this lecture, serial port communication will be discussed in detail. Serial and parallel communication will be compared and contrasted, and RS232 standard will be discussed. 1. Introduction Data transfer is the physical transfer of data, over a point-to-point or point-to-multipoint communication channel. While analog transmission is the transfer of a continuously varying analog signal over an analog channel, digital communications is the transfer of discrete messages over a digital or an analog channel. Data transmitted may be digital messages originating from a data source, for example a computer or a keyboard. It may also be an analog signal such as a phone call or a video signal, digitized into a bit-stream for example using pulse-code modulation (PCM) or more advanced source coding schemes. Data is transferred by computer in two ways: Parallel - 8 or more lines are used to transfer data to a device that is only a short distance. Serial - If data is to be transferred for long distance, serial communication is used. The data is sent one bit at a time. Figure 1.1 Types of Data Transfer

1.1 Parallel communication In parallel transmission, multiple bits are sent simultaneously on different channels within the same cable, or radio path, and synchronized to a clock. Parallel devices have a wider data bus than serial devices and can therefore transfer data in words of one or more bytes at a time. As a result, there is a speedup in parallel transmission bit rate over serial transmission bit rate. However, this speedup is a tradeoff versus cost since multiple wires cost more than a single wire, and as a parallel cable gets longer, the synchronization timing between multiple channels becomes more sensitive with distance. The timing for parallel transmission is provided by a constant clocking signal sent over a separate wire within the parallel cable; thus parallel transmission is considered synchronous. 1.2 Serial communication Serial communication is a common method of transmitting data between a computer and a peripheral device such as a programmable instrument or even another computer. Serial communication transmits data one bit at a time, sequentially, over a single communication line to a receiver. It is also a most popular communication protocol that is used by many devices for instrumentation; numerous General Purpose Interface Bus(GPIB) devices also come with an RS- 232 based port. This method is used when data transfer rates are very low or the data must be transferred over long distances and also where the cost of cable and synchronization difficulties makes parallel communication impractical. Serial communication is popular because most computers have one or more serial ports, so no extra hardware is needed other than a cable to connect the instrument to the computer or two computers together. Transmitter converts the byte of data into serial bits using parallel-in-serial-out shift register. Receiver has a serial-in-parallel-out shift register to receive the serial data and pack them into a byte. For Short distance, the digital signal can be transferred on a simple wire without modulation. To transfer data on the telephone line, it must be converted from 0s and 1s to audio tones. The device which performs 0s and 1s to audio tones is called a modem, Modulator/Demodulator. Serial communication has two techniques: 1. Synchronous- transfer block of data(characters) at a time 2. Asynchronous- transfer single byte at a time The following communications are done by hardware: a) USART (universal synchronous-asynchronous Receiver-transmitter) b) UART (universal asynchronous Receiver transmitter) c) 8051 chip has a built-in UART

Serial data can be transmitted in three ways: Simplex-It is a communication channel that sends information in one direction only (Fig. 2(a)). Figure 2.(a) Simplex Half duplex : Half-duplex data transmission means that data can be transmitted in both directions on a signal carrier, but not at the same time which is shown in Figure 2(b). Figure 2(b) Half duplex Duplex : Full-duplex data transmission means that data can be transmitted in both directions on a signal carrier at the same time as shown in figure 2(c). 1.2.1 Synchronous communication Figure 2(c) Duplex Synchronous communication requires that the clocks in the transmitting and receiving devices are synchronized running at the same rate so the receiver can sample the signal at the same time intervals used by the transmitter. No start or stop bits are required. In synchronous transmission, the stream of data to be transferred is encoded and sent on one line, and a periodic pulse of voltage which is often called the "clock" or "strobe" is put on another line that tells the receiver about the beginning and the ending of each bit (or byte). In general, such

synchronous transmission protocols are used for all the types of parallel communications. Figure.3 shows synchronous communication (data 61H) signal along with clock signal. In this the MSB bit first sent and LSB at end. Synchronization can also be embedded into a signal on a single wire. In differential Manchester encoding, used in video-tape systems, each transition from a low to high or high to low represents a logical zero. A logical one is indicated when there are two transitions in the same time frame, i.e, one clock cycle. 1.2.2 Asynchronous communication Figure 3. Synchronous Communication Asynchronous communication is used for character-oriented transmissions. Each character is placed in between start and stop bits, this is called framing. start bit is always one bit stop bit can be one or two bits start bit is always a 0 (low) stop bit(s) is 1 (high) LSB is sent out first

Figure 4. ASynchronous Communication 1.2.3 RS232 standards: RS-232 standard is related to serial data communication between host systems, commonly known as Data Terminal Equipment, or DTE and a peripheral system termed, Data communication Equipment (also known as Data Circuit-Terminating Equipment) or DCE. To be more specific, the device that connects to the RS-232 interface is called a Data Communications Equipment (DCE) and the device to which it connects (e.g., the computer) is called a Data Terminal Equipment (DTE). It was first introduced by the Electronics Industry Alliance (EIA) in the early 1960s and is commonly known as RS-232 (Recommended Standard 232). EIA-232 or RS-232 or RS-232 C is a complete serial communication protocol, which specifies signal voltages, signal timing, signal function, pin wiring, and the mechanical connections (i.e.: either 25-pin DB-25 or 9-pin DB-9). In 1987, the EIA released a new version of the standard and changed the name to EIA- 232-D. And in 1991, the EIA teamed up with Telecommunications Industry association (TIA) and issued a new version of the standard called EIA/TIA-232-E. Many people, however, still refer to the standard name as RS-232C, or just RS-232. It is most widely used serial I/O interfacing standard for serial communication. Input and output voltage levels are not TTL compatible. 1 bit

is represented by -3 to -25 V and 0 bit is +3 to +25 V and -3 to +3 is undefined. To connect RS232 to a microcontroller system, we must use voltage converters such as MAX232 to convert the TTL logic levels to the RS232 voltage levels, and vice versa. MAX232 IC chips are commonly referred to as line drivers. IBM introduced the DB-9 version of the serial I/O standard. Figure 5. Serial I/O standard The data communication can be achieved through DTE and DCE. 1. DTE (data terminal equipment) refers to terminal and computers that send and receive data 2. DCE (data communication equipment) refers to communication equipment, such as modems 3. Simplest connection between a PC and microcontroller requires a minimum of three pins, TxD, RxD, and ground

Figure 6. Null Modem Connection The terms DTE and DCE are very common in the data communications technologies. DTE is short for Data Terminal Equipment and DCE stands for Data Communications Equipment. But what do they really mean? As the full DTE name indicates, this is a piece of device that ends a communication line, whereas the DCE provides a path for communication. 1.2.4 8051 connection to RS232 8051 has two pins namely RXD and TXD pins which are used for transferring and receiving data serially. TxD and RxD are part of the port 3 group (P3.0 and P3.1).Pin 11 (P3.1) of 8051 is assigned to TxD. Pin 10 (P3.0) of 8051 is designated as RxD. These pins are TTL compatible. It requires a line driver to make them RS232 compatible. The driver used for this is the MAX232 chip. MAX232 converts from RS232 voltage levels to TTL voltage levels that are acceptable to 8051.It uses a +5 V power source, same as the source voltage of 8051.No dual power supplies are needed. MAX232 has two sets of line drivers for transferring and receiving data. Line drivers used for TxD are called T1 and T2.

Inside MAX232 Connection to the 8051 (Null Modem) Figure 7. 8051 connection to RS-232 Line drivers used for RxD are designated as R1 and R2. T1 and R1 are used together for TxD and RxD of the 8051. Second set is left unused. It requires four capacitors ranging from 1 to 22µF. MAX233 is used to save board space. It performs the same job as the MAX232.It eliminates the need for capacitors. It is much more expensive than the MAX232. Null modem can also be used for interfacing 8051 with outside devices. Connection is very simple compared to other modems. In Null modem we have DCE, DTE and ground pins is there. DTE of 8051 connected to DCE of Null modem. DCE of 8051 should be connected to DTE of Null modem. Ground pin of both should connected. Inside MAX233 Connection to the 8051 (Null Modem) Figure 7. 8051 connection to RS-232

1.2.5 Serial communication register SBUF is a 8-bit register used for serial communication. To transmit a byte of data via the TxD line, it must be placed in the SBUF register. When a byte is written into SBUF, it is framed with the start and stop bits and transferred serially via the TxD line. SBUF holds the byte of data when it is received by 8051 RxD line. When the bits are received serially via RxD, the 8051 deframes it by removing the stop and start bits, making a byte out of the data received, and then placing it in SBUF. Baud rate in 8051 is programmable. It is done with the help of Timer1 and different oscillators. The baud rate of 8051 system should be matched with the baud rate of the system to be interfaced. Figure 8. SCON register Figure.8 shows the SCON register structure. In this SMO and SM1 bits combined to specify the serial mode. Usually mode 2 is prefered because the UART in 8051 supports this mode. REN bit is used to enable the receiving the serial data. So this bit has to be set to enable serial communication.

Figure 8. SCON register(contd) 2. Summary In this lecture basic of serial communication is discussed. The Serial communication concepts with 8051 and RS232 I/O interface standard are discussed. 3. References 1. The 8051 Microcontroller and Embedded Systems Using Assembly and C Second Edition Muhammad Ali Mazidi, Janice Gillispie Mazidi and Rolin D.McKinlay.