Regarding SD card interface

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
mrdh_1212961
Level 1
Level 1

Assume there is hex file name test.txt saved in SD card. File data is like 0A 23 43 .............

   

I would like to read all the codes throgh em componet. Pls assist me how can this activity perform.

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

File is file, there is no difference.

   

You just need to open the file and retrieve the information stored within. Different from windows OS there are no assumptions regarding the file extension.

   

 

   

Bob

View solution in original post

0 Likes
8 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Right click on the emfile component and select "find code example"

   

 

   

Bob

0 Likes

that example i have gone through, but the requirement is different. I need to read code file stored in SD card with extension .txt and wrote with hex characters.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

File is file, there is no difference.

   

You just need to open the file and retrieve the information stored within. Different from windows OS there are no assumptions regarding the file extension.

   

 

   

Bob

0 Likes

Understood, but the fundamental question is still like this:

   

For ex. if file contains ABCD.... like texts, i understands that microcontroller reads this in ascii code

   

But if the file contails hex numbers like 0A, BA, FF ........then what shall it be read? ascii of 0, ascii of A or ........

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

For ex. if file contains ABCD.... like texts, the µC will read 0x41, 0x42, 0x43, 0x44...

   

The interpretation that this might represent the characters 'A' to 'D' is only yours.

   

 

   

Bob

understood but what shall i will read if the file itself contains 0x0A, 0x0B or even 0x41, 0x42 etc instead of ABCD......... My aim is to read the same hex code saved in text file to psoc3

0 Likes
mrdh_1212961
Level 1
Level 1

hope this time i have explained the requirement to you. 

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You will always read the same hex code. I try to explain to you that a file is just a stream of hexadecimal data organized in bytes. The interpretation what the data stand for (Text, ASCII, UTF-8, float numbers) happens after the reading.

   

 

   

Bob