您的位置 首页 5G

at45db161驱动

unsignedcharAT45DBXX_STATUS(void){unsignedchartemp;spi_cs(0);SPI_Send_Data(0Xd7);temp=SPI_

unsigned char AT45DBXX_STATUS(void)

{unsigned char temp;spi_cs(0);SPI_Send_Data(0Xd7);temp =  SPI_Send_Data(0Xff);spi_cs(1);return temp; //bit7 0=busy  bit6 1=Compare// bit1 1=PROTECT bit0 0=528byte 1=512byte}unsigned char AT45XX_ID(void){unsigned char temp;spi_cs(0);SPI_Send_Data(0X9F);temp=SPI_Send_Data(0xff);temp=SPI_Send_Data(0xff);spi_cs(1);return temp;}void ContinuousArrayLowRead(unsigned int page,unsigned int addrs,unsigned char *dat,unsigned int lenght){spi_cs(0);SPI_Send_Data(0X03);page<<=1;if(addrs&0x100)page=page+1;SPI_Send_Data((page>>8));SPI_Send_Data(page);SPI_Send_Data(addrs);while(lenght){*dat = SPI_Send_Data(0Xff);dat++;lenght--;}spi_cs(1);}void Buffer1ToMainWithErase(unsigned int page){spi_cs(0);SPI_Send_Data(0X83);SPI_Send_Data((page>>7));SPI_Send_Data(page<<1);SPI_Send_Data(0x00);spi_cs(1);}void AT45Buffer1Write(unsigned int addrs,unsigned char *dat,unsigned int lenght){spi_cs(0);SPI_Send_Data(0X84);SPI_Send_Data(0x00);SPI_Send_Data(addrs>>8);SPI_Send_Data(addrs);while(lenght){SPI_Send_Data(*dat);dat++;lenght--;}spi_cs(1);}void AT45Buffer1Read(unsigned int addrs,unsigned char *dat,unsigned int lenght){spi_cs(0);SPI_Send_Data(0Xd1);SPI_Send_Data(0x00);SPI_Send_Data(addrs>>8);SPI_Send_Data(addrs);while(lenght){*dat = SPI_Send_Data(0xff);dat++;lenght--;}spi_cs(1);}void MainToBuffer1AT45(unsigned int page){spi_cs(0);SPI_Send_Data(0X53);SPI_Send_Data((page>>7));SPI_Send_Data(page<<1);SPI_Send_Data(0x00);spi_cs(1);}void Buffer2ToMainWithErase(unsigned int page){spi_cs(0);SPI_Send_Data(0X86);SPI_Send_Data((page>>7));SPI_Send_Data(page<<1);SPI_Send_Data(0x00);spi_cs(1);}				   

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/yingyong/5g/255624.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部