Example: marketing

PICBASIC PRO™ Compiler REFERENCE MANUAL

PICBASIC PRO Compiler REFERENCE MANUAL Revised March 6, 2013 Copyright 2013 microEngineering Labs, Inc Please report errors and inaccuracies to Thank you for using PICBASIC PRO Compiler . The goal of this document is to provide accurate and exhaustive information about the workings of the software and how it might be used. As development continues in the software, so shall this MANUAL receive frequent revision. The latest MANUAL release is available for download at Legal stuff: microEngineering labs, inc. (the company) disclaims all warranties, express or implied, including without limitation the implied warranty of fitness for a particular purpose, the implied warranty of merchantability, and the implied warranty of the accuracy of the information presented in this document.

PICBASIC PRO™ Compiler REFERENCE MANUAL Table of Contents 6 www.melabs.com 2013-03-06 3.1.14 REV..... 77

Tags:

  Manual, Reference, Compiler, Picbasic pro compiler reference manual, Picbasic

Information

Domain:

Source:

Link to this page:

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

Other abuse

Transcription of PICBASIC PRO™ Compiler REFERENCE MANUAL

1 PICBASIC PRO Compiler REFERENCE MANUAL Revised March 6, 2013 Copyright 2013 microEngineering Labs, Inc Please report errors and inaccuracies to Thank you for using PICBASIC PRO Compiler . The goal of this document is to provide accurate and exhaustive information about the workings of the software and how it might be used. As development continues in the software, so shall this MANUAL receive frequent revision. The latest MANUAL release is available for download at Legal stuff: microEngineering labs, inc. (the company) disclaims all warranties, express or implied, including without limitation the implied warranty of fitness for a particular purpose, the implied warranty of merchantability, and the implied warranty of the accuracy of the information presented in this document.

2 In no event shall the company or its employees, agents, suppliers or contractors be liable for any incidental, indirect, special or consequential damages arising out of or in connection with the use of the products described herein, including without limitation, lost profits, downtime, goodwill, damage to or replacement of equipment or property, or any costs for recovering, reprogramming or reproducing any data used with the products. PIC, PICmicro, dsPIC, and MPLAB are registered trademarks of Microchip Technology Inc. in the USA and other countries. MPASM, PICkit, PICBASIC , PICBASIC PRO, PICPROTO, and EPIC are trademarks of Microchip Technology Inc.

3 In the USA and other countries. BASIC Stamp is a trademark of Parallax, PRO Compiler REFERENCE MANUAL Table of Contents 4 2013-03-06 Table of Contents Chapter 1: Vital Information .. 11 System Overview .. 12 Integrated Development Environment (IDE) .. 14 MPLAB .. 14 MicroCode Studio .. 14 Other IDEs .. 14 Compile Modes PBPW and PBPL .. 15 Microchip Datasheets .. 16 Microchip Nomenclature .. 17 MANUAL Conventions and Notes .. 18 Command Prototypes .. 18 Special Terminology and Acronyms .. 19 Number formats .. 19 Comments in code examples .. 19 Technical Support .. 20 Support Requirements .. 20 Chapter 2: PBP Syntax and Programming.

4 21 Program Organization (Example) .. 22 I/O Pins .. 23 Data Direction .. 23 Aliasing .. 23 Use in High-Level Commands .. 24 Additional Configuration .. 24 Pin Characteristics .. 25 DEFINEs .. 26 DEFINE OSC .. 26 Global DEFINEs .. 27 DEFINEs defined .. 27 Aliases .. 29 Labels .. 31 Variables .. 32 Creating Scalar Variables .. 32 Creating Array Variables .. 34 Using Scalar Variables .. 34 Using Array Variables .. 37 Constants .. 39 Modifiers .. 40 Modifiers used when creating variables .. 40 Modifiers that access binary subsets of numeric values .. 40 Modifiers for parsing and formatting ASCII strings .. 40 PICBASIC PRO Compiler REFERENCE MANUAL Table of Contents 2013-03-06 5 Modifiers for specifying variable types in data space.

5 41 ASCII and Strings .. 42 Input Modifiers for Parsing Strings .. 44 DEC .. 44 BIN .. 45 HEX .. 46 SKIP .. 47 STR .. 47 WAIT .. 48 WAITSTR .. 49 Output Modifiers for Formatting Strings .. 51 DEC .. 51 BIN .. 53 HEX .. 54 REP .. 56 STR .. 56 Numbers .. 58 Registers .. 59 Comments .. 60 Case Sensitivity .. 61 DEFINEs .. 61 Variables .. 61 White Space .. 62 Tabbing For Readability .. 63 Line-Extension ( _ ) .. 64 Line-Concatenation ( : ) .. 65 INCLUDE .. 66 Chapter 3: Operators .. 67 Math Operators .. 71 Multiplication .. 71 '*/' and '**' Special Multiplication .. 72 Division .. 73 Remainder (Modulus) .. 73 ABS.

6 74 ATN .. 74 COS .. 74 DCD .. 74 DIG .. 74 DIV32 .. 75 HYP .. 76 MAX and MIN .. 76 NCD .. 77 PICBASIC PRO Compiler REFERENCE MANUAL Table of Contents 6 2013-03-06 77 SIN .. 77 SQR .. 77 Bitwise Operators .. 78 & Bitwise AND .. 79 | Bitwise OR .. 79 ^ Bitwise EXCLUSIVE OR (XOR) .. 79 ~ Bitwise NOT (INVERT) .. 80 &/ Bitwise NOT AND (NAND) .. 80 |/ Bitwise NOT OR (NOR) .. 81 ^/ Bitwise NOT EXCLUSIVE OR (XNOR) .. 81 << SHIFT LEFT .. 82 >> SHIFT RIGHT .. 83 Comparison Operators .. 84 Signed vs. Unsigned Comparisons .. 84 Equal To ( = or == ) .. 85 Not Equal To ( <> or != ) .. 85 Less Than ( < ) .. 85 Greater Than ( > ).

7 85 Less Than or Equal To ( <= ) .. 86 Greater Than or Equal To ( => ) .. 86 Logical Operators .. 87 Using Parentheses .. 87 Logical vs. Bitwise .. 87 AND .. 88 OR .. 88 XOR .. 88 NOT .. 89 ANDNOT .. 89 ORNOT .. 89 XORNOT .. 89 Chapter 4: Directives .. 90 DISABLE .. 92 DISABLE DEBUG .. 93 DISABLE INTERRUPT .. 94 ENABLE .. 95 ENABLE DEBUG .. 96 ENABLE INTERRUPT .. 97 ON 98 ON INTERRUPT .. 99 # #ENDCONFIG .. 100 #DEFINE .. 102 PICBASIC PRO Compiler REFERENCE MANUAL Table of Contents 2013-03-06 7 # 104 # # #ENDIF .. 105 # # #ENDIF .. 107 # # #ENDIF .. 108 #MSG .. 109 #WARNING .. 110 Chapter 5: Commands .. 111 Overview of Commands.

8 112 @ .. 115 ADCIN .. 116 ARRAYREAD .. 118 ARRAYWRITE .. 119 .. 120 BRANCH .. 121 BRANCHL .. 122 BUTTON .. 123 CALL .. 126 127 CLEARWDT .. 128 COUNT .. 129 DATA .. 130 DEBUG .. 131 DEBUGIN .. 133 .. 136 DTMFOUT .. 138 EEPROM .. 139 END .. 140 ERASECODE .. 141 EXIT .. 142 .. 143 FREQOUT .. 144 145 GOTO .. 146 HIGH .. 147 HPWM .. 148 HSERIN .. 150 HSERIN2 .. 153 HSEROUT .. 154 HSEROUT2 .. 156 I2 CREAD .. 157 I2 CWRITE .. 161 164 PICBASIC PRO Compiler REFERENCE MANUAL Table of Contents 8 2013-03-06 INPUT .. 166 LCDIN .. 167 LCDOUT .. 168 {LET} .. 174 LOOKDOWN .. 175 LOOKDOWN2.

9 176 LOOKUP .. 177 LOOKUP2 .. 178 LOW .. 179 NAP .. 180 ON GOSUB .. 182 ON GOTO .. 183 OUTPUT .. 184 OWIN .. 185 OWOUT .. 186 PAUSE .. 187 188 PEEK .. 189 PEEKCODE .. 190 POKE .. 191 POKECODE .. 192 POT .. 193 PULSIN .. 195 PULSOUT .. 196 PWM .. 197 RANDOM .. 198 RCTIME .. 199 READ .. 200 READCODE .. 201 .. 202 RESUME .. 203 RETURN .. 204 205 SELECT CASE .. 206 SERIN .. 207 SERIN2 .. 209 SEROUT .. 213 SEROUT2 .. 215 SHIFTIN .. 219 SHIFTOUT .. 222 SLEEP .. 224 SOUND .. 225 PICBASIC PRO Compiler REFERENCE MANUAL Table of Contents 2013-03-06 9 STOP .. 226 SWAP .. 227 228 229 USBINIT.

10 230 231 USBSERVICE .. 232 .. 233 WRITE .. 234 WRITECODE .. 235 XIN .. 237 239 Chapter 6: Interrupts .. 242 Interrupts Using ON INTERRUPT .. 244 In Practice .. 244 How ON INTERRUPT Works .. 246 Interrupts Using Assembly Language .. 248 Checklist .. 248 DEFINEs .. 249 Enabling Interrupts .. 249 Placement of the Assembly Language Routine .. 249 Declaring Special Variables to Save Context .. 250 Access to PBP Variables from the Interrupt Handler .. 250 Time-Sensitive PBP Commands .. 251 Assembly Interrupts for PIC18 Devices .. 252 Interrupt 252 Saving and Restoring Context .. 253 Example High/Low Priority ISR Framework for PIC18.


Related search queries