11.07.2015 Views

PICBASIC PLUS LITE Manual - Profe Saul

PICBASIC PLUS LITE Manual - Profe Saul

PICBASIC PLUS LITE Manual - Profe Saul

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>PICBASIC</strong> <strong>PLUS</strong> Compiler3.2. IdentifiersAn identifier is a technical term for a name. Identifiers are used in <strong>PICBASIC</strong> <strong>PLUS</strong> forline labels, variable names, and constant aliases. An identifier is any sequence of letters,digits, and underscores, although it must not start with a digit. Identifiers are notcase sensitive, therefore label, LABEL, and Label are all treated as equivalent. Andwhile labels might be any number of characters in length, only the first 32 are recognised.3.3. Line LabelsIn order to mark statements that the program may wish to reference with the GOTO,CALL, or GOSUB commands, <strong>PICBASIC</strong> <strong>PLUS</strong> uses line labels. Unlike many olderBASICs, <strong>PICBASIC</strong> <strong>PLUS</strong> doesn't allow or require line numbers and doesn't requirethat each line be labelled. Instead, any line may start with a line label, which is simply anidentifier followed by a colon ‘:’.Lab:PRINT “Hello World”GOTO Lab3.4. VariablesVariables are where temporary data is stored in a BASIC program. They are createdusing the DIM keyword. Because RAM space on PICmicros is somewhat limited in size,choosing the right size variable for a specific task is important. Variables may be bits,bytes or words. Space for each variable is automatically allocated in the micro controller’sRAM area. The format for creating a variable is as follows: -DIM Label as SizeLabel is any identifier, (excluding keywords). Size is BIT, BYTE or WORD. Some examplesof creating variables are: -DIM Dog as BYTE ‘ Create an 8-bit variable (0-255)DIM Cat as BIT ‘ Create a single bit variable (0-1)DIM Rat as WORD ‘ Create a 16-bit variable (0-65535)The number of variables available depends on the amount of RAM on a particular deviceand the size of the variables within the BASIC program. <strong>PICBASIC</strong> <strong>PLUS</strong> reservesapproximately 26 RAM locations for its own use. It may also create additional temporaryvariables for use when calculating complex equations.There are certain reserved words that cannot be used as variable names, these are thesystem variables used by the compiler.The following reserved words cannot be used as variable names: -PP0, PP0H, PP1, PP1H, PP2, PP2H, PP3, PP3H, PP4, PP4H, PP5, PP5H, PP6, PP6H,PP7, PP7H, GEN, GENH, GEN2, GEN2H, GEN3, GEN3H, GEN4, GEN4H, GPR, BPF.12Copyright Crownhill 2001

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!