欢迎访问ic37.com |
会员登录 免费注册
发布采购

ATMEGA16M1-15MZ 参数 Datasheet PDF下载

ATMEGA16M1-15MZ图片预览
型号: ATMEGA16M1-15MZ
PDF下载: 下载PDF文件 查看货源
内容描述: [IC MCU 8BIT 16KB FLASH 32QFN]
分类和应用: 微控制器
文件页数/大小: 318 页 / 7595 K
品牌: MICROCHIP [ MICROCHIP ]
 浏览型号ATMEGA16M1-15MZ的Datasheet PDF文件第132页浏览型号ATMEGA16M1-15MZ的Datasheet PDF文件第133页浏览型号ATMEGA16M1-15MZ的Datasheet PDF文件第134页浏览型号ATMEGA16M1-15MZ的Datasheet PDF文件第135页浏览型号ATMEGA16M1-15MZ的Datasheet PDF文件第137页浏览型号ATMEGA16M1-15MZ的Datasheet PDF文件第138页浏览型号ATMEGA16M1-15MZ的Datasheet PDF文件第139页浏览型号ATMEGA16M1-15MZ的Datasheet PDF文件第140页  
The following code examples show how to initialize the SPI as a Slave and how to perform a simple reception.  
Assembly Code Example(1)  
SPI_SlaveInit:  
; Set MISO output, all others input  
ldi  
out  
r17,(1<<DD_MISO)  
DDR_SPI,r17  
; Enable SPI  
ldi  
out  
ret  
r17,(1<<SPE)  
SPCR,r17  
SPI_SlaveReceive:  
; Wait for reception complete  
sbis  
rjmp  
SPSR,SPIF  
SPI_SlaveReceive  
; Read received data and return  
in  
r16,SPDR  
ret  
C Code Example(1)  
void SPI_SlaveInit(void)  
{
/* Set MISO output, all others input */  
DDR_SPI = (1<<DD_MISO);  
/* Enable SPI */  
SPCR = (1<<SPE);  
}
char SPI_SlaveReceive(void)  
{
/* Wait for reception complete */  
while(!(SPSR & (1<<SPIF)))  
;
/* Return data register */  
return SPDR;  
}
Note:  
1. The example code assumes that the part specific header file is included.  
136  
ATmega16/32/64/M1/C1 [DATASHEET]  
7647O–AVR–01/15  
 复制成功!