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.8. Numeric Representations<strong>PICBASIC</strong> <strong>PLUS</strong> recognises four different number representations: -Binary is prefixed by %. i.e. %0101Hexadecimal is prefixed by $. i.e. $0ACharacter byte is surrounded by quotes. i.e. “a” represents a value of 97Decimal values need no prefix.3.9. String Constants<strong>PICBASIC</strong> <strong>PLUS</strong> doesn't provide conventional string handling capabilities, but stringscan be used with some commands. A string contains one or more characters and isdelimited by double quotes.PRINT "Hello World"‘ Output String ("H","e","l","l","o",” “,"W","o","r","l","d")Strings are usually treated as a list of individual character values, and are used by commandssuch as PRINT, RSOUT, BUSOUT, EWRITE etc.3.10. Ports and Other RegistersAll of the PICmicro registers, including the ports, can be accessed just like any otherbyte-sized variable. This means that they can be read from, written to or used in equationsdirectly:PORTA = %01010101Var = Wrd * PORTA‘ Write value to PORTA‘ Multiply variable WRD with the contents of PORTA3.11. General FormatThe compiler is not case sensitive, except when processing string constants such as“hello”.Multiple instructions and labels can be combined on the same line by separating themwith colons ‘:’.The examples below show the same program as separate lines and as a single-line...Multiple-line version: -TRISB = %00000000 ' Make all pins on PortB outputsFOR Var = 0 TO 100 ' Count from 0 to 100PORTB = Var' Make PortB = count (Var)NEXT' Continue counting until 100 is reachedSingle-line version: -TRISB = %00000000 : FOR Var = 0 TO 100 : PORTB = Var : NEXT14Copyright Crownhill 2001

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

Saved successfully!

Ooh no, something went wrong!