CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

EEPROM Writing and Interrupt Problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
rhaguiuda



Joined: 05 Sep 2007
Posts: 46
Location: Londrina - Brazil

View user's profile Send private message

EEPROM Writing and Interrupt Problem
PostPosted: Wed Oct 21, 2009 12:02 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Oct 21, 2009 2:27 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group