Jump to content

pic18f4620 eeprom


Durisian
 Share

Recommended Posts

Hey Guys!

I'm trying to read and write to the internal eeprom of a pic18f4620

I seem to be only able to access the first 256 bytes

Basic run down:

Init -

for (i=0;i<0x100;i++) MIOS_EEPROM_Write(i, 0x41);  // letter A

for (i=0;i<0x100;i++) MIOS_EEPROM_Write(i + 0x100, 0x42); // letter B

for (i=0;i<0x100;i++) MIOS_EEPROM_Write(i + 0x200, 0x43); // letter C
display_tick
MIOS_LCD_CursorSet(0x00);

for (i=0;i<0xf;i++) MIOS_EEPROM_Read(i);
Shows CCCCCCCCCCCCCCCC I expected AAAAAAAAAAAAAAAA also
display_tick

MIOS_LCD_CursorSet(0x00);

for (i=0;i<0xf;i++) MIOS_EEPROM_Read(i + 0x100);

also shows CCCCCCCCCCCCCCCC

Is there an issue thats not letting me go over address over 256?... or more likely - am I just a retard cry.png

Link to comment
Share on other sites

got it going


unsigned int extended_MIOS_EEPROM_Read(unsigned int address)

{

  EEADRH = address >> 8;  // set eeprom address high byte

  return MIOS_EEPROM_Read(address & 0xFF);

}


void extended_MIOS_EEPROM_Read(unsigned int address, unsigned char data)

{

  EEADRH = address >> 8;  // set eeprom address high byte

  MIOS_EEPROM_Write(address & 0xFF, data);

}

Edited by Durisian
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...