Click here to Skip to main content
15,887,746 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Recursive directory search Pin
Richard MacCutchan29-Jul-16 5:02
mveRichard MacCutchan29-Jul-16 5:02 
AnswerRe: Recursive directory search Pin
Anthony Appleyard29-Jul-16 10:57
Anthony Appleyard29-Jul-16 10:57 
GeneralRe: Recursive directory search Pin
Richard MacCutchan29-Jul-16 22:23
mveRichard MacCutchan29-Jul-16 22:23 
AnswerRe: Recursive directory search Pin
David Crow1-Aug-16 5:01
David Crow1-Aug-16 5:01 
Questionvariadic templates problem Pin
FriendOfAsherah28-Jul-16 23:49
FriendOfAsherah28-Jul-16 23:49 
QuestionTrying to understand my mistake... with pointers Pin
Blubbo28-Jul-16 8:04
Blubbo28-Jul-16 8:04 
AnswerRe: Trying to understand my mistake... with pointers Pin
jeron128-Jul-16 9:30
jeron128-Jul-16 9:30 
AnswerRe: Trying to understand my mistake... with pointers Pin
leon de boer29-Jul-16 17:53
leon de boer29-Jul-16 17:53 
You haven't given us the implementation of this prototype function
void eeprom_update_byte (uint8_t *__p, uint8_t __value);

Implicit declaration error usually means you provided a prototype but no body code ... hence I am worried you haven't given me that functions code. I am assuming the EEPROM is flash and that code will do what we call the toggling test until it writes the byte to the flash. Warning if it is FLASH you usually also have to release protection registers by writing special commands to special addresses before you can write to the flash, did the original code also provide a function to release the protection on a sector per chance?

However onto your code as it stands, you are passing in the address to write as a byte which gives you a range of 0-255 in memory see here
bool Update_EEPROM_Memory_byte(byte val1, byte val2) {  // Val1 is a byte
  uint8_t eepromAddr = val1;  //  <== Really a byte as the address you can only write to memory address 0--0xff
  uint8_t eepromVal = val2;

The original function they provided had a pointer to an byte (uint_8) which will be most likely be 32 bit ... see
void eeprom_update_byte (uint8_t *__p, uint8_t __value); // First parameter is a pointer see the "*"

I suspect you need your address to be a long ..... try
bool Update_EEPROM_Memory_byte(unsigned long val1, byte val2){
  unsigned long eepromAddr = val1;  //  <== Now you can write to memory address 0-0xffffffff
  uint8_t eepromVal = val2;

Adjusted last function to take the long
bool eeprom_memory_update_byte(unsigned long eeprom_addr, uint8_t eepromValue)
{
    eeprom_update_byte((uint8_t*) eeprom_addr, eepromValue);
 
    uint8_t eepromVal = eeprom_read_byte(( uint8_t *) eeprom_addr);
 
    if (eepromValue == eepromVal)
      return 1;
    else
      return 0;
}

The alternative to an unsigned long for the address is to keep it as a pointer (uint8_t*).

That all means nothing if you have no code for the function eeprom_update_byte which isn't shown.
Other housekeeping Update_EEPROM_Memory_byte should return the result of eeprom_memory_update_byte rather than a static 1 (TRUE) result.
In vino veritas


modified 30-Jul-16 0:22am.

Questionhow to create a file input button in microsoft visual c ++ ? Pin
jhonganteng28-Jul-16 3:46
jhonganteng28-Jul-16 3:46 
AnswerRe: how to create a file input button in microsoft visual c ++ ? Pin
Richard MacCutchan28-Jul-16 4:30
mveRichard MacCutchan28-Jul-16 4:30 
QuestionHelp With Exception Pin
ForNow26-Jul-16 12:47
ForNow26-Jul-16 12:47 
AnswerRe: Help With Exception Pin
leon de boer26-Jul-16 17:22
leon de boer26-Jul-16 17:22 
GeneralRe: Help With Exception Pin
ForNow26-Jul-16 20:01
ForNow26-Jul-16 20:01 
GeneralRe: Help With Exception Pin
leon de boer26-Jul-16 22:33
leon de boer26-Jul-16 22:33 
AnswerRe: Help With Exception Pin
Jochen Arndt26-Jul-16 21:47
professionalJochen Arndt26-Jul-16 21:47 
GeneralRe: Help With Exception Pin
ForNow27-Jul-16 2:14
ForNow27-Jul-16 2:14 
GeneralRe: Help With Exception Pin
Jochen Arndt27-Jul-16 2:18
professionalJochen Arndt27-Jul-16 2:18 
GeneralRe: Help With Exception you where right !!!!!!!! Pin
ForNow27-Jul-16 15:15
ForNow27-Jul-16 15:15 
QuestionChoosing between strings Pin
Anthony Appleyard26-Jul-16 9:47
Anthony Appleyard26-Jul-16 9:47 
AnswerRe: Choosing between strings Pin
Richard MacCutchan26-Jul-16 21:11
mveRichard MacCutchan26-Jul-16 21:11 
QuestionNewbee Exception handling Guidance Pin
ForNow25-Jul-16 4:35
ForNow25-Jul-16 4:35 
AnswerRe: Newbee Exception handling Guidance Pin
Jochen Arndt25-Jul-16 4:57
professionalJochen Arndt25-Jul-16 4:57 
GeneralRe: Newbee Exception handling Guidance Pin
ForNow25-Jul-16 5:31
ForNow25-Jul-16 5:31 
AnswerRe: Newbee Exception handling Guidance Pin
Richard MacCutchan25-Jul-16 5:12
mveRichard MacCutchan25-Jul-16 5:12 
GeneralRe: Newbee Exception handling Guidance Pin
ForNow25-Jul-16 5:30
ForNow25-Jul-16 5:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.