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

Serial problem after eeprom write

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



Joined: 12 Feb 2006
Posts: 8

View user's profile Send private message

Serial problem after eeprom write
PostPosted: Mon Feb 20, 2006 4:21 pm     Reply with quote

Anyone has just had a problem on serial after a write_eeprom function??

I'm using a 16f876 pic which performs a control of an automatic window open close motion. I control the micro on site or by a master pc connected to the normal serial bus. All is ok if I do not save the position of the window in the EEprom using

write_eeprom ( EPAR_SOC_POS , Position );

but if I uncomment it and begin to call it, I see a problem on the serial bus. It seems not to answer to the master calls.

The bus is controlled using an #INT_RDA interrupt.

THANK YOU FOR ANSWERS.

Paolo
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Mon Feb 20, 2006 6:09 pm     Reply with quote

An EEPROM write puts the PIC to sleep for about 1 to 5ms (depending on the PIC). You may lose interrupts during this time.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Feb 20, 2006 6:28 pm     Reply with quote

If you need an external EEPROM-like chip that has no delay for write
cycles, then look at Ramtron:
http://www.ramtron.com/doc/Products/nonvolatile/nonvolatile_list.asp?ID=5
Falgellus



Joined: 12 Feb 2006
Posts: 8

View user's profile Send private message

PostPosted: Tue Feb 21, 2006 1:29 am     Reply with quote

Quote:
An EEPROM write puts the PIC to sleep for about 1 to 5ms (depending on the PIC). You may lose interrupts during this time.
_________________
Regards, Andrew


Ok, but the serial problem arises from the write eeprom call and goes on forever after it, even if I do not call anymore the function. From that point on I cannot more communicate with the pic.

Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Feb 21, 2006 1:41 am     Reply with quote

The UART is locking up when the receiver's buffer is overrun.
To prevent this, add the ERRORS parameter as shown below.
You'll still lose chars that aren't fetched in time, but at least
the UART won't lock up.
Quote:

#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

//=========================
void main()
{


while(1);
}
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