Serial Programming/Preface

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Serial Programming: Introduction and OSI Network Model -- RS-232 Wiring and Connections -- Typical RS232 Hardware Configuration -- 8250 UART -- DOS -- MAX232 Driver/Receiver Family -- TAPI Communications In Windows -- Linux and Unix -- Java -- Hayes-compatible Modems and AT Commands -- Universal Serial Bus (USB) -- Forming Data Packets -- Error Correction Methods -- Two Way Communication -- Packet Recovery Methods -- Serial Data Networks -- Practical Application Development -- IP Over Serial Connections

Intended Audience[edit | edit source]

This series of articles is intended for people who are interested in diving into the "guts" of serial data communications systems. This material is rarely taught in university courses, and it can be tough to learn "on the job".

As with any software development, the individual topics are simple, but tying them all together can be very complex. This text takes a layered approach to the subject, in order to avoid overwhelming the novice. The first chapter deals with the bare copper wires and how they are handled. Subsequent chapters will add layers of protocol.

Typical serial communication can happen at just about any level. Some applications pull "raw" data right off the wires while others use full packet networks on multiple computers. For more, see "Why Serial Programming?" in the introduction.

Prerequisites[edit | edit source]

Serial programming cannot be done without knowing how to program and without knowing how to access the system. This book assumes that you are able to write software in at least one computer programming language. Knowing how to use at least one software tool that supports low-level operating system access will also help.

This series is written toward the x86 platform of CPUs, but much of this information can be applied to other environments including custom embedded systems or other CPU systems. Details of I/O control will have to be garnered from the respective CPU architectures if you proceed in that manner with alternate CPU systems. If possible, please add to these articles if you are knowledgeable about this subject, particularly if you are familiar with some of these alternate software systems or CPU architectures.

If you haven't been scared off so far, keep in mind that this book is written for a relative novice in computers. Writing low-level software/driver routines can be intimidating. Even if you are working from an API library, this sort of software development can be a very different experience from a typical "Hello World" application. While you may be able to write "Hello World" with a dozen lines or less in most software languages, transmitting "Hello World" across a serial connection can take quite a bit of code and reading up on all of the software settings and where they should be at. Concrete examples will be given and at the same time the "why" will be explained as well as the "how".

In addition to compiler tools, having access to a good terminal emulator application would also be very useful. On multi-tasking systems like Windows or Linux, this can be run as a separate task from the application that you are developing. In cases like this it is helpful if your computer has at least two serial data communication ports, and that you have access to a "null-modem" cable, at least to start with. There are some software tricks to avoid this requirement, but it is much more satisfying if you can see actual communication occurring. Having access to a second computer drives the idea home even more, especially when data file transfer is covered. RS-232 Connections describes a few more pieces of hardware (e.g. a breakout box or a protocol analyzer), both simple and advanced versions, which are useful when doing serial programming.

A Note on Terminology[edit | edit source]

The term 'RS-232' is used in a relaxed sense in this book, as it has become common in computing, and not in the strict sense of some RS-232 standard. The actual RS-232 standard is known under many different names, and in many different versions. Depending on the version, the standard does not even define all aspects which are commonly associated with 'RS-232' communication (e.g. start/stop bit framing).

Readers who need the precision of a standard are referred to one or more of the RS-232 standards. Readers who are interested in the practical programming of RS-232-like interfaces and devices should find useful information in this book.