Programming the PIC Microcontroller with MBasic

A great deal of your work with PICs will involve turning things on and off. The action may be as simple as illuminating an LED to show program status, or as complex as sequencing multiple motors. You may accomplish these actions with the PIC's input/output pins, unaided, or with external electronic or electromechanical devices. The action may require "sourcing" or "sinking" current or voltage. A high state pin sources current into an external load, while a low state output pin receives or sinks current from an external load. In this chapter, we will review a few elementary electronics principles and learn how to use them to allow PICs to control external devices.
This chapter deals with the electronic characteristics of PIC pins as output devices.
Diagrams and discussions in this book assume positive or classical current flow, in which current flow from positive to negative, as shown in Figure 3-1. Traditional circuit equations, as well as the arrow symbol for diodes and transistors follow this convention as well.
Before building any of the sample circuits please download and read the relevant data sheets from the device manufacturer's Internet website. (The CD-ROM supplied with this book also contains some datasheets.) To keep this chapter at a manageable length, I've had to gloss over many subtleties in the specifications and application of these devices, hitting only the highlights. Careful advance study of data sheets and any associated application notes will reduce the time...