Content originally posted in LPCWare by BPC on Tue Nov 22 10:08:34 MST 2011
Hello Everyone,
I am trying to read an unsigned int from an EEPROM I have connected to my LPC1343 via I2C. Using atoi(), I can't seem to get a number greater than 2^31 (which makes sense as atoi returns an int, not an unsigned int.
unsigned int my_num = atoi((const char *)I2CSlaveBuffer);
With the above code, if the number in I2CSlaveBuffer is greater than 2^31, it gets cut off to 2^31.
What is the best way to get an unsigned int from my I2C slave buffer? It seems atoi() isn't working for me? Or is there a typecasting I can do to use atoi()?
Thanks again.