Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

MPLAB EEPROM writing/reading simulation

Not open for further replies.


Full Member level 5
Sep 29, 2005
Reaction score
Trophy points
Cebu, Philippines
Activity points
mplab eeprom

Hello Everybody,

I am having troubles in simulating writing and reading EEPROM using the MPSIM of MPLAB.

I have some questions please help. (I used PIC16f877A)

1.) After I put data on EEADR and EEDATA, then EECON1, EEPGD is CLEAR and EECON1, WREN is SET, then the wite sequence 55h and AAh to EECON2 then I turn SET EECON1, WR to initiate writing.

The DATA does not reflect on the EEPROM address after initiating writing. Is the simulation works this way? Is the eeprom writing simulation being mimic in the actual writing which will take 4 to 8 ms?

2.) My EEPROM write suborutine is preceded by instruction like this

btfsc EECON1, WR
goto $-1
movlw ....

I used a loop in writing an array of data to EEPROM but it seems after one pass of calling my subroutine, the EECON1, WR will never get CLEAR thus the program is stuck in the code above.

How do I force EECON1, WR to CLEAR? (Note in actual operation, EECON1, WR is CLEARed by hardware which means writing to EEPROM is finished. It can only be SET but not CLEARed in software.)

3.) I am having the same problems with reading EEPROM too. it seems the EECON1, RD will not get CLEARed after one pass and worse it will not return any data.

Hoping for you smart ideas.



I am getting similar kind of problem. But the thing is the WR bit is not getting set
and also the interrupt flag also does not getting set.I have tried in the simulator and the debugger both in both also its not getting set if any body knows the answer please tell me.

Not open for further replies.

Part and Inventory Search

Welcome to