Author | Wouter van Ooijen, Copyright © 1998, 1999 Wouter van Ooijen |
Adapted-by | Joep Suijs, William Welch |
Compiler | >=2.4g |
reset / clear the i2c bus, bit-bang approach Define i2c pins like: alias i2c_scl is pin_c3 alias i2c_scl_direction is pin_c3_direction alias i2c_sda is pin_c4 alias i2c_sda_direction is pin_c4_direction const word _i2c_bus_speed = 1 ; * 100kHz
i2c_reset_bus()
i2c_reset - initialize the i2c bus The output latch values are always low, the lines are switched open-collector fashion by manipulating the direction registers.
_i2c_stop()
_i2c_stop - output a stop condition
_i2c_wait()
_i2c_wait - wait for a change to settle (for internal use only) The delay is determined by i2c_bus_speed and is 1/4 of the cycle time. Given the delay resolution of 1 us and all actions required by i2c_software routines, the actual bus speed will be lower then the configured maximum.
_i2c_start()
_i2c_start - output a start condition
_i2c_bit_out(bit in x)
_i2c_bit_out- output a single bit (for internal use only)
_i2c_bit_in(bit out x)
_i2c_bit_in- input a single bit (for internal use only)
18f67k22 | 18f67k22_co2_i2c.jal |