18-10-2013, 05:01 PM
Steve,
I'm looking at the code and I don't see how this code could work as you're trying to left shift a byte by 8 bits and store it into a variable that is only 8 bits. If both EEPROM banks are 0xFF, the final result comes to be 0x00FF, which makes sense as the top byte is basically shifting itself nowhere. Was the code meant to show the following?
[code]unsigned short tmp = 0; /* changed here from int to short */
tmp = (unsigned int)EEPROM_BANK1[1]) + ((unsigned int)EEPROM_BANK1[0]
I'm looking at the code and I don't see how this code could work as you're trying to left shift a byte by 8 bits and store it into a variable that is only 8 bits. If both EEPROM banks are 0xFF, the final result comes to be 0x00FF, which makes sense as the top byte is basically shifting itself nowhere. Was the code meant to show the following?
[code]unsigned short tmp = 0; /* changed here from int to short */
tmp = (unsigned int)EEPROM_BANK1[1]) + ((unsigned int)EEPROM_BANK1[0]
<t></t>