I2C-TWI
(Created page with "<div id="idcontent"><div id="innerdiv"> By default BASCOM will use software routines when you use I2C statements. This because when the first AVR chips were introduced, there ...") |
|||
Line 2: | Line 2: | ||
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 yet. Atmel named it TWI because Philips is the inventor of I2C. But TWI is the same as I2C. | 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 yet. Atmel named it TWI because Philips is the inventor of I2C. But TWI is the same as I2C. | ||
− | <span style="font-family: 'Arial'; | + | <span style="font-family: 'Arial'; color: #000000"> </span> |
So BASCOM allows you to use I2C on every AVR chip. Most newer AVR chips have build in hardware support for I2C. With the I2C_TWI lib you can use the TWI which has advantages as it require less code. | So BASCOM allows you to use I2C on every AVR chip. Most newer AVR chips have build in hardware support for I2C. With the I2C_TWI lib you can use the TWI which has advantages as it require less code. | ||
− | <span style="font-family: 'Arial'; | + | <span style="font-family: 'Arial'; color: #000000"> </span> |
Read more about I2C in the [[Using the I2C protocol|hardware]] section. | Read more about I2C in the [[Using the I2C protocol|hardware]] section. | ||
− | <span style="font-family: 'Arial'; | + | <span style="font-family: 'Arial'; color: #000000"> </span> |
To force BASCOM to use the TWI, you need to insert the following statement into your code: | To force BASCOM to use the TWI, you need to insert the following statement into your code: | ||
− | <span style="font-family: 'Arial'; | + | <span style="font-family: 'Arial'; color: #000000"> </span> |
$LIB "I2C_TWI.LBX" | $LIB "I2C_TWI.LBX" | ||
− | <span style="font-family: 'Arial'; | + | <span style="font-family: 'Arial'; color: #000000"> </span> |
You also need to choose the correct SCL and SDA pins with the CONFIG SCL and CONFIG SDA statements. | You also need to choose the correct SCL and SDA pins with the CONFIG SCL and CONFIG SDA statements. | ||
The TWI will save code but the disadvantage is that you can only use the fixed SCL and SDA pins. | The TWI will save code but the disadvantage is that you can only use the fixed SCL and SDA pins. | ||
+ | |||
+ | |||
+ | |||
+ | See also: [[Using the I2C protocol|Using the I2C protocol]], [[CONFIG TWI|CONFIG TWI]] , [[I2CV2]] | ||
Revision as of 13:20, 4 February 2014
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 yet. Atmel named it TWI because Philips is the inventor of I2C. But TWI is the same as I2C.
So BASCOM allows you to use I2C on every AVR chip. Most newer AVR chips have build in hardware support for I2C. With the I2C_TWI lib you can use the TWI which has advantages as it require less code.
Read more about I2C in the hardware section.
To force BASCOM to use the TWI, you need to insert the following statement into your code:
$LIB "I2C_TWI.LBX"
You also need to choose the correct SCL and SDA pins with the CONFIG SCL and CONFIG SDA statements.
The TWI will save code but the disadvantage is that you can only use the fixed SCL and SDA pins.
See also: Using the I2C protocol, CONFIG TWI , I2CV2
Languages | English • Deutsch |
---|