![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
MarcosAmbrose
Joined: 25 Sep 2006 Posts: 38 Location: Adelaide, Australia
|
CCS internal_eeprom.c routines |
Posted: Sat Apr 28, 2007 10:43 pm |
|
|
I'm just looking at the CCS internal_eeprom.c file and there's something I don't understand. Whenever I'm writing several bytes of data to the internal EEprom I set a flag then wait for the INT_EEPROM interrupt before writting the next byte. It appears to take several milli secs between writes.
On the other hand, the CCS routines in the internal_eeprom.c file don't even have a time delay between writes and they appear to just blasting data at the EEprom in a FOR loop.
Can someone explain to me how the CCS routines work when I know it take longer to write a byte |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Sun Apr 29, 2007 2:45 am |
|
|
Their own 'write_eeprom' code, tests for the write to complete internally.
If you look at the code generated, for the command:
WRITE_EEPROM(addr+count,ptr[count]);
Ignore all the stuff 'loading' the data bytes, you get to:
1750: MOVWF FA7
1752: BSF FA6.1
1754: BTFSC FA6.1
1756: BRA 1754
1758: BCF FA6.2
175A: MOVF 00,W
175C: IORWF FF2,F
Notice the third, and fourth lines, where it sets the 'write' bit in EECON1, and then waits for it to clear. If you read the data sheet about this bit, it says:
" Initiates a data EEPROM erase/write cycle or a program memory erase cycle or write cycle. (The operation is self-timed and the bit is cleared by hardware once write is complete. The WR bit can only be set (not cleared) in software.) "
So, they are waiting for this bit to clear which implies the operation has completed.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
MarcosAmbrose
Joined: 25 Sep 2006 Posts: 38 Location: Adelaide, Australia
|
|
Posted: Mon Apr 30, 2007 10:39 pm |
|
|
Ttelmah wrote: | Their own 'write_eeprom' code, tests for the write to complete internally.
|
Hi Ttelmah, Thanks for that! I continue to learn something new everyday. -Cheers |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|