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...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>PICBASIC</strong> <strong>PLUS</strong> Compiler3.5. AliasesDIM can also be used to create an alias to a variable. This is very useful for accessingthe separate parts of a variable.DIM Fido as DogDIM Mouse as Rat.LOWBYTEDIM Tail as Rat.HIGHBYTEDIM Flea as Dog.0‘ Fido is another name for Dog‘ Mouse is the first byte (low byte) of word Rat‘ Tail is the second byte (high byte) of word Rat‘ Flea is bit-0 of Dog3.6. ConstantsNamed constants may be created in the same manner as variables. It can be more informativeto use a constant name instead of a constant number. Once a constant is declared,it cannot be changed later, hence the name ‘constant’.DIM Label as Constant expressionDIM Mouse as 1DIM Mice as Mouse * 4003.7. SymbolsSYMBOL provides yet another method for aliasing variables and constants. SYMBOLcannot be used to create a variable. Constants declared using SYMBOL do not use anyRAM within the PIC.SYMBOL Tiger = cat‘ Cat was previously created using DIMSYMBOL Mouse = 1 ‘ Same as DIM Mouse as 1SYMBOL Tigouse = Tiger + Mouse ‘ Add Tiger to Mouse to make TigouseIf a variable or register’s name is used in a constant expression then the variable’s orregister’s address will be substituted, not the value held in the variable or register: -SYMBOL CON = (PORTA + 1) ‘ CON will hold the value 6 (5+1)SYMBOL is also useful for aliasing Ports and Registers: -SYMBOL LED = PORTA.1SYMBOL T0IF = INTCON.2‘ LED now references bit-1 of PortA‘ T0IF now references bit-2 of INTCON registerThe equal sign between the Constant’s name and the alias value is optional: -SYMBOL LED PORTA.1‘ Same as SYMBOL LED=PORTA.113Copyright Crownhill 2001

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

Saved successfully!

Ooh no, something went wrong!