<<Prev

Next>>

1. Introduction

The PICBASIC PRO™ Compiler (or PBP) is our next-generation programming language that makes it even quicker and easier 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.

The PICBASIC PRO™ Compiler is ABASIC Stamp II like@ and has most of the libraries and functions of both the BASIC Stamp I and II. Being a true compiler, programs execute much faster and may be longer than their Stamp equivalents.

PBP is not quite as compatible with the BASIC Stamps as our original PicBasic Compiler is with the BS1. Decisions were made that we hope improve the language overall. One of these was to add a real IF..THEN..ELSE..ENDIF instead of the IF..THEN(GOTO) of the Stamps. These differences are spelled out later in this manual.

PBP defaults to create files that run on a PIC16F84-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 16F84, as well as oscillators of frequencies other than 4MHz, may be used with the PICBASIC PRO™ Compiler.

1.1. The PICmicros

The PICBASIC PRO™ Compiler produces code that may be programmed into a wide variety of PICmicro microcontrollers having from 8 to 84 pins and various on-chip features including A/D converters, hardware timers and serial ports.

The current version of the PICBASIC PRO™ Compiler supports all the Microchip Technology PICmicro MCUs, including the 12-bit core, 14-bit core and both 16-bit core series, the 17Cxxx and 18Cxxx devices, as well as the Micromint PicStics. Limited support has been added for PICmicro MCUs based on the original 12-bit core. Support is limited as the 12-bit core PICmicro MCUs have a limited set of resources including a smaller stack and smaller code page size. See the READ.ME file for the very latest PICmicro MCU support list.

For general purpose PICmicro MCU development using the PICBASIC PRO™ Compiler, the PIC16F628, 16F84, 16F876 and 16F877 are the current PICmicro MCUs of choice. These microcontrollers use flash technology to allow rapid erasing and reprogramming to speed program debugging. With the click of the mouse in the programming software, the flash PICmicro MCU can be instantly erased and then reprogrammed again and again. Other PICmicro MCUs in the 12C5xx, 12C67x, 14C000, 16C4xx, 16C5x, 16C55x, 16C6xx, 16C7xx, 16C9xx, 17Cxxx and 18Cxxx series are either one-time programmable (OTP) or have a quartz window in the top (JW) to allow erasure by exposure to ultraviolet light for several minutes.

The PIC16F628, 16F84 and 16F87x devices also contain between 64 and 256 bytes of non-volatile data memory that can be used to store program data and other parameters even when the power is turned off. This data area can be accessed simply by using the PICBASIC PRO™ Compiler=s READ and WRITE commands. (Program code is always permanently stored in the PICmicro=s code space whether the power is on or off.)

By using a flash PICmicro for initial program testing, the debugging process may be sped along. Once the main routines of a program are operating satisfactorily, a PICmicro with more capabilities or expanded features of the compiler may be utilized.

While many PICmicro features will be discussed in this manual, for full PICmicro information it is necessary to obtain the appropriate PICmicro data sheets or the CD-ROM from Microchip Technology. Refer to Appendix F for contact information.

1.2. About This Manual

This manual cannot be a full treatise on the BASIC language. It describes the PICBASIC PRO™ 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 PRO™ 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 PRO™ 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 - the inner workings of the compiler.

1.3. Sample Programs

Example programs to help get you started can be found in the SAMPLES subdirectory. Additional example programs can be found in the sample programs section of the microEngineering Labs, Inc. web site.

<<Prev

Next>>