When I wrote the first edition of this book, the RS-232 serial port was the workhorse of PC interfaces. Modems and scores of other peripherals connected to PCs via the serial ports that were present on every machine. When the Universal Serial Bus (USB) took hold in the late 1990s, many predicted that serial ports would soon be obsolete. Plenty of peripherals that formerly used the serial port has switched to USB.
But some devices can’t use USB or have requirements that USB alone can’t provide. Many embedded systems use serial ports because they’re inexpensive and less complex to program compared to USB. Serial ports can use longer cables than USB allows. And the RS-485 serial interface supports networks suitable for many monitoring and control applications.
This book explores wide and varied territory, including hardware and software; ports in PCs and in embedded systems; and RS-232, RS-485, and wireless interfaces. You don’t need to read the book straight through. If you’re interested in a particular topic, you can skip right to it
The first chapters focus on hardware and interfacing. Chapters 1–2 are an introduction to asynchronous serial communications. Chapter 3 discusses serial ports in PCs, and chapters 4–8 are a guide to interfacing using RS-232, RS-485, and wireless technologies
The next chapters are a guide to programming. Chapters 9–10 show how to program serial ports on PCs using Visual Basic .NET and Visual C# .NET. Chapter 11 shows how to program serial ports for embedded systems with examples for microEngineering Labs’s PICBASIC PRO compiler and Microchip Technology’s MPLAB® C18 C compiler
What, S New In the Second Edition
Much has happened in the world of computing since the first edition of this book was released. For this second edition, I’ve revised and updated the contents from start to finish.
One addition is the example code in C/C# as well as Basic. This book includes code examples for PCs and for embedded systems (microcontrollers)
- Designing and programming USB virtual COM ports.
- Using wireless technologies to transmit serial data.
- Accessing serial ports over Ethernet or Wi-Fi networks.
- Transferring any kind of text data using Unicode encoding
Who Should Read This Book?
Whether your interest is hardware or software and whether you work with PCs, embedded systems, or both, you’ll find useful guidance in this book.
Programmers will learn how to communicate via serial ports, including USB virtual COM ports, in PCs and embedded systems. The example code for PCs and microcontrollers in Basic and C/C# provides a quick start for a variety of applications
Circuit designers will find designs for a variety of applications including converters that translate between RS-232, RS-485, and 3V/5V logic. Designs with fail-safe features, high noise immunity, and low power consumption are included.
Hobbyists and experimenters will find inspiration for projects.
Teachers and students can learn about serial ports and use the examples in this book to demonstrate concepts
This book assumes you have a basic knowledge of electronics and either Basic/Visual Basic or C/C# programming. I assume no previous knowledge or experience with serial-port hardware or programming.