New E-I2C Subroutines v2.0 for C-Control I v1.1 & v2.0
I have updated my E-I2C subroutines.
Changes made are:
• It is no longer necessary to define the in bit (i2c_in_bit) and out bit (i2c_out_bit).
• The C-Control will not hang if an I2C device malfunctions while in I2C clock stretch, the C-Control will register this as an I2C Nack (i2c_nack).
• Added the I2C repeated start (gosub repeated_start_i2c) subroutine, it is not intended for multi master but could be handy for some I2C devices.
You can download the software in the download area -> https://www.roboternetz.de/phpBB2/dl...gory&cat_id=26
Using the I2C subroutines:
To send the I2C START command:
To send the I2C REPEATED START command:
To send the I2C STOP command:
To check for an I2C NACK:
if i2c_nack then ….
To send byte over the I2C bus:
i2c_byte = x : gosub write_byte_i2c
To read byte from the I2C bus:
gosub read_byte_i2c : x = i2c_byte
To read the last byte from the I2C bus:
gosub read_last_byte_i2c : x = i2c_byte