//读取数据,保存在DF_buffer[]数组中
void M25P80_buf_ToRam(unsigned char buffer,unsigned int start_address,unsigned int length)
{
unsigned int i;
FlashWaitBusy(); //Flash忙检测
Select_Flash();//CS置"0"
SPI_Flash_SendByte(0X03);// 读数据
SPI_Flash_SendByte((start_address & 0xFF0000) >> 16);
SPI_Flash_SendByte((start_address & 0xFF00) >> 8);
SPI_Flash_SendByte(start_address & 0xFF);
for (i=0;i<length;i++)
{
AT45_buffer = SPI_Flash_ReadByte();
}
NotSelect_Flash();//CS置"1"
}
//将DF_buffer[]数组中指定长度的数据写入
void M25P16_RamTo_buf(unsigned char buffer,unsigned int start_address,unsigned int length)
{
unsigned int i;
FlashPageEarse(0X01); //擦除指定的页,页范围0-4095
FlashWaitBusy();//Flash忙检测
Select_Flash(); //CS置"0"
SPI_Flash_SendByte(0X06); //写使能
NotSelect_Flash(); //CS置"1"
FlashWaitBusy();//Flash忙检测
Select_Flash(); //CS置"0"
SPI_Flash_SendByte(0X02); //页写
SPI_Flash_SendByte((start_address & 0xFF0000) >> 16);
SPI_Flash_SendByte((start_address & 0xFF00) >> 8);
SPI_Flash_SendByte(start_address & 0xFF);
for (i=0;i<length;i++)
SPI_Flash_SendByte(AT45_buffer);
NotSelect_Flash();
}
如何理解unsigned char buffer这个参数
|