PDA

View Full Version : EEPROM / interrupts



Charles Linquis
- 16th February 2010, 15:05
I see that in PBPPIC18.LIB the line -

ifdef WRITE_INT then
(disable interrupts)

and enable after the WRITE.


Does this mean that it is no longer necessary to disable INTs before an EEPROM write?
And does the routine enable interrupts even if they weren't enabled when the routine was entered?

Charles Linquis
- 16th February 2010, 15:14
I should have read my earlier post before I sent it. Too early.

I see that in PBPPIC18.LIB (PBP2.60)

**************************************
;* WRITE : Write data to on-chip EEPROM
*************************************

ifdef WRITE_INT then
(disable global interrupts)
(WRITE EEPROM)
...
ifdef WRITE_INT then
(enable global interrupts)


Does this mean that it is no longer necessary to disable INTs before an EEPROM write?
And does the routine enable interrupts even if they weren't enabled when the routine was entered?

Bruce
- 16th February 2010, 15:42
Hi Charles,


Does this mean that it is no longer necessary to disable INTs before an EEPROM write?

Yes. WRITE will automatically clear GIE for you if you have DEFINE WRITE_INT 1 declared.


And does the routine enable interrupts even if they weren't enabled when the routine was entered?
Yes. It sets GIE to re-enable global interrupts whether you're actually using interrupts or not. It assumes you are if you include this define.

Charles Linquis
- 16th February 2010, 16:32
Bummer!

Too bad it doesn't save INTCON, clear it, then restore it after the WRITE.

I'm turning INTs on and off a lot of places in my program.

Bruce
- 16th February 2010, 21:10
Hey Charles,

I hear you. But it's really easy to modify your PBP libraries. Just make sure you keep a copy of your library mods, since the next update will overwrite everything you've changed.

And, if it's a patch, you'll get that dreaded "hey .. no-can-do since you have a modified library..;o)

Still the best compiler on the planet.

Charles Linquis
- 16th February 2010, 21:55
I didn't want to admit it, but I have already made about a dozen changes to the library.
I made the change I described about an hour ago. It even works!

Bruce
- 16th February 2010, 23:14
I didn't want to admit it
I kind of figured you had, but I didn't want to tip-off the PBP police...;o)

You still using those HUGE 18F parts for everything?

Charles Linquis
- 17th February 2010, 00:10
I would use an 18F8723 running at 40 to blink a LED!

Those big parts were the reason I had to start modifying the libraries in the first place. I needed to access the upper half of memory using PBP 2.47. By setting TBLPTRU to *my* variable (usually "1") instead of clearing it, WRITECODE, READCODE, ERASECODE became a lot more usable - and no LONGs were needed. Setting it to $30 is fun, too. I clear it when I exit the routine so that I don't make PBP mad.


My latest concoction uses two '8723s strapped together (for more I/O and processing power), with a 12F675 also on the board for good measure.

Intel is up to 4 cores, but I'm catching up!

Bruce
- 17th February 2010, 00:37
I would use an 18F8723 running at 40 to blink a LED!
I thought so. You're just like my best friend who drives a ferrari to pick up hamburgers
for our football game get-togethers.

He also drives an el-cheapo Ford truck, but only to pick up rocks for his landscaping....;o)