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> CompilerAssembler Variables.Variable names may be used directly with assembler mnemonics, except when pureassembler is used and the variable’s name is a single character. In this case, the nameis preceded by an underscore. For example: -DIM Var as BYTEDIM A as BYTEMOVLW 10MOVWF VARMOVWF AASMMOVWF _AENDASM‘ BASIC mnemonics‘ Note the A variable does not require an underscore‘ Pass the mnemonics directly to MPASM; Note the underscore preceding the single variable’s nameVariables are place in memory in the order they are declared. So for example, if we declare3 variables named Var1, Var2, and Var3: -DIM VAR1 as BYTEDIM VAR2 as BYTEDIM VAR3 as BYTEVariable VAR1 will be located first in the PIC’s memory, followed by VAR2, then VAR3.This is of little importance if the variables are to be used in a BASIC program, however,if they are used for an assembly subroutine, it is advantageous to keep them within thefirst bank (if the PIC used has multiple RAM banks), to eliminate any dreaded RAMbank boundary conflicts.WORD VariablesA WORD variable consists of two BYTE sizes variables, the upper (MSB) byte variablehas the letter H tagged onto the end of the original variables name. This is more clearlyexplained by examining a declared variable, named WRD1: -DIM WRD1 as WORD‘ Declare a word (16-bit) variableThe assembler code produced looks like: -WRD1 EQU 58 ‘ Low byte of the WORD variableWRD1H EQU 59 ‘ High byte of the WORD variableThese two variables may now be used in an assembly routine such as: -CLRCRLF WRD1 , FRLF WRD1H , F‘ Clear the carry flag before the rotates‘ Rotate the low byte of variable WRD1‘ Rotate the carry into the high byte of WRD1The result of the above program is to rotate left the WORD variable WRD1. If the variablewas now to be displayed using BASIC, its value would be shifted left 1 bit.136Copyright Crownhill 2001

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

Saved successfully!

Ooh no, something went wrong!