Data Reading from the SD CARD

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Data Reading from the SD CARD

542 Views
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 

 

Tags (1)
0 Kudos
3 Replies

486 Views
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 Kudos

468 Views
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 Kudos

523 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @Shashi_ranjan_14 ,

You can use a float pointer to do this.

 

Regards,

Jing

0 Kudos