Home > Serial Port Complete > Contents
Serial Port Complete Second Edition
Contents
Introduction
Acknowledgments
1 Options and Choices
When to use a Serial Port
Advantages
LimitsSystem Components
The Computers
The Physical Link
ProgrammingApplications
Example Systems
Managing Communications
Special-purpose Modules2 Formats and Protocols
Sending Serial Data
Asynchronous and Synchronous Communications
Word Formats
Bit Rate and Baud Rate
System Support for Low-level ProtocolsSending Bits
The Format
The Need for Accurate Timing
Autodetecting the Bit Rate
Autodetecting a COM PortData Formats
Binary Data
Text Data
ASCII Hex
Application-specific ProtocolsPreventing Missed Data
Flow Control
Buffers
Event-driven Programming and Polling
Acknowledgments
Error Checking3 COM Ports on PCs
Port Architecture
Device Manager
Port Resources
Serial ServersAccessing Ports
Drivers
Identifying Ports
GUIDs for COM Ports
COM Port Numbering
INF Files
Options for Application Programming4 Inside RS-232
The Hardware Interface
Signals
Voltages
Timing LimitsConverting Voltages
Interface Chips
Short-range CircuitsPort-powered Circuits
Using Outputs as a Power Source
Regulating the VoltageAlternate Interfaces
Direct Connection
Other Unbalanced Interfaces5 Designing RS-232 Links
Connectors and Adapters
Connector Options
Adapters
Using Microcontroller Development BoardsCables
Length Limits
Surge ProtectionIsolated Lines
Ways to Achieve Isolation
About Grounds
Power Supply Grounds
OptoisolatingDebugging Tools
Using a Breakout Box
Monitoring with a Voltmeter
Oscilloscopes and Logic Analyzers6 Inside RS-485
About RS-485
Balanced and Unbalanced Lines
Voltage Requirements
Current and Power
Speed
Internal Protection CircuitsInterfacing Options
Chips
Adding a Port on a PC
Converting 3.3/5V Logic
Converting RS-232Controlling the Driver Enable
Re-enabling the Driver
Software-assisted Control
Hardware Control7 Designing RS-485 Links and Networks
Long and Short Lines
When Is a Line Long?
Calculating Line Length
Choosing a Driver ChipLine Terminations
Characteristic Impedance
Adding a Termination
Effects of Terminations
Reflections
Series Terminations
Terminations for Short Lines
AC Terminations
Network TopologiesBiasing the Line
Open-circuit Protection
Short-circuit ProtectionCable Types
How a Wire Picks Up Noise
Twisted-pair Cable
Selecting CableGrounds and Differential Lines
Ensuring a Common Ground
Isolated LinesUsing Multiple Buses
Adding a Repeater
Implementing a Star Topology8 Going Wireless
Media and Modulation
Using a Carrier Frequency
Spread Spectrum Technology
Ensuring Reliable TransfersInfrared
Transmitters and Receivers
IrDARadio Frequency
Complying with Regulations
Choosing an RF Band
Implementing a Link
Using Other RF Standards9 Using .NETs SerialPort Class
Gaining Access to a Port
Finding Ports
Opening a Port
Timeouts
Receive Threshold
Closing a PortTransferring Data
Transferring Bytes
Transferring TextUsing Stream Objects
BinaryReader and BinaryWriter
StreamReader and StreamWriterSaving a Port and Parameters
The Application Settings Architecture
Combo Box Example10 Managing Ports and Transfers in .NET
Receiving Data
Setting Timeouts
Detecting Received Data
Collecting Received Data
Ensuring Efficient TransfersSending Data
Avoiding Timeouts
Sending without Blocking the Application
Preventing Buffer Overflows
Ensuring Efficient TransfersFlow Control
Selecting a Method
Monitoring and Controlling the SignalsHandling Errors
Exceptions
The ErrorReceived Event
Verifying Received DataStructuring an Application
Defining a ComPorts Class
Setting Parameters with Combo Boxes
Defining Application-specific Events11 Ports for Embedded Systems
A Microcontroller Serial Port
About the PIC18F4520
The Enhanced UARTRegisters
Configuring and Accessing the Port
Setting the Bit Rate
Interrupts
Basic OperationsAccessing a Port
Configuring the Port
Sending Data
Receiving Data
Using Interrupts
Using Flow ControlAdding Ports
Multiple On-chip UARTs
Firmware UARTs
External UARTs12 Network Programming
Managing Traffic
Steps in Exchanging a Message
Protocols
Using Existing Protocols
Debugging TipsAddressing
Assigning Addresses
Detecting Addresses
Reserving Address Values
Defining a Message Format
9-bit Format13 An RS-485 Network
Connecting the Nodes
Transceivers
Terminating and Biasing
CablingExample Protocol
Addresses
Message FormatCommands
Reading a Byte
Writing a BytePolling the Nodes
Configuring the Driver-enable Line
Sending CommandsResponding to Polls
Auxiliary Routines
Decoding Received Data14 Inside USB
Hosts and Devices
Assigning a Driver on the Host
Requirements
Host Responsibilities
Device Responsibilities
Speed
EndpointsUSB Transfers
Transfer Types
Transactions
The Data Toggle15 Using Special-function USB Controllers
Inside the Chips
Serial Interface (FT232R)
Parallel Interface (FT245R)
Prototyping ModulesUsing the Controllers
Drivers
Adding Vendor-specific Data
Implementing a Virtual COM Port
Converting from RS-232 to USB16 Using Generic USB Controllers
The Communication Devices Class
Documentation
Overview
Device Controllers
Host DriversUsing the Abstract Control Model
POTS Models
Virtual COM Ports
Requests
Notifications
Maximizing PerformanceDescriptors and INF Files
Device Descriptor
Configuration Descriptor
Communication Class Interface Descriptors
Data Class Interface Descriptors
String Descriptors
The INF File
Composite DevicesIndex