Programming the PIC Microcontroller with MBasic

Chapter 9: RS-232 Serial Interface

Overview

The computer science dictionary defines "serial" as "of or relating to the sequential transmission of all the bits of a byte over one wire." As we'll see, there are many serial protocols, such as I 2C (Chapter 18), SPI (Chapter 21), one-wire (Chapter 12) and the infrared remote control protocol REC-80 (Chapter 22). In this chapter, we'll look at an older serial protocol, RS-232, and learn to use MBasic's serin, serOut, HSerin and HserOut procedures. Along the way, we'll document some undocumented features of MBasic and write an interactive menu program.

It's not correct to refer to the entire bundle of interaction and data exchange we'll explore in this chapter as "RS-232." The details are well beyond the scope of this book, but the open systems interconnection (OSI) reference model defines a seven-layer model of network and computer communications. In the OSI model, RS-232 applies to the lowest, or "physical," layer, where it defines voltage and signal levels, pin wiring, connector standardization and flow control. But nothing in the RS-232 specification says that we must transmit and receive 8-bit bytes over an RS-232 connection, or that we should use the ASCII code to represent text, or that we must one of the widely recognized standard data speeds. We could, for example, use a 1930's Model 15 Teletype machine to send five-bit Baudot code at 45.45 bits/sec over an RS-232 connection and, as long as we follow the pin and connector wiring and voltage standards, we would...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Serial Communications Products
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.