Data Reading from the SD CARD

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Data Reading from the SD CARD

521件の閲覧回数
Shashi_ranjan_14
Contributor II

Hello all,

I want to read data from an SD card. I can read the display, but they only print the "char" value. Can anyone teach me how to read a float or decimal value and print it? now i am using imxrt1050 board using mcuXpresso.

Thanks 

 

iMXRT1050 @nxp @IMXRT1050 

 

タグ(1)
0 件の賞賛
3 返答(返信)

465件の閲覧回数
Shashi_ranjan_14
Contributor II

We successfully write on the SD card and read from the SD card, while reading from SD card we were able get data via "char" only. To get the data we are receiving by using sprintf and fscanf function.

In SD card file we have provided integer data and we want to read data such as double and float.

 

For above technical support u provide solution as use float pointer for that can provide a example to execute?

 

0 件の賞賛

447件の閲覧回数
jingpan
NXP TechSupport
NXP TechSupport

Hi @Shashi_ranjan_14 ,

Like these code

    char ch;
    float *p;
    char data[4];
    float i=3.14159;
    char *pd;
    PRINTF("%f\r\n",i);
    pd = (char*)&i;
    for(ch=0;ch<4;ch++)
    	data[ch]=*pd++;

    p=(float*)&data[0];
    PRINTF("%f\r\n",*p);

https://community.nxp.com/t5/i-MX-RT/How-to-print-the-quot-negative-float-point-number-quot-to-show/...

Regards,

Jing

0 件の賞賛

502件の閲覧回数
jingpan
NXP TechSupport
NXP TechSupport

Hi @Shashi_ranjan_14 ,

You can use a float pointer to do this.

 

Regards,

Jing

0 件の賞賛