View previous topic :: View next topic |
Author |
Message |
rhaguiuda
Joined: 05 Sep 2007 Posts: 46 Location: Londrina - Brazil
|
EEPROM Writing and Interrupt Problem |
Posted: Wed Oct 21, 2009 12:02 pm |
|
|
Hi everyone.
In my project I need to write a large buffer of bytes from a part of EEPROM into another part of EEPROM (400 bytes).
PIC18F2620, compiler 4.084.
To do that I use this simple code:
Code: |
for (lngCounter = 200; lngCounter < 600; lngCounter++)
write_eeprom (lngCounter + 400, read_eeprom (lngCounter)); |
This works great, but my system is running with two timer, USART and External interrupts all enabled.
This big EEPROM writing makes interrupts disable for some time, and the system is losing interrupts in the external interrupt pin.
The program cannot let any interrupt go without service (executing).
And now I don`t know what to do. Do you have any tip or idea to overcome this problem?
Thanks very much. _________________ Give a man a fish and you'll feed him for a day. Teach a man to fish, and you'll feed him for a lifetime. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Oct 21, 2009 2:27 pm |
|
|
I looked at the .LST file and I think it can be fixed by adding the #device
statement shown below:
Code: |
#include <18F2620.h>
#device WRITE_EEPROM=ASYNC
|
Read the warning about using it, from the CCS manual:
Quote: |
WRITE_EEPROM=ASYNC
Prevents WRITE_EEPROM from hanging
while writing is taking place. When used,
do not write to EEPROM from both ISR
and outside ISR.
|
I don't think you're writing to the data eeprom inside an isr,
so this issue won't affect you. Just add the #device statement
as shown above. |
|
|
|