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> CompilerAddress, is an optional parameter that may be an 8-bit or 16-bit value.If a variable is used in this position, the size of address is dictated bythe size of the variable used (BYTE or WORD). In the case of theprevious eeprom interfacing, the 24C32 eeprom requires a 16-bit address.While the smaller types require an 8-bit address. Make sureyou assign the right size address for the device interfaced with, or youmay not achieve the results you intended.The value received from the bus depends on the size of the variablesused. For example: -DIM Wrd as WORDWrd = BUSIN Control , Address‘ Declare a WORD size variableWill receive a 16-bit value from the bus. While: -DIM Var as BYTEVar = BUSIN Control , Address‘ Declare a BYTE size variableWill receive an 8-bit value from the bus.Using the second variation of the BUSIN command allows differingvariable assignments. For example: -DIM Var as BYTEDIM Wrd as WORDBUSIN Control , Address , [ Var , Wrd ]Will receive two values from the bus, the first being an 8-bit value dictatedby the size of variable VAR which has been declared as a byte.And a 16-bit value, this time dictated by the size of the variable WRDwhich has been declared as a word. Of course, BIT type variablesmay also be used, but in most cases these are not of any practicaluse as they still take up a byte within the eeprom.Declares :There are three DECLARE directives for use with BUSIN.These are: -DECLARE SDA_PIN PORT . PINDeclares 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 . PINDeclares 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.128Copyright Crownhill 2001

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

Saved successfully!

Ooh no, something went wrong!