Hi cemath,
Thanks for the reply. THe code which I edited in the SdFatRead Example is
int16_t n;
char msg;
uint8_t buf[7];// nothing special about 7, just a lucky number.
while ((n = file.read(buf, sizeof(buf))) > 0)
{
for(uint8_t i=0;i < n;i++)
msg = (char)buf[i];
Serial.print(msg);
}
Serial.println("\nDone");
I am trying to read the file contents , convert them to char type from uint8_t type.
The file which I am trying to read from SD card is the GPSLOG00.TXT . the file contains GPS sentences logged into a text file from GPS.
The contents are
$GPRMC,112209.290,A,1307.3214,N,08013.3322,E,,,030510,,*0D
$GPRMC,112210.290,A,1307.3089,N,08013.3367,E,,,030510,,*02
$GPRMC,112211.290,A,1307.3299,N,08013.3306,E,,,030510,,*07
$GPRMC,112212.290,A,1307.3512,N,08013.3207,E,,,030510,,*00
$GPRMC,112213.290,A,1307.3630,N,08013.3141,E,,,030510,,*03
$GPRMC,112214.290,A,1307.3468,N,08013.3262,E,,,030510,,*09
$GPRMC,112215.290,A,1307.3531,N,08013.3234,E,,,030510,,*06
$GPRMC,112216.290,A,1307.3595,N,08013.3207,E,,,030510,,*0B
$GPRMC,112217.290,A,1307.3534,N,08013.3249,E,,,030510,,*0B
$GPRMC,112218.290,A,1307.3502,N,08013.3273,E,,,030510,,*08
$GPRMC,112219.290,A,1307.3489,N,08013.3282,E,,,030510,,*05
$GPRMC,112220.290,A,1307.3705,N,08013.3196,E,,,030510,,*0E
$GPRMC,112221.290,A,1307.3383,N,08013.3295,E,,,030510,,*05
$GPRMC,112222.290,A,1307.3405,N,08013.3251,E,,,030510,,*07
$GPRMC,112223.290,A,1307.3420,N,08013.3292,E,,,030510,,*0E
$GPRMC,112224.290,A,1307.3526,N,08013.3229,E,,,030510,,*0E
$GPRMC,112225.290,A,1307.3553,N,08013.3228,E,,,030510,,*0C
$GPRMC,112226.290,A,1307.3535,N,08013.3259,E,,,030510,,*09
$GPRMC,112227.290,A,1307.3417,N,08013.3269,E,1.42,312.24,030510,,*0B
$GPRMC,112228.000,A,1307.3425,N,08013.3270,E,0.33,308.80,030510,,*04
$GPRMC,112229.000,A,1307.3422,N,08013.3278,E,0.04,240.51,030510,,*0F
$GPRMC,112230.000,A,1307.3417,N,08013.3283,E,0.23,173.43,030510,,*00
$GPRMC,112231.000,A,1307.3416,N,08013.3285,E,0.34,164.87,030510,,*0E
$GPRMC,112232.000,A,1307.3413,N,08013.3285,E,0.53,166.36,030510,,*01
$GPRMC,112233.000,A,1307.3410,N,08013.3286,E,0.63,159.12,030510,,*09
$GPRMC,112234.000,A,1307.3406,N,08013.3288,E,0.72,157.94,030510,,*07
$GPRMC,112235.000,A,1307.3404,N,08013.3290,E,0.78,157.79,030510,,*04
$GPRMC,112236.000,A,1307.3400,N,08013.3295,E,1.01,158.20,030510,,*0A
$GPRMC,112237.000,A,1307.3394,N,08013.3298,E,0.58,151.13,030510,,*08
$GPRMC,112238.000,A,1307.3391,N,08013.3302,E,0.23,124.27,030510,,*09
$GPRMC,112239.000,A,1307.3392,N,08013.3305,E,0.23,144.30,030510,,*0C
$GPRMC,112240.000,A,1307.3393,N,08013.3306,E,0.19,0.60,030510,,*0D
$GPRMC,112241.000,A,1307.3391,N,08013.3308,E,0.55,344.99,030510,,*0D
$GPRMC,112242.000,A,1307.3393,N,08013.3309,E,0.65,346.12,030510,,*0F
$GPRMC,112243.000,A,1307.3391,N,08013.3311,E,0.58,327.75,030510,,*0D
$GPRMC,112244.000,A,1307.3392,N,08013.3312,E,0.31,315.15,030510,,*02
$GPRMC,112245.000,A,1307.3390,N,08013.3311,E,0.43,334.94,030510,,*0D
$GPRMC,112246.000,A,1307.3393,N,08013.3305,E,0.45,322.00,030510,,*04
$GPRMC,112247.000,A,1307.3396,N,08013.3301,E,0.76,330.60,030510,,*01
$GPRMC,112248.000,A,1307.3397,N,08013.3297,E,0.27,314.78,030510,,*0A
$GPRMC,112249.000,A,1307.3400,N,08013.3295,E,0.36,20.55,030510,,*3B
$GPRMC,112250.000,A,1307.3400,N,08013.3290,E,0.29,263.99,030510,,*0D
$GPRMC,112251.000,A,1307.3397,N,08013.3288,E,0.48,229.59,030510,,*09
$GPRMC,112252.000,A,1307.3398,N,08013.3284,E,0.41,316.03,030510,,*02
$GPRMC,112253.000,A,1307.3398,N,08013.3280,E,0.80,313.98,030510,,*0D
$GPRMC,112254.000,A,1307.3401,N,08013.3277,E,1.11,318.17,030510,,*00
$GPRMC,112255.000,A,1307.3403,N,08013.3274,E,1.02,322.50,030510,,*08
$GPRMC,112256.000,A,1307.3406,N,08013.3268,E,0.51,310.56,030510,,*03
$GPRMC,112257.000,A,1307.3405,N,08013.3265,E,0.20,172.19,030510,,*07
$GPRMC,112258.000,A,1307.3405,N,08013.3265,E,0.25,131.33,030510,,*02
$GPRMC,112259.000,A,1307.3405,N,08013.3263,E,0.50,286.05,030510,,*0D
$GPRMC,112300.000,A,1307.3405,N,08013.3263,E,0.43,318.18,030510,,*08
$GPRMC,112301.000,A,1307.3406,N,08013.3262,E,0.14,166.60,030510,,*0D
$GPRMC,112302.000,A,1307.3403,N,08013.3263,E,0.23,93.57,030510,,*31
$GPRMC,112303.000,A,1307.3400,N,08013.3267,E,0.58,150.75,030510,,*05
$GPRMC,112304.000,A,1307.3396,N,08013.3268,E,0.73,157.31,030510,,*0B
$GPRMC,112305.000,A,1307.3395,N,08013.3270,E,0.23,144.14,030510,,*00
$GPRMC,112306.000,A,1307.3395,N,08013.3272,E,0.21,139.18,030510,,*05
$GPRMC,112307.000,A,1307.3393,N,08013.3272,E,0.28,356.23,030510,,*08
$GPRMC,112308.000,A,1307.3391,N,08013.3272,E,0.12,3.89,030510,,*0F
$GPRMC,112309.000,A,1307.3390,N,08013.3273,E,0.15,342.02,030510,,*0C
$GPRMC,112310.000,A,1307.3388,N,08013.3272,E,0.03,14.17,030510,,*3F
$GPRMC,112311.000,A,1307.3388,N,08013.3272,E,0.51,352.24,030510,,*08
$GPRMC,112312.000,A,1307.3389,N,08013.3272,E,0.43,339.14,030510,,*07
$GPRMC,112313.000,A,1307.3389,N,08013.3272,E,0.11,290.20,030510,,*04
$GPRMC,112314.000,A,1307.3388,N,08013.3270,E,0.21,235.81,030510,,*07
$GPRMC,112315.000,A,1307.3388,N,08013.3270,E,0.17,241.13,030510,,*0B
$GPRMC,112316.000,A,1307.3386,N,08013.3272,E,0.18,122.90,030510,,*06
$GPRMC,112317.000,A,1307.3385,N,08013.3275,E,0.25,29.10,030510,,*3F
$GPRMC,112318.000,A,1307.3385,N,08013.3277,E,0.07,201.14,030510,,*0E
$GPRMC,112319.000,A,1307.3385,N,08013.3278,E,0.48,0.37,030510,,*09
$GPRMC,112320.000,A,1307.3385,N,08013.3281,E,0.40,346.95,030510,,*04
$GPRMC,112321.000,A,1307.3387,N,08013.3281,E,0.78,340.65,030510,,*05
$GPRMC,112322.000,A,1307.3388,N,08013.3282,E,0.23,328.18,030510,,*00
$GPRMC,112323.000,A,1307.3388,N,08013.3283,E,0.79,341.04,030510,,*0D
$GPRMC,112324.000,A,1307.3389,N,08013.3282,E,0.48,321.94,030510,,*07
$GPRMC,112325.000,A,1307.3390,N,08013.3280,E,0.11,297.44,030510,,*01
$GPRMC,112326.000,A,1307.3390,N,08013.3275,E,0.27,211.88,030510,,*03
$GPRMC,112327.000,A,1307.3389,N,08013.3270,E,0.43,291.88,030510,,*05
$GPRMC,112328.000,A,1307.3388,N,08013.3266,E,0.57,203.58,030510,,*0F
$GPRMC,112329.000,A,1307.3386,N,08013.3265,E,0.12,265.01,030510,,*0E
$GPRMC,112330.000,A,1307.3389,N,08013.3261,E,0.10,192.25,030510,,*02
$GPRMC,112331.000,A,1307.3391,N,08013.3259,E,0.37,338.75,030510,,*03
$GPRMC,112332.000,A,1307.3392,N,08013.3257,E,0.36,345.45,030510,,*05
$GPRMC,112333.000,A,1307.3392,N,08013.3256,E,0.19,286.73,030510,,*03
$GPRMC,112334.000,A,1307.3395,N,08013.3254,E,0.52,327.34,030510,,*07
$GPRMC,112335.000,A,1307.3395,N,08013.3253,E,0.21,248.92,030510,,*01
$GPRMC,112336.000,A,1307.3395,N,08013.3252,E,0.21,301.84,030510,,*08
$GPRMC,112337.000,A,1307.3395,N,08013.3252,E,0.09,264.22,030510,,*0D
$GPRMC,112338.000,A,1307.3396,N,08013.3252,E,0.16,346.95,030510,,*02
$GPRMC,112339.000,A,1307.3397,N,08013.3252,E,0.11,277.62,030510,,*0E
$GPRMC,112340.000,A,1307.3396,N,08013.3252,E,0.31,346.83,030510,,*0F
$GPRMC,112341.000,A,1307.3394,N,08013.3253,E,0.23,330.10,030510,,*05
$GPRMC,112342.000,A,1307.3394,N,08013.3254,E,0.20,327.85,030510,,*08
$GPRMC,112343.000,A,1307.3392,N,08013.3255,E,0.12,193.25,030510,,*08
$GPRMC,112344.000,A,1307.3391,N,08013.3256,E,0.29,347.05,030510,,*0E
$GPRMC,112345.000,A,1307.3389,N,08013.3257,E,0.40,340.46,030510,,*08
$GPRMC,112346.000,A,1307.3388,N,08013.3258,E,0.20,327.57,030510,,*02
$GPRMC,112347.000,A,1307.3388,N,08013.3258,E,0.35,339.64,030510,,*08
$GPRMC,112348.000,A,1307.3389,N,08013.3259,E,0.13,322.44,030510,,*0B
$GPRMC,112349.000,A,1307.3389,N,08013.3260,E,0.08,272.78,030510,,*01
$GPRMC,112350.000,A,1307.3388,N,08013.3260,E,0.12,204.95,030510,,*01
$GPRMC,112351.000,A,1307.3387,N,08013.3261,E,0.05,209.98,030510,,*08
When I uploaded the code , The serial monitor contents are,
Opened GPSLOG00.TXT
,.11023*R2,.,3,0$12391,00M1A302,,G190,3E53C4,4860,P207N.,1
,.19073*R2,.,3,0$12321,00M1A302,,G190,3E5EC1,3890,P207N.,1
,.12023*R2,.,3,0$12331,00M2A302,,G190,3E30,P207N.,03*R2,.,30000M3A302..50C1,488381
,.1105360$10301,,,,G100,3E10,P207N.,53*R2,.,31800M3A302..58C8,380221
,.1905300$10331,,3*R2,.,30400M4A303..5FC3,381571
,.1902150$10301,,,,G100,3E30,P207N.,33*R2,.,30400M4A302.51
,.1000990$10371,,,,G100,3E30,P207N.,13*R2,.,31800M5A302..58C6,486551
,.1005090$10351,,,,G100,3E20,P207N.,13*R3,.,30600M0A302.51
,.1007850$10361,,,,G100,3E10,P207N.,33*R3,.,30600M0A302.90$10301,,,,G100,3E13*R3,.,30200M1A302..57C3,387121
,.1800110$10381,,,,G100,3E10,P207N.,903M1A302..5EC9,3874,,G100,3E30,P207N.,43*R3,.,30800M2A302..5DC4,388491
,.1900140$10301,,,,G100,3E20,P207N.,03*R3,.,30500M3A302..52C1,385371
,.1907650$10321,,,,G100,3E30,P207N.,43*R3,.,30100M3A302..5DC8,385191
,.1902120$10361,,,,G100,3E30,P207N.,23*R3,.,30300M4A302..5EC5,385441
,.1808070$10381,,,,G100,3E30,P207N.,73*R3,.,30400M5A302..58C2,386241
,.1807940$10311,,0,P207N.,.5FC6,387180$10381,,3*R3,.,30.5FC9,388160$10371,,,,G100,3E10,P207N.,63*R4,.,30700M0A302..5BC5,389131
,.1603360$10311,,,,G100,3E10,P207N.,903M1A303..58C1,380401
,.1604860$10301,,0,P207N.,53*R4,.,30.52C6,380430$10331,,0,P207N.,73*R4,.,30.5FC0,380121
,.1601750$10311,,,,G100,3E10,P207N.,33*R4,.,30800M2A303.71
,.15093,,G100,3E10,
Done
The contents in the serial monitor are of different format [ I think its of HEX type]
and the full contents are also not fully converted and displayed in the serial monitor. Please help me out and tell me where I made wrong in the code. I also need to convert the full contents into char, since the log file is very huge.
Thanks in advance
N.Nandhakumar