cancel
Showing results for 
Search instead for 
Did you mean: 

I'm trying to write eeprom to 32-bit variable

kemal
Associate II
Posted on April 19, 2015 at 15:58

How do I assign the variables a1 and a2 x ?

I want to read the typed value

unsigned long x; //readings value
unsigned long a; //value 
unsigned int a1; //values written
unsigned int a2; //values written
a=40000000; 
a1=a/65536;
a2=a%65536;
//x=a1; //that does not happen
//x=a2; //that does not happen
//x=a1+a2; //that does not happen

2 REPLIES 2
Posted on April 19, 2015 at 16:40

How would adding one number you just divided by 65536 ever get you back to the original number?

unsigned long x;
x=((unsigned long)a1 << 16)+(unsigned long)a2;

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
kemal
Associate II
Posted on April 19, 2015 at 18:44

Thank you very much

understood

http://s4.postimg.org/6p1k6qckt/image.jpg