Rs-232

Páginas: 8 (1926 palabras) Publicado: 21 de julio de 2012
Moxa Tech Note

The Secrets of Flow Control in Serial Communication
Casper Yang, Senior Product Manager support@moxa.com Although RS-232/422/485 serial communication is no longer considered to be “high speed,” flow control is still an important function for many applications. Most people know what flow control is, but do not know how it works or how it influences the behavior of acommunications system. In this paper, we describe flow control in detail, and give you the knowhow needed to fix certain types of communication problems. High/Low Water Level Whenever a buffer is used to store data as it is being transmitted, some type of flow control is required to prevent data overrun. Flow control is used in UART FIFOs, drivers, and OS kernels. To implement flow control, the engineer needsto configure both the receive buffer high water level (RBH) and receive buffer low water level (RBL). RBH prevents the receive buffer from overrunning by telling the transmitting side to stop sending data before the Rx buffer is full. For example, if the receive buffer can store 4 KB of data, then you might want to set the RBH value to 3 KB since data will continue to be sent until thetransmitting side receives the stop command. That is, incoming data will continue to arrive for a little while even after you say “stop.” RBL, on the other hand, defines when data transmission should be resumed. When in doubt, just set RBL to zero, since doing so will ensure that the buffer is completely empty before transmission resumes. However, setting RBL to zero is not very efficient since it couldintroduce an undesirably large time lag. Copyright © 2009 Moxa Inc. About Moxa
Moxa manufactures one of the world’s leading brands of device networking solutions. Products include serial boards, USB-to-serial hubs, media converters, device servers, embedded computers, Ethernet I/O servers, terminal servers, Modbus gateways, industrial switches, and Ethernet-to-fiber converters. Our products are keycomponents of many networking applications, including industrial automation, manufacturing, POS, and medical treatment facilities.

Released on Sep 30, 2009

How to Contact Moxa Tel: 1-714-528-6777 Fax: 1-714-528-6778

Web: www.moxa.com Email: info@moxa.com

This document was produced by the Moxa Technical Writing Center (TWC). Please send your comments or suggestions about this or otherMoxa documents to twc@moxa.com.

Moxa Tech Note

The Secrets of Flow Control

Data RBH RBH

Stop sending! Data Length is higher than the RBH. Turn RTS off or send XOFF.

Fig. 1: How the Receive Buffer’s RBH Value Controls Data Transmission

Data

RBL

RBL

Go! Data Length is less than the RBL. Turn RTS on or send XON.

Fig. 2: How the Receive Buffer’s RBL Value Controls DataTransmission

RTS/CTS vs. XON/XOFF Flow Control In serial communication, there are two types of flow control—hardware flow control and software flow control. Hardware flow control uses the RTS/CTS (or DTR/DSR) signals to communicate. When connecting a serial device to a computer, connect the CTS pins to the RTS pins (for DTR/DSR flow control, DSR connects to DTR). The transmitting side checks thestate of its CTS pin before transmitting, and then

Copyright © 2009 Moxa Inc.

Page 2 of 6

Moxa Tech Note

The Secrets of Flow Control

starts transmitting if it sees “CTS On,” and does not transmit (or stops transmitting) if it sees “CTS Off.” On the other hand, the receiving side uses RTS to say “go” or “stop.” Turning RTS from off to on indicates that the amount of data in the Rxbuffer is lower than the RBL, and turning it from on to off means the length is higher than the RBH.

RTS

RTS

CTS

CTS

Fig. 3: RTS/CTS Flow Control Cable Wiring

Software flow control uses the Tx and Rx signals to send XOFF and XON control characters. The receiving side sends an XOFF character over its Tx line (which is equivalent to turning RTS from on to off) to tell the...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Interfaz Serial Rs-232
  • Puertas Seriales RS 232
  • Protocolo Rs-232
  • comunicacio rs 232
  • interfaz RS-232
  • RS-232
  • Puerto serie (rs-232)
  • Fibra Obtica , Rs- 232

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS