PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : New E-I2C Subroutines v2.0 for C-Control I v1.1 & v2.0



Drifter2006
05.12.2007, 23:13
Hello,
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:
• 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/dload.php?action=category&cat_id=26

Using the I2C subroutines:

To send the I2C START command:
gosub start_i2c

To send the I2C REPEATED START command:
gosub repeated_start_i2c

To send the I2C STOP command:
gosub stop_i2c

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

Greetings,
Windt H.J.