新聞中心

at45db161驅(qū)動

作者: 時間:2016-11-29 來源:網(wǎng)絡(luò) 收藏
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);}				   
				
            
                
			
							
上一頁 1 2 下一頁

關(guān)鍵詞: at45db161驅(qū)

評論


技術(shù)專區(qū)

關(guān)閉