Example: I2C core library

Example: I2C core library

In this section we present a library of core I2C routines (Listings 23.1 to 23.3). In most cases you will need to add some additional functions to use these files with particular I2C peripherals: we illustrate this process in the examples that follow.

Please note that not all I2C devices use ACKNOWLEDGE / NOT ACKNOWLEDGE

signals (discussed earlier). Similarly, not all devices need a ‘read byte’ facility (PWM and DAC outputs, for example). You can omit these library features by means of these lines at the top of the I2C_Core.C file:

image

image

image

image

image

image

image

image

Leave a comment

Your email address will not be published. Required fields are marked *