You are on page 1of 2

3/10/2016

BASCOMAVR

BASCOMAVR
Contents|Index|
Search
Index
Installation
BASCOMIDE
BASCOM
HARDWARE
Additional
Hardware
AVRInternal
Hardware
AVRInternal
Registers
AVRInternal
Hardware
TIMER0
AVRInternal
Hardware
TIMER1
AVRInternal
Hardware
Watchdogtimer
AVRInternal
HardwarePortB
AVRInternal
HardwarePortD
AddingXRAM
withExternal
MemoryInterface
AddingXRAMto
XMEGAusing
EBI
Attachingan
LCDDisplay
Memoryusage
UsingtheUART
USINGRS485
UsingtheI2C
protocol
Usingthe1
WIREprotocol
UsingtheSPI
protocol
UsingUSI
(UniversalSerial
Interface)
PowerUp
Chips
Reference
Designs

BASCOM
Language
Fundamentals
BASCOM
Language
Reference
ASMLibrariesand
AddOns
Tools
International
Resellers
2015MCSElectronics

UsingUSI(Universal
SerialInterface)

Top
Previous
Next

TheUniversalSerialInterface(USI)isamulti
purposehardwareresourcewhichprovidethe
basicshardwareforvariousserial
communicationsandisfasterandreliablethen
implementingitinsoftware.
YoumainlyfindtheUSIonATTINYdevicesbut
alsoforexampleonATMEGA169.

USIFeatures:
TwowireSynchronousDataTransfer
ThreewireSynchronousDataTransfer
DataReceivedInterrupt
WakeupfromIdleMode

TheUSIcanbeusedinTwowiremodeandin
threewiremode:
2wiremode>I2C/TWI
3wiremode>SPI

TheUSIhandleonlythelowlevelcommunication.
Highlevelcommunicationforexamplefor2wire
mode(I2C)likeaddresssetting,message
interpretingorpreparingofdataneedstobe
handledbysoftwareinthemainloop.
ThereareApplicationNotesfromAtmelavailable:

AVR312:UsingtheUSImoduleasaI2Cslave
AVR310:UsingtheUSImoduleasaI2Cmaster

The3wiremode(SPI)iseasiertoimplementand
thereforeshownhereasanexample.
TheSlaveSelect(SS)needstobeimplementedin
softwareifneeded.
TheUSIPinnamesare:DI,DOandUSCK.

AVR319:UsingtheUSImoduleforSPI
communication

Seealso:

UsingtheSPIprotocol,SPISLAVE,UsingI2C
Protocol,confiigTWISLAVE,I2CTWISlave,USI
asTWISlave

FollowinganexamplehowtouseanATTINYasan
SPIMasterandanotherexampleshowanSPI
SlaveoverUSI.

Example(SPIMasterwithUSI):

1.Configuretheportpin's:

'UsingATTINYasSPIMASTERover
USI
ConfigPortb.2=Output
'USCK>SCK(Slave)
ConfigPortb.1=Output

http://avrhelp.mcselec.com/index.html?using_usi_universal_serial_int.htm

1/2

3/10/2016

http://avrhelp.mcselec.com/index.html?using_usi_universal_serial_int.htm

BASCOMAVR

2/2

You might also like