新手上路
- 积分
- 39
- 金钱
- 39
- 注册时间
- 2016-8-31
- 在线时间
- 10 小时
|

楼主 |
发表于 2017-1-23 16:20:10
|
显示全部楼层
void TIM3_IRQHandler(void)
{
static float temp;
static UINT bw; /* ????????????? */
static FRESULT ress;
static FIL file;
static unsigned char buf[482]="";
static char zh[6];
static u8 i=0;
if (TIM_GetITStatus(TIM3, TIM_IT_Update) != RESET)
{
temp=(float)ADC_ConvertedValue*(3.3/4096);
printf("%.3f ",temp);
sprintf(zh,"%.3f",temp);
strcat(buf,zh);
strcat(buf," ");
i++;
if(i>=80){
ress = f_open(&file, "0:/data.txt",FA_OPEN_ALWAYS|FA_READ|FA_WRITE );
if ( ress == FR_OK )
{
ress = f_lseek(&file,file.fsize);
ress = f_write(&file, buf, sizeof(buf), &bw);
f_close(&file);
i=0;
}
memset(buf,0,sizeof(buf));
}
TIM_ClearITPendingBit(TIM3, TIM_IT_Update );
}
}
这个就是中断函数 |
|