Positron Compiler Documentation

Hbusin2 – Hbusout2 Declares.

Positron16 · Revision 1.1.3.5 · PDF page 414

Declare HSDA2_Pin Port.Pin Declares the port and pin used for the MSSP2 module’s data line (SDA). If the declare is not used in the BASIC program listing, it will not default to a standard pin configuration and the compiler will give an error message, so make sure they are in the BASIC listing.

Declare HSCL2_Pin Port.Pin Declares the port and pin used for the MSSP2 module’s clock line (SCL). If the declare is not used in the BASIC program listing, it will not default to a standard pin configuration and the compiler will give an error message, so make sure they are in the BASIC listing.

Declare Hbus2_Bitrate Constant 100, 400, 1000 etc. The standard speed for the I2C bus is 100KHz. Some devices use a higher bus speed of 400KHz. The above Declare allows the I2C bus speed to be increased or decreased. Use this Declare with caution, as too high a bit rate may exceed the device's specs, which will result in intermittent transactions, or in some cases, no transactions at all. The datasheet for the device used will inform you of its bus speed. The default bit rate is the standard 100KHz.

Because the I2C protocol calls for an open-collector interface, pull-up resistors are required on both the SDA and SCL lines. Values of 1KΩ to 4.7KΩ will suffice.

View original PDF page 414Open page in PDFOriginal PDF page 414