Thanks for the reply, John. I'm not sure where you found that PDF, and I've been googling for a while but can't find anything about a PIC24F with Chapter 10 being EEPROM. It's always Chapter 5. **shrug** But I still have a couple questions: 1) How do I know what the offset is supposed to be? The MPLAB X EEPROM tab shows the EEPROM starting at address 0x7ffe00 2) I tried using your code, and also the code straight from the PIC24F32KA301 data sheet. Still nothing, I can't get past the first hump of writing data, let alone reading data. Am I missing something extremely obvious? This is driving me nuts! int __attribute__ ((space(eedata))) eeData =3D 0x1234; //Also tried: //int __attribute__ ((space(eedata))) eeData[] =3D { 2, -1, -1, -1 }; void eeprom_write(int newData, uint offset) { NVMCON =3D 0x4004; //Set up NVMCON to erase one word of data EEPROM //Set up a pointer to the EEPROM location to be erased TBLPAG =3D __builtin_tblpage(&eeData); //Initialize EE Data page pointer //Also tried without the "&" pointer deref offset =3D __builtin_tbloffset(&eeData); //Initizlize lower word of address //Also tried without the "&" pointer deref __builtin_tblwtl(offset, newData); //Write EEPROM data to write latch asm volatile ("disi #5"); //Disable Interrupts For 5 Instructions __builtin_write_NVM(); //Issue Unlock Sequence & Start Write Cycle NVMCONbits.WREN =3D 1; //Also tried without this line //This seems to stall the PIC indefinitely, so I just comment it out and __delay_ms(1) afterwards //while(NVMCONbits.WR =3D 1); //Optional: Poll WR bit to wait for //write sequence to complete } int eeprom_read(uint offset) { int data; // Set up a pointer to the EEPROM location to be erased TBLPAG =3D __builtin_tblpage(&eeData); //Initialize EE Data page pointer offset =3D __builtin_tbloffset(&eeData); //Initizlize lower word of address data =3D __builtin_tblrdl(offset); //Write EEPROM data to write latch return(data); } void main(void) { int j =3D 0; int z =3D 0; for(j =3D 0; j < 10; j +=3D 2) { z =3D ((j + 64) << 8) + (j + 64); eeprom_write(z, j + 0x7ffe00); //Also tried: //eeprom_write(z, j); __delay_ms(1); } } On Thu, Apr 30, 2015 at 7:36 PM, John J. McDonough wrote: > On Thu, 2015-04-30 at 17:34 -0600, Mitch wrote: > > I'm looking for a way to write data to non-volitile memory. It seems, > even > > though they say you can write EEPROM, everyone say to do EEPROM emulati= on > > with Flash. > > > > All the examples I've found for 24F for some reason does not work. > > I've tried these: > > > http://www.ece.msstate.edu/courses/ece3724/main_pic24/docs/_p_i_c24_suppo= rt.html > > http://www.microchip.com/forums/m707241.aspx > > http://www.microchip.com/wwwAppNotes/AppNotes.aspx?appnote=3Den530593 > > > > The AN1095 PDF is quite a bit over my head and doesn't show any example= s. > > > > Does anyone know of a library that would work for all 24F chips? Or > should > > I just stick with an external chip? > > > > Writing EEPROM was SOOOO easy with PIC16!!! > > Well, once you figured it out it was! > > I found the examples in the FRM to work. It did seem to me that the > data to write had to be global. I saw no reason to require that, but it > didn't seem to work without it. My testing was on the KM2, but it looks > to me that the KA3 is identical save a few peripherals. > > Maybe you'll inspire me to try it with the KA3 and finish the chapter. > > --McD > > > > --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .