新手上路
- 积分
- 44
- 金钱
- 44
- 注册时间
- 2016-6-27
- 在线时间
- 14 小时
|
5金钱
void Write_SD_Inf_Name(void)
{
//»ñè¡RTC ê±¼ä ×a3é×Ö·û′® ×¼±¸Ãüáî.txt
FRESULT result;
FATFS fs;
FIL file;
DIR DirInf;
uint32_t bw ;
uint8_t buf[200];
OS_ERR err;
Copy_Inf_Buf(buf);
/* 1òÔØÎļtÏμí3 */
result = f_mount(0, &fs); /* Mount a logical drive */
if (result != FR_OK)
{
}
/* ′ò¿a¸ùÎļt¼D */
result = f_opendir(&DirInf, "/"); /* èç1û2»′ø2Îêy£¬Ôò′óμ±Ç°Ä¿Â¼¿aê¼ */
if (result != FR_OK)
{
return;
}
/* ′ò¿aÎļt */
//result = f_open(&file, "Config.txt", FA_OPEN_ALWAYS | FA_WRITE); //FA_OPEN_ALWAYS
result = f_open(&file, "160712.txt", FA_WRITE);
if (result == FR_NO_FILE)
{
result = f_open(&file, "160712.txt", FA_WRITE|FA_CREATE_NEW );
result = f_write(&file, buf, 154, &bw);
}
//f_lseek(&file,f_size(&file));
if (result == FR_OK)
{
}
else
{
}
/* 1رÕÎļt*/
f_close(&file);
f_mount(0, NULL);
}
这是我的SD卡写入程序,为什么在任务中只要调用它程序就死机了呢,求解决办法
|
|