已经调了一天多,还是没有结果,我是先建立txt文本文档,再利用f_write()将数值写进去,但是不对。。
代码如下
int main (void)
{
USART1_Config();
I2C_Config();
Gonfig_ADXL345();
SDIO_NVIC_Config();
/* Register work area for each volume (Always succeeds regardless of disk status) */
f_mount(0,&fs);
/* function disk_initialize() has been called in f_open */
/* Create new file on the drive 0 */
res = f_open(&fnew, "0:newfile.txt", FA_CREATE_ALWAYS | FA_WRITE );
SD_SingleBlockTransmit();
/* Unregister work area prior to discard it */
f_mount(0, NULL);
while (1)
{
}
}
void SD_SingleBlockTransmit(void)
{
Fill_Buffer(Buffer_Block_Tx, BLOCK_SIZE, 0x00);
if (res == FR_OK)
{
res = f_write(&fnew, Fill_Buffer, 512, &bw);
f_close(&fnew);
}
} |