赞
踩
这里是单片机做主机,FPGA做从机
在此之前,先介绍基本的读写函数spi_wr_32bit_MSB_first(B1,B2,B3,B4) 和spi_wr_1bit_cmd_read_16bit()
void spi_wr_32bit_MSB_first(unsigned char B3,unsigned char B2,unsigned char B1,unsigned char B0){ int i = 0, j = 0; unsigned char byte4[4] = { 0}; unsigned char buf = 0; byte4[3] = B3; byte4[2] = B2; byte4[1] = B1; byte4[0] = B0; spi_wr_cs(1); spi_wr_sck(1); spi_wr_sda_out(1); // drop down cs spi_wr_cs(0); Delay(1); // drop down sck spi_wr_sck(0); Delay(1); // put data for(j = 0; j < 4; j ++){ buf = byte4[3-j]; for(i = 0; i < 8; i ++){ spi_wr_sda_out(
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。