ste2006
Advanced Member level 4
Hi,
I know this has been discussed before and i have read all of the posts and the data sheets but still cant seem to write to the Flash on a PIC18F27J13, I am using the ICD3 to debug it and just cant see anything in flash memory after running it,
I am erasing the blocks first etc and all registers appear to be working correctly but still no luck, Anyone any ideas??
Here is my code,
Just to get it going i am happy to write anything into Flash, Once this works i will actually write what i want,
Thanks,
I know this has been discussed before and i have read all of the posts and the data sheets but still cant seem to write to the Flash on a PIC18F27J13, I am using the ICD3 to debug it and just cant see anything in flash memory after running it,
I am erasing the blocks first etc and all registers appear to be working correctly but still no luck, Anyone any ideas??
Here is my code,
Code:
//Read & Write Flash Settings
TBLPTRU = 0x01; // Set Address of Flash
TBLPTRH = 0xB8;
TBLPTRL = 0x00;
EECON1bits.WPROG = 1; // 2 Byte Mode
EECON1bits.WREN = 1; // Enable Write to Memory
EECON1bits.FREE = 1; // Enable Erase
INTCONbits.GIE = 0; // Disable Interrupts
EECON2 = 0x55;
EECON2 = 0xAA;
EECON1bits.WR = 1; // Start Erase
Nop();
INTCONbits.GIE = 1; // Enable Interrupts
for (i = 0; i < 64; i++)
{
TABLAT = data[i];
_asm
TBLWTPOSTINC
_endasm
}
EECON1bits.WREN = 1; // Enable Write to Memory
INTCONbits.GIE = 0; // Disable Interrupts
EECON2 = 0x55;
EECON2 = 0xAA;
EECON1bits.WR = 1; // Start Programming
Nop();
INTCONbits.GIE = 1; // Enable Interrupts
INTCONbits.GIE = 1;
EECON1bits.WREN = 0; // Disable write to memory
Just to get it going i am happy to write anything into Flash, Once this works i will actually write what i want,
Thanks,