I2CINIT

Top  Previous  Next

Action

Initializes the SCL and SDA pins.

 

 

Syntax

I2CINIT

 

 

Remarks

By default the SCL and SDA pins are in the right state when you reset the chip. Both the PORT and the DDR bits are set to 0 in that case.

When you need to change the DDR and/or PORT bits you can use I2CINIT to bring the pins in the proper state again.

 

ASM

The I2C routines are located in i2c.lib. _i2c_init is called.

 

 

See also

I2CSEND , I2CSTART , I2CSTOP , I2CRBYTE , I2CWBYTE , I2C_TWI Library for using TWI

 

 

Example

Config Sda = Portb.5

Config Scl = Portb.7

I2cinit

 

Dim X As Byte , Slave As Byte

X = 0                                                       'reset variable

Slave = &H40                                               'slave address of a PCF 8574 I/O IC

I2creceive Slave , X                                       'get the value

Print X                                                     'print it