Datasheet
Programming PIC Microcontrollers in BASIC - mikroElektronika
In BASIC, variable needs to be declared before it can be used. Specifying a data type for each variable is mandatory.
Variable is declared like this:
dim identifier as type
where identifier is any valid identifier and type can be any given data type.
For example:
dim temperature as byte ' Declare variable temperature of byte type
dim voltage as word ' Declare variable voltage of word type
Individual bits of byte variables (including SFR registers such as PORTA, etc) can be accessed by means of dot,
both on left and right side of the expression. For example:
Data_Port.3 = 1 ' Set third bit of byte variable Data_Port
2.8 Symbols
Symbol makes possible to replace a certain expression with a single identifier alias. Use of symbols can increase
readability of code.
BASIC syntax restricts you to single line expressions, allowing shortcuts for constants, simple statements, function
calls, etc. Scope of symbol identifier is a whole source file in which it is declared.
For example:
symbol MaxAllowed = 234 ' Symbol as alias for numeric value
symbol PORT = PORTC ' Symbol as alias for Special Function
Register
symbol DELAY1S = Delay_ms(1000) ' Symbol as alias for procedure call
...
if teA > MaxAllowed then
teA = teA - 100
http://www.mikroelektronika.co.yu/english/product/books/picbasicbook/02.htm (6 sur 12)05/11/2004 02:12:53