2015-03-26 03:58 AM
i am a beginner in microcontroller coding i was playing with fatFS recently, i wrote a loop to continuously write 0x1234578 in hex form in file but from file i am geting output as
78 56 34 12 78 56 34 12i know that this is because of endian mismatch and there is a statement#define __REV __rev in file core_cmInstr.h but i didn't know how and where to use it directly to change endian typei am writing data in a variable named as buffer before writing to file on cardfollowing is the loop i usefor (kk = 0; kk < size; kk++ ){ buffer[kk] = 0x12345678; } should i use __rev in loop ? when i try to use it by asm('__rev') keil returns error.. plz help2015-03-26 05:31 AM
for (kk = 0; kk < size; kk++ )
{
buffer[kk] = __rev(0x12345678);
}
You could always write the buffer in a byte wise fashion too.