求教 请问怎么将传感器得到的数值(计算后为float型)连续不断的发送到sd卡的txt中

[复制链接]
270|0
 楼主| 电子学长 发表于 2019-11-13 17:36 | 显示全部楼层 |阅读模式
已经调了一天多,还是没有结果,我是先建立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);        
  }
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

424

主题

447

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部