⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 slave.c

📁 ADuC系列芯片的源代码事例
💻 C
字号:
/*********************************************************************

 Author        : ADI - Apps            www.analog.com/MicroConverter

 Date          : Dec. 2005

 File          : slave.c

 Hardware      : Applicable to ADuC702x rev H or I silicon
                 Currently targetting ADuC7026.

 Description   : SPI slave is to use with master.c or master1.c
 				 the slaves receives values from the master and
				 keeps transmitting '0' as it is the default value at reset.
		
*********************************************************************/



#include<ADuC7026.h>


int main(void) {
char i;	
char received_data[30];

	GP1CON = 0x22220000;				// configure SPI on SPM
	SPICON = 0x1409;					// enable SPI slave mode
	

for (i=0; i <30; i++) {
 	while (!(SPISTA & 0x08)) ; 			// wait for data in the RX MMR
	received_data[i] = SPIRX;			// read data and clear bit 4 of SPISTA
	}
while (1) {

	}			
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -