I2CV2
Line 11: | Line 11: | ||
For this purpose the i2c master library has been rewritten so that clock and data have a known state/level at all times. This allows to create glitch free clock/data. | For this purpose the i2c master library has been rewritten so that clock and data have a known state/level at all times. This allows to create glitch free clock/data. | ||
− | To use this library use the $LIB directive : $LIB "I2CV2.LIB" | + | To use this library use the $LIB directive : $LIB "I2CV2.LIB" |
− | This will make the compiler use this library. One thing to be aware of : a repeated start can only be created by using the[[ | + | This will make the compiler use this library. One thing to be aware of : a repeated start can only be created by using the [[I2CREPSTART]] statement. |
This is a difference with the default i2c.lib | This is a difference with the default i2c.lib | ||
Line 25: | Line 25: | ||
| | ||
− | See also: | + | '''See also''': [[Using_the_I2C_protocol|Using the I2C protocol]] , [[CONFIG_TWI|CONFIG TWI]] |
Revision as of 16:47, 4 February 2014
I2C Software
By default BASCOM will use software routines when you use I2C statements. This because when the first AVR chips were introduced, there was no TWI interface. Atmel named it TWI because Philips is the inventor of I2C. But TWI is the same as I2C.
When your processor has a TWI interface you can best use this TWI interface.
By default the software master i2c routines use the library named i2c.lib. This library does not maintain a clock/data state so when i2cstart or i2cstop is generated, the clock and data lines need to be set to the proper state before the start/stop condition can be generated. This can result in small glitches. Most slave chips will not notice them but some do.
For this purpose the i2c master library has been rewritten so that clock and data have a known state/level at all times. This allows to create glitch free clock/data.
To use this library use the $LIB directive : $LIB "I2CV2.LIB"
This will make the compiler use this library. One thing to be aware of : a repeated start can only be created by using the I2CREPSTART statement.
This is a difference with the default i2c.lib
See also: Using the I2C protocol , CONFIG TWI
Languages | English |
---|