USI: Unterschied zwischen den Versionen
KKeine Bearbeitungszusammenfassung |
(→Forum) |
||
Zeile 141: | Zeile 141: | ||
---- | ---- | ||
== Forum == | == Forum == | ||
[http://www.mikrocontroller.net/wikisoftware/index.php?title=USI&action=submit Attiny USI Slave Implementierung] | * [http://www.mikrocontroller.net/wikisoftware/index.php?title=USI&action=submit Attiny USI Slave Implementierung] | ||
---- | ---- | ||
== Weblinks == | == Weblinks == | ||
* [http://www.atmel.com/dyn/resources/prod_documents/doc2561.pdf Atmel_AVR310 - Using the USI module as a I2C master ] | * [http://www.atmel.com/dyn/resources/prod_documents/doc2561.pdf Atmel_AVR310 - Using the USI module as a I2C master ] |
Version vom 7. Juni 2010, 13:40 Uhr
Das Universal Serial Interface ist eine in manchen Mikrocontrollern vom Typ AVR (z. B. ATtiny26, ATtiny2313) verwendete serielle Schnittstelle. Es kann als TWI Interface, der Atmelvariante des I2C Busses, verwendet werden. Ebenso kann eine SPI Schnittstelle realisiert werden.
USI (Universal Serial Interface) steht für Universelle serielle Schnittstelle, die vor allem in kleineren Atmel AVR Controllern, wie zB. beim ATTiny2313, aber auch in einigen ATMegas anzutreffen ist.
Wie der Name schon aussagt, handelt es sich dabei um ein All-in-One-Interface, das lediglich die Hardware zur seriellen Kommunikation enthält,jedoch praktisch keine Protokoll-Implementierung. Diese muss in der Software implementiert werden, je nachdem, welchen Interface-Typ man nutzen will.
Die Hauptfunktionen sind
- Three-wire Modus, bzw. SPI
- Two-wire Modus, bzw. TWI oder I2C
USI als I2C/TWI Interface
USI als I2C/TWI Interface Register
// 2-wire mode; Hold SCL on start and overflow; ext. clock USICR |= (1<<USIWM1) | (1<<USIWM0) | (1<<USICS1);
Mit dieser Konfiguration gelten folgende Tabellen für SDA respektive SCL Pin:
DDR SDA | Shiftreg. Bit 7 | PORT SDA | PIN SDA |
0 | X | X | 1 |
1 | 0 | 0 | 0 |
1 | 0 | 1 | 0 |
1 | 1 | 0 | 0 |
1 | 1 | 1 | 1 |
DDR SCL | Startdet. | Overflowdet. | PORT SCL | PIN SCL |
0 | X | X | X | 1 |
1 | 0 | 0 | 0 | 0 |
1 | 0 | 0 | 1 | 1 |
1 | 0 | 1 | 0 | 0 |
1 | 0 | 1 | 1 | 0 |
1 | 1 | 0 | 0 | 0 |
1 | 1 | 0 | 1 | 0 |
1 | 1 | 1 | 0 | 0 |
1 | 1 | 1 | 1 | 0 |
USI als I2C/TWI Slave
Die Biblitothek ermöglicht eine I2C/TWI Kommunikation über das USI Interface von Atmel. Der verwendete Controller wird dabei als Slave in dem Bussystem verwendet. Neben Controllern der Reihe ATTiny, wie dem ATTiny2313, werden auch eine Reihe von anderen Controllern mit USI Interface unterstützt. Die Bibliothek ist so programmiert, dass der Slave wie ein I2C-Speicher (I2C-Epprom) funktioniert.
unterstützt werden bisher folgende Controller: ATtiny2313, ATtiny25, ATtiny45, ATtiny85, ATtiny26, ATtiny261, ATtiny461, ATtiny861, ATmega165, ATmega325, ATmega3250, ATmega645, ATmega6450, ATmega329, ATmega3290, ATmega169
Forum
Weblinks
- Atmel_AVR310 - Using the USI module as a I2C master
- Atmel_AVR312 - Using the USI module as a I2C slave
- Bibliothek für I2C/TWI Slave mit USI in "C" von http://www.jtronics.de