<<Previous

Next>>

1. Introduction

The PICBASIC™ Compiler (or PBC) makes it quick and easy for you to program Microchip Technology's powerful PICmicro microcontrollers. The English-like BASIC language is much easier to read and write than the quirky Microchip assembly language.

PBC also allows programs written for the original BASIC Stamp I to be compiled for direct execution on members of the PIC16Cxxx family of microcontrollers. Why would you want to do this?

Speed

Since PBC programs execute directly from the code space of the PICmicro rather than being fetched from a serial EEPROM, PBC programs execute much faster than equivalent programs on a BASIC Stamp. In fact, some instructions execute hundreds of times faster!

Cost

Why pay $34 per project or, worse yet, per product? PBC allows programs to be compiled directly into PICmicros costing $3 to $10. With this kind of savings, the investment in the PICBASIC™ Compiler and a PICmicro programmer could easily pay for itself after only a few projects. Better yet, this lower cost could turn what was just a good idea into a viable and competitive product.

Program Size

There is no fixed limit on the number of statements a program can have. Maximum program length is dependent upon how many different instructions are used (i.e. the number of different library routines that must be loaded) and the code space available in the particular PICmicro MCU.

PICmicro Hardware

PBC defaults to create files that run on a PIC16C84-04/P clocked at 4MHz. Only a minimum of other parts are necessary: 2 22pf capacitors for the 4MHz crystal, a 4.7K pull-up resistor tied to the /MCLR pin and a suitable 5- volt power supply.

Many PICmicros other than the 16C84 may be used with the PICBASIC™ Compiler. However, the PICBASIC™ Compiler will not work with the older 16C5x series PICmicros. The 16C5x only provides a two level stack. The PICBASIC™ Compiler requires the 8 level stack provided by the newer PICmicros.

1.1. About This Manual

This manual cannot be a full treatise on the BASIC language. It describes the PICBASIC™ Compiler instruction set and provides examples on how to use it. If you are not familiar with BASIC programming, you should acquire a book on the topic. Or just jump right in. BASIC is designed as an easy-to-use language and there are additional example programs on the disk and web site that can help get you started.

The next section of this manual covers installing the PICBASIC™ Compiler and writing your first program. Following is a section that describes different options for compiling programs.

Programming basics are covered next, followed by a reference section listing each PICBASIC™ command in detail. The reference section shows each command prototype, a description of the command and some examples. Curly brackets, {}, indicate optional parameters.

The remainder of the manual provides information for advanced programmers - all the inner workings of the compiler.

<<Previous

Next>>