
- 824 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
eBook - ePub
The Windows Serial Port Programming Handbook
About this book
The popularity of serial communications demands that additional serial port interfaces be developed to meet the expanding requirements of users. The Windows Serial Port Programming Handbook illustrates the principles and methods of developing various serial port interfaces using multiple languages. This comprehensive, hands-on, and practical guide
Frequently asked questions
Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Perlego offers two plans: Essential and Complete
- Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
- Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access The Windows Serial Port Programming Handbook by Ying Bai in PDF and/or ePUB format, as well as other popular books in Computer Science & Computer Engineering. We have over one million books available in our catalogue for you to explore.
Information
1
The Fundamentals of Serial Port Communications
1.1 INTRODUCTION
With the rapid development of modern communications and computer technologies, communication between individuals, between individuals and groups, and between individuals and society has become more and more important. Almost all communication devices used today are closely related to computer technologies; these tools include digital telephones, cell phones, pagers, mobile phones, the Internet and Internet services, image phones, server/client communications, and fiber communication. All these modern communication technologies play a vital role in our society today.
The different communication technologies applied in all fields can be divided into two categories:
- Wire communications
- Wireless communications
Wire communication can be further divided into two subcategories:
- Electronic wire communications
- Fiber wire communications
Electronic wire communications can be categorized into analog and digital communication technologies. Most modern communication technologies use digital data transfer. Generally, the electronic wire communications used in computer technologies are digital technologies, and they come in two styles:
- Parallel communications
- Serial communications
Parallel communications can exchange or translate data between two devices in a parallel style, which means that multiple bits of data (such as 8-bit, 16-bit, or 32-bit data) can be transferred between two pieces of equipment simultaneously. Obviously, in parallel communication, the two devices must be connected with multiple wires; the relationship between the connected wires and the data to be translated is one to one, which means that one data bit travels over one wire.
Serial communications, on the other hand, can exchange or translate data between two devices only in a bit-by-bit fashion, like a sequence, by using a single wire. It should be noted that serial communication needs fewer wires, so the hardware connections are simpler. Figure 1.1 shows diagrams of both parallel and serial communications.
It can be seen in Figure 1.1 that a parallel interface port (a) needs to use more wires, which makes the interface more complicated. To compensate, those wires provide a highspeed data translation because the data is processed simultaneously by all the wires. The serial interface port (b) uses only a single wire to translate all the data bit by bit, which means that at any moment, only one bit of data can be translated from device I to device II. Figure 1.1 illustrates the translation of a binary data byte (01100101) through both parallel and serial interface ports. Relatively speaking, a slower translation speed is expected in the serial communication style.

FIGURE 1.1 (a) Parallel and (b) serial data communications.
1.2 WHY SERIAL PORT COMMUNICATIONS ARE NECESSARY
Why are serial communications so important if the parallel interface port is available? To answer this question, an understanding of the following facts is required.
In the early days of computers, most data communications utilized parallel ports due to the slow running speed of the central processing unit (CPU). The typical CPU processing speed was between 10 and 200 MHz. The devices that used parallel port communications were hard disks, floppy disks, printers, scanners, and zip disk drives. The processing speed was the first priority for any slow computer. The disadvantages of using a parallel port interface included the complicated interface circuits, the high cost, and a limited data translation distance (less than 10 feet).
Since the twenty-first century, the running speed of CPUs has increased significantly. Today most normal computers can run at a speed of 1 or 2 GHz. Because running speed is no longer an obstacle, long-distance translation and low cost have become the main priorities in today’s data communications. Serial port communications can now handle much longer-distance data translation (over 4,000 feet) at very low cost. Also, the hardware used for serial port communications is much simpler than that used for parallel port communications.
Most operating systems provide the appropriate communication drivers for serial ports; therefore, users aren’t required to spend time developing (and learning to develop) serial port device drivers. Instead, they can spend time directly developing the user programs that talk to the serial ports to perform the data communications between computers, between servers and clients, and between the different devices that use serial ports.
For parallel port interfaces, it is a different story. Different parallel devices require that the associated device drivers be developed and installed, which is not an easy job even for experienced software developers. Some general-purpose parallel port interfaces are available, such as IEEE-488. If a user adopts such a general-purpose parallel port interface tool, he or she still needs to learn how to modify the equipment’s subroutine to match the requirements of the interface.
Based on these facts, more and more peripheral devices (such as printers, zip drives, and scanners) are being expected to communicate with computers via serial port interfaces. Today universal serial bus (USB) drivers are the tools used most often for connecting computers to printers, scanners, floppy drives, and even hard disks (for example, the Iomega__HDD 250GB USB2.0/FireWire External Desktop Hard Drive). You can even find different sizes of USB flash memory on the market to increase the memory size of your computer.
It can be expected that the serial port interface will play an increasingly important role in today’s computer technologies and communications. For this reason, it is important that developers understand the principles of serial communications so that they can develop sophisticated programs to support a variety of serial interfaces. Helping you achieve these dual goals is the objective of this book.
1.3 WHAT IS SERIAL PORT COMMUNICATION?
In the early 1960s, a standards committee, today known as the Electronic Industries Association (EIA), developed a common interface standard for data communications equipment. At that time, data communication was thought to mean a digital data exchange between a centrally located mainframe computer and a remote computer terminal, or possibly between two terminals without a computer involved. These devices were connected by telephone voice lines and consequently required a modem at each end for signal translation. Although simple in concept, the many opportunities for data errors that occurred when transmitting data through an analog channel required a relatively complex design. It was thought that a standard was needed first to ensure reliable communication, and second to enable the interconnection of equipment produced by different manufacturers, thereby fostering the benefits of mass production and competition. From these ideas, Recommended Standard Number 232, Revision C (RS232C) was born. It specified signal voltages, signal timing, signal function, protocols for information exchange, and mechanical connectors.
Over the more than 40 years since this standard was developed, the EIA published three modifications, the most recent being the EIA232E standard introduced in 1991. Beyond changing the standard’s name from RS232 to EIA232, some signal lines were renamed and various new ones were defined, including a shield conductor.
Serial communications can be divided into different groups based on their operation principles. The following sections describe the different serial port communication groups.
1.3.1 RS-232
As previously mentioned, RS-232 is a protocol developed and defined by EIA in the 1960s that was used in early serial data communications. Because of its simplicity and popularity, RS-232 has been widely applied in all data communication fields, including industrial, commercial, educational, and even consumer electronics. RS-232 belongs to the full-duplex communication protocol, which means that both senders and receivers can exchange information simultaneously. The half-duplex communication protocol allows users (senders and receivers) to send or receive information between one another only at different periods of time; they cannot send and receive simultaneously. This means that the receiver has to wait until the sender finishes sending information; then the receiver can pick up and respond to the sender’s information. At any moment, only one user, either sender or receiver, can control the transmission of data.
The simplest RS-232 protocol utilizes three wires: One wire is used to send information, one is used to receive information, and a third wire works as the ground or reference between the two devices. The information transmitted on RS-232 wires is represented as a sequence of binary bits, and the values of those binary bits are associated with two voltage levels: +12 volts (Space, or logical 1) and -12 volts (Mark, or logical 0). The data transmission speed is controlled by the baud rate, (the number of binary bits that can be transmitted per second), which can be indicated and set up by the user before the data transmission. In the early days, data transmission speed was relatively slow because of the slow CPU speeds, and typical baud rates were 1,200, 4,800, and 9,600. Baud rates applied in today’s serial data communication have increased significantly and are typically 19,200, 38,400, and even higher. In short, the RS-232 port is designed to communicate with local devices and will support one driver and one receiver.
The typical transmission distance of the RS-232 protocol is less than 50 feet. To increase this distance and reduce noise and disturbance, RS-422 was developed.
1.3.2 RS-422
RS-232 serial port communication is part of a single-ended protocol, meaning that the value of each binary bit has an absolute voltage level relative to the ground. This single-ended protocol has shortcomings when it comes to data transmission. One of the most important disadvantages is its inability to overcome or reduce noise and disturbances during the information transmission. Even when ±12 volts is utilized as its signal level, the RS-232 still may encounter big, sharp pulses or other disturbances during data transmission or receipt, increasing the possibility that mistakes will occur in the signal transmission and that information will be made invalid.
To solve this problem, another serial communication protocol, RS-422, has emerged. RS-422 uses a differential signal transmission mode, which means that at any time, a binary bit value has a relative voltage flowing from the positive signal terminal to the negative signal terminal. Unlike the transmission wires used with RS-232, the wires for both the sending and receiving lines are doubled, and these double wires are twisted together to work as a single line (either a sending or a receiving line) to further reduce environmental disturbances.
When communicating at high baud rates or over long distances in real-world environments, single-ended methods are often inadequate. A differential data transmission (or a balanced differential signal) offers superior performance in most applications. Differential signals can help nullify the effects of ground shifts and induced noise signals that can appear as common mode voltages during the communication of data.
RS-422 is designed for greater distances and higher baud rat...
Table of contents
- Cover Page
- Title Page
- Copyright Page
- About the Author
- Acknowledgments
- 1: The Fundamentals of Serial Port Communications
- 2: Serial Port Programming for MS-DOS in ANSI C and Assembly Languages
- 3: Serial Port Interfaces Developed in VC++ 6.0
- 4: Serial Port Programming in Visual BASIC
- 5: Serial Port Programming in LabVIEW
- 6: Serial Port Programming in MATLAB
- 7: Serial Port Programming in Smalltalk
- 8: Serial Port Programming in Java
- A: Appendix