cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

mrdh_1212961
New Contributor

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
Reply
1 Solution
JoMe_264151
Expert II

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
Reply
8 Replies
JoMe_264151
Expert II

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

   

 

   

Bob

0 Likes
Reply
mrdh_1212961
New Contributor

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
Reply
JoMe_264151
Expert II

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
Reply
mrdh_1212961
New Contributor

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
Reply
JoMe_264151
Expert II

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

mrdh_1212961
New Contributor

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
Reply
mrdh_1212961
New Contributor

hope this time i have explained the requirement to you. 

0 Likes
Reply
JoMe_264151
Expert II

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