Example: stock market

PICBASIC PRO™ Compiler - melabs.com Home Page

PICBASIC PRO CompilerCOPYRIGHT NOTICEC opyright 2008 microEngineering Labs, rights manual describes the use and operation of the PICBASIC PRO Compiler from microEngineering Labs, Inc. Use of the PICBASIC PROC ompiler without first obtaining a license is a violation of law. To obtain alicense, along with the latest version of the product and documentation,contact microEngineering Labs, and redistribution of this manual over the Internet or in anyother medium without prior written consent is expressly forbidden. In allcases this copyright notice must remain intact and Labs, 60039 Colorado Springs CO 80960-0039(719) 520-5323(719) 520-1867 faxemail: Stamp is a trademark of Parallax, , PICBASIC PRO, PICPROTO and EPIC are trademarks ofMicrochip Technology Inc. in the and other is a registered trademarks of Microchip Technology Inc. in the other PRO CompilermicroEngineering Labs, PRO CompileriTABLE OF CONTENTS1.

PICBASIC PRO Compiler 1 1. Introduction The PICBASIC PRO™ Compiler (or PBP) makes it even quicker and easier for you to program Microchip Technology’s powerful PIC®

Tags:

  Compiler, Picbasic

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of PICBASIC PRO™ Compiler - melabs.com Home Page

1 PICBASIC PRO CompilerCOPYRIGHT NOTICEC opyright 2008 microEngineering Labs, rights manual describes the use and operation of the PICBASIC PRO Compiler from microEngineering Labs, Inc. Use of the PICBASIC PROC ompiler without first obtaining a license is a violation of law. To obtain alicense, along with the latest version of the product and documentation,contact microEngineering Labs, and redistribution of this manual over the Internet or in anyother medium without prior written consent is expressly forbidden. In allcases this copyright notice must remain intact and Labs, 60039 Colorado Springs CO 80960-0039(719) 520-5323(719) 520-1867 faxemail: Stamp is a trademark of Parallax, , PICBASIC PRO, PICPROTO and EPIC are trademarks ofMicrochip Technology Inc. in the and other is a registered trademarks of Microchip Technology Inc. in the other PRO CompilermicroEngineering Labs, PRO CompileriTABLE OF CONTENTS1.

2 Introduction .. The PIC MCUs .. About This Manual .. Sample Programs .. 32. Getting Started .. Software Installation .. Your First Program .. Program That MCU .. It s Alive .. I ve Got Troubles .. PIC MCU Specific Issues .. PICBASIC and BASIC Stamp Compatiblity .. Code Crosses Page Boundary Messages .. Out of Memory Errors .. Coding Style .. Comments .. Pin and Variable Names .. Labels .. GOTO .. 153. Command Line Options .. Usage .. Options .. Option -A .. Option -C .. Option -E .. Option -H or -? .. Option -L .. Option -O .. Option -P .. Option -S .. Option -V .. Option -Z .. 204. PICBASIC PRO Basics .. Identifiers .. Line Labels .. Variables .. Aliases .. Arrays .. 25 PICBASIC PRO Symbols .. Constants .. Numeric Constants .. String Constants .. Ports and Other Registers.

3 Pins .. Comments .. Multi-statement Lines .. Line-extension Character .. INCLUDE .. DEFINE .. Math Operators .. Multiplication .. Division .. Shift .. ABS .. COS .. DCD .. DIG .. DIV32 .. MAX and MIN .. NCD .. REV .. SIN .. SQR .. Bitwise Operators .. Comparison Operators .. Logical Operators .. 405. PICBASIC PRO Statement Reference .. ADCIN .. BRANCH .. BRANCHL .. BUTTON .. CALL .. CLEAR .. CLEARWDT .. COUNT .. DATA .. DEBUG .. DEBUGIN .. 58 PICBASIC PRO DISABLE .. DISABLE DEBUG .. DISABLE INTERRUPT .. DTMFOUT .. EEPROM .. ENABLE .. ENABLE DEBUG .. ENABLE INTERRUPT .. END .. ERASECODE .. FREQOUT .. GOSUB .. GOTO .. HIGH .. HPWM .. HSERIN .. HSERIN2 .. HSEROUT .. HSEROUT2 .. I2 CREAD .. I2 CWRITE .. INPUT .. LCDIN .. LCDOUT.

4 {LET} .. LOOKDOWN .. LOOKDOWN2 .. LOOKUP .. LOOKUP2 .. LOW .. NAP .. ON DEBUG .. ON INTERRUPT .. OUTPUT .. OWIN .. OWOUT .. PAUSE .. PAUSEUS .. PEEK .. PEEKCODE .. POKE .. 116 PICBASIC PRO POKECODE .. POT .. PULSIN .. PULSOUT .. PWM .. RANDOM .. RCTIME .. READ .. READCODE .. RESUME .. RETURN .. REVERSE .. SELECT CASE .. SERIN .. SERIN2 .. SEROUT .. SEROUT2 .. SHIFTIN .. SHIFTOUT .. SLEEP .. SOUND .. STOP .. SWAP .. TOGGLE .. USBIN .. USBINIT .. USBOUT .. USBSERVICE .. WRITE .. WRITECODE .. XIN .. XOUT .. 1666. Structure of a Compiled Program .. Target Specific Headers .. The Library Files .. PICBASIC PRO Generated Code ..ASM File Structure .. 170 PICBASIC PRO Compilerv7. Other PICBASIC PRO Considerations .. How Fast is Fast Enough?

5 Configuration Settings .. RAM Usage .. Reserved Words .. Life After 2K .. 12-Bit Core Considerations .. 1768. Assembly Language Programming .. Two Assemblers - No Waiting .. Programming in Assembly Language .. Placement of In-line Assembly .. Another Assembly Issue .. 1829. Interrupts .. Interrupts in General .. Interrupts in BASIC .. Interrupts in Assembler .. 18610. PICBASIC PRO / PICBASIC / Stamp Differences .. Execution Speed .. Digital I/O .. Low Power Instructions .. Missing PC Interface .. No Automatic Variables .. No Nibble Variable Types .. No DIRS .. No Automatic Zeroing of Variables .. Math Operators .. [ ] Versus ( ) .. ABS .. DATA, EEPROM, READ and WRITE .. DEBUG .. GOSUB and RETURN .. I2 CREAD and I2 CWRITE .. LOOKDOWN and LOOKUP .. MAX and MIN .. SERIN and SEROUT .. SLEEP .. 198 PICBASIC PRO CompilerviAppendix A.

6 199 Serin2/Serout2 Mode Examples .. 199 Appendix B .. 201 Defines .. 201 Appendix C .. 203 Reserved Words .. 203 Appendix D .. 205 ASCII Table .. 205 Appendix E .. 209 Contact Information .. 209 PICBASIC PRO Compiler11. IntroductionThe PICBASIC PRO Compiler (or PBP) makes it even quicker andeasier for you to program Microchip Technology s powerful PIC microcontrollers (MCUs). The English-like BASIC language is mucheasier to read and write than assembly PICBASIC PRO Compiler is BASIC Stamp II like and has most ofthe libraries and functions of both the BASIC Stamp I and II. Being a truecompiler, programs execute much faster and may be longer than theirStamp is not quite as compatible with the BASIC Stamps as our originalPICBASIC Compiler is with the BS1. Decisions were made that wehope improve the language overall. One of these was to add a instead of the (GOTO) of theStamps.

7 These differences are spelled out later in this defaults to create files that run on a PIC16F84 clocked at a minimum of other parts are necessary: 2 22pf capacitors for the4 MHz crystal, a pull-up resistor tied to the /MCLR pin and a suitable5- volt power supply. PIC MCUs other than the 16F84, as well asoscillators of frequencies other than 4 MHz, may be used with thePICBASIC PRO The PIC MCUsThe PICBASIC PRO Compiler produces code that may be programmedinto a wide variety of PIC microcontrollers having from 8 to 100 pins andvarious on-chip features including A/D converters, hardware timers andserial current version of the PICBASIC PRO Compiler supports most of theMicrochip Technology PIC MCUs, including the 12-bit core, 14-bit coreand both 16-bit core series, the PIC17 Cxxx and PIC18 Xxxxx devices, aswell as the Micromint PicStics. Limited support has been added for PICMCUs based on the original 12-bit core.

8 Support is limited as the 12-bitcore PIC MCUs have a limited set of resources including a smaller stackand smaller code page size. See the file for the very latestPIC MCU support general purpose PIC MCU development using the PICBASIC PROC ompiler, the PIC12F683, 16F690, 16F88, 16F876A, 16F877A, 18F2620 PICBASIC PRO Compiler2and 18F4620 are the current PIC MCUs of choice. Thesemicrocontrollers use flash technology to allow rapid erasing andreprogramming to speed program debugging. With the click of themouse in the programming software, the flash PIC MCU can be instantlyerased and then reprogrammed again and again. Other PIC MCUs in thePIC12C5xx, 12C67x, 14000, 16C4xx, 16C5x, 16C55x, 16C6xx, 16C7xx,16C9xx, 17 Cxxx and 18 Cxxx series are either one-time programmable(OTP) or have a quartz window in the top (JW) to allow erasure byexposure to ultraviolet light for several PIC12F6xx, 16F6xx, 16F8xx and 18 Fxxxx devices also containbetween 64 and 1024 bytes of non-volatile data memory that can be usedto store program data and other parameters even when the power isturned off.

9 This data area can be accessed simply by using thePICBASIC PRO Compiler s READ and WRITE commands. (Programcode is always permanently stored in the PIC MCU s code space whetherthe power is on or off.)By using a flash PIC MCU for initial program testing, the debuggingprocess may be sped along. Once the main routines of a program areoperating satisfactorily, a PIC MCU with more capabilities or expandedfeatures of the Compiler may be many PIC MCU features will be discussed in this manual, for fullPIC MCU information it is necessary to obtain the appropriate PIC MCUdata sheets or the CD-ROM from Microchip Technology. Refer toAppendix F for contact About This ManualThis manual cannot be a full treatise on the BASIC language. Itdescribes the PICBASIC PRO Compiler instruction set and providesexamples on how to use it. If you are not familiar with BASIC programming, you should acquire a book on the topic.

10 Or just jump rightin. BASIC is designed as an easy-to-use language. Try a few simplecommands to see how they work. Or start with the examples and thenbuild on next section of this manual covers installing the PICBASIC PROC ompiler and writing your first program. Following is a section thatdescribes different options for compiling PRO Compiler3 Programming basics are covered next, followed by a reference sectionlisting each PICBASIC PRO command in detail. The reference sectionshows each command prototype, a description of the command andsome examples. Curly brackets, {}, indicate optional remainder of the manual provides information for advancedprogrammers - the inner workings of the Sample ProgramsExample programs to help get you started can be found in the SAMPLES subdirectory. Additional example programs can be found in the sampleprograms section of the microEngineering Labs, Inc.


Related search queries