ATmega16M1 Automotive Atmel Corporation, ATmega16M1 Automotive Datasheet - Page 125

no-image

ATmega16M1 Automotive

Manufacturer Part Number
ATmega16M1 Automotive
Description
Manufacturer
Atmel Corporation

Specifications of ATmega16M1 Automotive

Flash (kbytes)
16 Kbytes
Pin Count
32
Max. Operating Frequency
16 MHz
Cpu
8-bit AVR
# Of Touch Channels
12
Hardware Qtouch Acquisition
No
Max I/o Pins
27
Ext Interrupts
27
Usb Speed
No
Usb Interface
No
Spi
1
Uart
1
Can
1
Lin
1
Graphic Lcd
No
Video Decoder
No
Camera Interface
No
Adc Channels
11
Adc Resolution (bits)
10
Adc Speed (ksps)
125
Analog Comparators
4
Resistive Touch Screen
No
Dac Channels
1
Dac Resolution (bits)
10
Temp. Sensor
Yes
Crypto Engine
No
Sram (kbytes)
1
Eeprom (bytes)
512
Self Program Memory
YES
Dram Memory
No
Nand Interface
No
Picopower
No
Temp. Range (deg C)
-40 to 150
I/o Supply Class
2.7 to 5.5
Operating Voltage (vcc)
2.7 to 5.5
Fpu
No
Mpu / Mmu
no / no
Timers
2
Output Compare Channels
14
Input Capture Channels
1
Pwm Channels
10
32khz Rtc
No
Calibrated Rc Oscillator
Yes
16.3.2
7701E–AVR–02/11
SPI Master Operation Example
The following code demonstrates how to use the USI module as a SPI Master:
The code is size optimized using only eight instructions (+ ret). The code example assumes
that the DO and USCK pins are enabled as output in the DDRE register. The value stored in
register r16 prior to the function being called is transferred to the slave device, and when the
transfer is completed, the data received from the slave is stored back into the r16 register.
The second and third instructions clear the USI counter overflow flag and the USI counter
value. The fourth and fifth instructions set the three-wire mode, positive edge shift register
clock, count at USITC strobe, and toggle USCK. The loop is repeated 16 times.
The following code demonstrates how to use the USI module as an SPI master with maximum
speed (f
SPITransfer:
SPITransfer_loop:
SPITransfer_Fast:
out
ldi
out
ldi
out
in
sbrs
rjmp
in
ret
out
ldi
ldi
out
out
out
out
out
out
out
out
out
out
out
out
out
out
out
sck
= f
ck
/4):
USIDR,r16
r16,(1<<USIOIF)
USISR,r16
r16,(1<<USIWM0)|(1<<USICS1)|(1<<USICLK)|(1<<USITC)
USICR,r16
r16, USISR
r16, USIOIF
SPITransfer_loop
r16,USIDR
USIDR,r16
r16,(1<<USIWM0)|(0<<USICS0)|(1<<USITC)
r17,(1<<USIWM0)|(0<<USICS0)|(1<<USITC)|(1<<USICLK)
USICR,r16 ; MSB
USICR,r17
USICR,r16
USICR,r17
USICR,r16
USICR,r17
USICR,r16
USICR,r17
USICR,r16
USICR,r17
USICR,r16
USICR,r17
USICR,r16
USICR,r17
USICR,r16 ; LSB
Atmel ATtiny24/44/84 [Preliminary]
125

Related parts for ATmega16M1 Automotive