I'm trying to write eeprom to 32-bit variable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-04-19 6:58 AM
Posted on April 19, 2015 at 15:58
How do I assign the variables a1 and a2 x ?
I want to read the typed valueunsigned 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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-04-19 7:40 AM
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..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-04-19 9:44 AM
Posted on April 19, 2015 at 18:44
Thank you very much
understood
