0% found this document useful (0 votes)
140 views2 pages

Bascom Avr

The document discusses the Universal Serial Interface (USI) which is a hardware resource that provides the basics for various serial communications. It can be used in two-wire or three-wire modes for I2C or SPI communication respectively. The document provides an example of using the USI in SPI master mode on an ATtiny microcontroller and configuring the ports to transmit and receive data.

Uploaded by

wawanUAI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
140 views2 pages

Bascom Avr

The document discusses the Universal Serial Interface (USI) which is a hardware resource that provides the basics for various serial communications. It can be used in two-wire or three-wire modes for I2C or SPI communication respectively. The document provides an example of using the USI in SPI master mode on an ATtiny microcontroller and configuring the ports to transmit and receive data.

Uploaded by

wawanUAI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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