View previous topic :: View next topic |
Author |
Message |
iukhan
Joined: 21 Oct 2013 Posts: 4
|
WRITE_EEPROM=ASYNC |
Posted: Sat Mar 22, 2014 1:23 am |
|
|
I am a little bit confused about the warning about using #device WRITE_EEPROM=ASYNC, 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. |
Here what does it means outside ISR? To my understanding if ISR is the interrupt service routine than outside ISR mean the all the remaining routines excluding ISR. That means that I cannot write any where in my code. Which of course cannot be true. Please help. |
|
|
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Sat Mar 22, 2014 8:45 am |
|
|
You are correct - it simply means do not have routines to write to the eeprom in both the main code and the ISR (since with Murphy's law in force, while you are writing to the eeprom in your main code, the ISR will go off and try to write to the eeprom as well). Either only write to the eeprom in the ISR, or better, only write to the eeprom in your main code. Set a flag in the ISR telling the main code to update the eeprom or whatever your needs are. The thing you need to prevent is the possibility of one write taking place and having a second one start while the first one has not completed.
mikey _________________ mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3 |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19498
|
|
Posted: Sat Mar 22, 2014 10:46 am |
|
|
Keyword in the sentence is 'both'. Either in one or the other, but not both. |
|
|
iukhan
Joined: 21 Oct 2013 Posts: 4
|
|
Posted: Sun Mar 23, 2014 1:42 am |
|
|
Got it. Thanks |
|
|
|