#include "led.h"
#include "delay.h"
#include "key.h"
#include "sys.h"
#include "lcd.h"
#include "adxl345.h"
#include "usart.h"
#include "sram.h"
#include "malloc.h"
#include "string.h"
#include "mmc_sd.h"
#include "rtc.h"
#include "ff.h"
#include "exfuns.h"
#include "usmart.h"
#include "math.h"
#include "beep.h"
int main(void)
{
FIL f_txt;
FRESULT res;
char *name //??????
short x,y,z; //???á??????
short angx,angy,angz; //??????
delay_init(); //???±??????????
NVIC_Configuration(); //?è??NVIC????·?×é2:2??????????????2???ì????????
uart_init(9600); //?®??????????9600
LED_Init(); //LED??????????
LCD_Init();
BEEP_Init();
KEY_Init();
RTC_Init(); //RTC??????
ADXL345_Init();
exfuns_init();
usmart_dev.init(72);
mem_init(SRAMIN); //??fatfs?à??±????ê??????
sprintf((char*)name,"%d:%d.txt",calendar.min,calendar.sec);
POINT_COLOR=RED;//????????????????
LCD_ShowString(60,50,200,16,16,"2015/10/23");
while(SD_Initialize()) //?ì??SD?¨
{
LCD_ShowString(60,70,200,16,16,"SD Card Error!");
delay_ms(200);
LCD_Fill(60,70,240,150+16,WHITE);//????????
delay_ms(200);
LED0=!LED0;//DS0????
}
exfuns_init(); //??fatfs?à??±????ê??????
f_mount(0,fs[0]); //????SD?¨
f_mount(1,fs[1]); //????FLASH.
while(1)
{
//????X,Y,Z?á??????????(??????)
ADXL345_Read_Average(&x,&y,&z,10); //????X,Y,Z????·??ò??????????
angx=ADXL345_Get_Angle(x,y,z,1);
angy=ADXL345_Get_Angle(x,y,z,2);
angz=ADXL345_Get_Angle(x,y,z,0);
res=f_open(&f_txt,(const TCHAR*)name,FA_OPEN_ALWAYS | FA_WRITE); //???¨/?ò?????±??????×???txt????
if(res==0) //??txt???????¨?????òres·???0
{
f_lseek(&f_txt,f_txt.fsize); //????????
f_printf(&f_txt,"%d,%d,%d*%d,%d,%d/",x,y,z,angx,angy,angz); //??????????????SD?¨??
f_close(&f_txt); //??±?????
}
LED1=!LED1;
}
}
我想用时间作为文件名,可是无法新建文件。 求解。。。
---------------------------------
根据返回值res的值判断问题点.
我也遇到了这个问题,请问是怎么解决的?
一周热门 更多>