Hello, I've implemented these two functions in CCS: ----- START of CCS code #define RP0 5 #define RP1 6 #define EEPGD 7 #define WRERR 3 #define WREN 2 #define WR 1 #define RD 0 #define GIE 7 uns16 program_address; uns16 program_data; void write_program(void) { #ASM BSF STATUS, RP1 BCF STATUS, RP0 // Bank 2 MOVF &program_address, W MOVWF EEADR MOVF &program_address + 1, W MOVWF EEADRH // move address MOVF &program_data, W MOVWF EEDATA MOVF &program_data + 1, W MOVWF EEDATAH // move data BSF STATUS, RP0 // Bank 3 BSF EECON1, EEPGD // Point to PROGRAM memory BSF EECON1, WREN // Enable writes BCF INTCON, GIE // Disable interrupts MOVLW 0x55 MOVWF EECON2 // Write 55h MOVLW 0xAA MOVWF EECON2 // Write AAh BSF EECON1, WR // Set WR bit to begin write NOP // Instruction here is ignored NOP // Instruction here is ignored BSF INTCON, GIE // Enable interrupts BCF EECON1, WREN // Disables writes #ENDASM } void read_program(void) { #ASM BSF STATUS, RP1 BCF STATUS, RP0 // Bank 2 MOVF &program_address, W MOVWF EEADR MOVF &program_address + 1, W MOVWF EEADRH // move address BSF STATUS, RP0 // Bank 3 BSF EECON1, EEPGD // Point to PROGRAM memory BSF EECON1, WR // Set RD bit to begin read NOP // Instruction here is ignored NOP // Instruction here is ignored BCF STATUS, RP0 // Bank 2 MOVF EEDATA, W MOVWF &program_data MOVF EEDATAH, W MOVWF (&program_data + 1) // move data #ENDASM } ----- END of CCS code Anyone can help me find out why this isn't working? To write, put ADDRESS in 'program_address' variable and put DATA in 'program_data' variable, then execute 'write_program()'. To read, put ADDRESS in 'program_address', execute 'read_program()' and data will be load in 'program_data' variable. Well, it's supposed to work this way... :( Best regards and thanks, Brusque ____________________________________________________________________ Get free email and a permanent address at http://www.netaddress.com/?N=1