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> CompilerThe value sent to the bus depends on the size of the variables used.For example: -DIM Wrd as WORD‘ Declare a WORD size variableBUSOUT Control , Address , [ Wrd ]Will send a 16-bit value to the bus. While: -DIM Var as BYTEBUSOUT Control , Address , [ Var ]‘ Declare a BYTE size variableWill send an 8-bit value to the bus.Using more than one variable within the brackets allows differing variablesizes to be sent. For example: -DIM Var as BYTEDIM Wrd as WORDBUSOUT Control , Address , [ Var , Wrd ]Will send two values to the bus, the first being an 8-bit value dictatedby the size of variable VAR which has been declared as a byte. And a16-bit value, this time dictated by the size of the variable WRD whichhas been declared as a word. Of course, BIT type variables may alsobe used, but in most cases these are not of any practical use as theystill take up a byte within the eeprom.A string of characters can also be transmitted, by enclosing them inquotes: -BUSOUT Control , Address , [ “Hello World” , Var , Wrd ]Declares :There are four DECLARE directives for use with BUSOUT.These are: -DECLARE SDA_PIN PORT . PINAssigns the port and pin used for the data line (SDA). This may beany valid port on the PIC. If this declare is not issued in the BASICprogram, then the default Port and Pin is PortA.0DECLARE SCL_PIN PORT . PINAssigns the port and pin used for the clock line (SCL). This may beany valid port on the PIC. If this declare is not issued in the BASICprogram, then the default Port and Pin is PortA.1These declares, as is the case with all the DECLARES, may only beissued once in any single program, as they setup the I 2 C library codeat design time.31Copyright Crownhill 2001

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

Saved successfully!

Ooh no, something went wrong!