Presentation is loading. Please wait.

Presentation is loading. Please wait.

USART Communication using the RS standard ETEC6416.

Similar presentations


Presentation on theme: "USART Communication using the RS standard ETEC6416."— Presentation transcript:

1 USART Communication using the RS standard ETEC6416

2 The RS232 standard Its origins predate modern computers and it contains many features that are not relevant to the modern user. It can control very old primitive modems and has many control signals to do this in hardware. It is often used without these older control and status lines. It is very common on Microcontrollers and used for communication with microcontroller peripheral devices

3 What is RS232 RS-232 is a popular communications interface for connecting modems and data acquisition devices (i.e. GPS receivers, electronic balances, data loggers,...) to computers. RS-232 can be plugged straight into the computer’s serial port (know as COM or Comm port). A microcontroller 0-5 TTL signal sent through a max 232 is converted to RS232

4 Line driver and receiver chips Typical line drivers/receivers chips for RS232 are the MAXIM MAX232 or MAX233 chips. (look these up at Http://www.maxim-ic.com) the original specification states that RS232 should drive 50 feet but modern line driver/receivers can manage much better than this. The maximum distance before errors occur is also a function of the type of cable used. Baud Rate | max distance | max distance shielded cable unshielded cable ----------------------------------------------------- 110 | 5000ft | 3000ft 300 | 5000ft| 3000ft 1200 | 3000ft | 3000ft 2400 | 1000ft | 500ft 4800 | 1000ft | 250ft 9600 | 250ft | 250ft The speed is quoted as the “BAUD” rate. Technically this is the number of signals per second. For simple transmissions this is the same as “Bits Per Second” or BPS. When RS232 is converted to audio whistles for transmission through the telephone this one to one relationship does not always hold. By using 4 different signals we can send 600 changes of signal per second ( 600 baud) but representing 2400 bits of information per second. This special coding suits the telephone system which has severe bandwidth limitations.

5 The transmission and reception of serial data The transmission and reception of serial data using the RS232 protocol can be undertaken in two ways; hardware and software. A special chip or special circuitry within a Microcontroller (USART) that uses a number of shift registers and holding latches/registers. Other circuitry can analyse the incoming character and detect errors such as parity, overrun and framing. Using software to control the implement the USART signal can be undertaken but most modern microcontrollers use a hardware implementation.

6 RS485/RS422 The main difference between RS 232 and RS 422 & 485 are The RS 232 signals are represented by voltage levels with respect to ground. There is a wire for each signal, together with the ground signal (reference for voltage levels). This interface is useful for point-to-point communication at slow speeds. For example, port COM1 in a PC can be used for a mouse, port COM2 for a modem, etc. This is an example of point-to-point communication: one port, one device. Due to the way the signals are connected, a common ground is required. This implies limited cable length - about 30 to 60 meters maximum. (Main problems are interference and resistance of the cable.) Shortly, RS 232 was designed for communication of local devices, and supports one transmitter and one receiver. RS 422 & 485 uses a different principle: Each signal uses one twisted pair (TP) line - two wires twisted around themselves. We're talking 'Balanced data transmission', or 'Differential voltage transmission'. If we label one of the TP wires 'A' and the other one 'B'. Then, the signal is inactive when the voltage at A is negative and the voltage at B is positive. Otherwise, the signal is active, A is positive and B is negative. Of course, the difference between the wires A and B matters. For RS 422 & 485 the cable can be up to 1200 meters (4000 feet) long, and commonly available circuits work at 2.5 MB/s transfer rate.

7 RS422/485 Implications for networking of the differences between 422 and 485 The Electrical principle is the same: both use differential transmitters with alternating voltages 0 and 5V. However, RS 422 is intended for point-to-point communications (but can be used in limited network applications). RS 422 is often used to extend a RS 232 line, or in industrial environments. RS 485 is used for multipoint communications: more devices may be connected to a single signal cable - similar to e.g. ETHERNET networks, which use coaxial cable. Most RS 485 systems use Master/Slave architecture, where each slave unit has its unique address and responds only to packets addressed to this unit. These packets are generated by Master, which periodically polls all connected slave units.

8 Differential signal The transmission of the RS422/485 signal is called differential, that are the result of the difference between the voltages of the two wires that make up the bus

9 RS485 Bus Polarity of the line According to the standard RS485 the line connections are indicated by: A also called - (minus) B also called B + (plus) GND All devices connected on the line must be connected in parallel

10 Twisted pair A typical network 485 may be wired using twisted pair wiring as shown It is very important that the wiring is done with twisted cable that provides maximum noise immunity. It is also possible use an unshielded cable, but this reduces network speed

11 Terminations,cable lengths, data transfer speed RS 422/485 line termination is essential, especially for faster data transfer rates and long cables. Main reasons for correct termination are reflections at the ends of the line, and the minimum transmitter load requirement. For RS 422, the termination is fairly simple (see picture comparing RS 422 and RS 485). A terminating resistor of 100Ohm is connected to the end of the line. If there are more RS 422 receivers connected to the line, the resistor can be a little bigger. The value can be calculated since the input impedance of the receivers is known. There are more sophisticated methods that will “bias” the line into a known state if ALL transmitters are disabled, this can be very important to avoid detection of false start bits. Also the power consumption of the terminators can be reduced, see the national semiconductor website for application notes ( www.natsemi.com)

12 Commonly available parts for RS 422/485. MAXIM; they make about ten versions - differences are in speed (0.25 or 2.5 Mbit/s), operation type (half/full duplex), number of devices (32, 128), and in several other parameters. They are labeled MAX481, 485, 487, 491 and so on. (www.maxim-ic.com) Another manufacturer is National Semiconductors, label DS3695A. I assume that every major manufacturer offers some circuits for RS 422/485 (www.natsemi.com) Some info in this article comes from excellent publication by Texas Instruments, who make a whole family of RS 422/485 circuits labelled SN 7517X, where X is one- or two-digit type specification. (www.ti.com) Also Linear Technology make 485 line drivers, receivers and transceivers. All of these manufacturers have good application notes that will help you design RS485 networks.

13 RS-485 Network RS-485 provides Half-Duplex, Multidrop communications over a single twisted pair cable. MASTER SLAVE-1 SLAVE-2 SLAVE-3 The standard specifies up to 32 drivers and 32 receivers can share a multidrop network Terminator resistors avoid reflected signal

14 RS-485 Half-duplex Half-Duplex configurations for Data Collecting and Master/Slave layouts. Usually we call this the Multidrop network Slave 1 TX ENABLE RX Slave 2 TX ENABLE RX Slave N TX ENABLE RX RTX485+ RTX485- 485GND Master TX ENABLE RX

15 Micro-controller connections for RS485 network Implementing RS485, one pin on each micro is used to control reading or writing R/W. All slaves have the R/W pin set to R while the master has the R/W pin set to W The master writes a signal to its usart with the R/W pin set to W. The master then sets the R/W pin to R Each slave receives the message The slave that responds set the R/W pin to W and writes a message to its USART.


Download ppt "USART Communication using the RS standard ETEC6416."

Similar presentations


Ads by Google