Thanks
The datasheet for 16F87X is not so clear for on chip eeprom,
but it does say you can write to program memory with interrupts enabled.
What does it mean to say "(masked, not DISABLEd)" ??
Thanks
The datasheet for 16F87X is not so clear for on chip eeprom,
but it does say you can write to program memory with interrupts enabled.
What does it mean to say "(masked, not DISABLEd)" ??
Didn't know which PIC you're using so I just picked a datasheet I had available.
Not sure but I think that the note about masking and not disabling the interrupts must apply specifically for when using ON INTERRUPT. Ie, they are telling us to clear the interrupt enable flags instead of inserting the DISABLE directive.
/Henrik.
Masked interrupts!
Art, Henrik,
If interrupts are enabled in INTCON Control Register with Global GIE, all individual interrupts are masked if the item/items of interest are cleared and not in use. let us say RBIE Port B interrupt-on-change, RBIE is set to 1, RBIE is now unmasked and ready for use.
If we look at the 18F25K22 as Henrik has used for an example, GIE=1 Enables all unmasked interrupts, PEIE=1 Peripheral Interrupt Enable bit, RBIE=1 unmasked the PortB interrupt-on-change interrupt, it is now ready for use. All other interrupts are masked and not in use. If we look at page 161 para 11.5 Timer0 Interrupt, “The interrupt can be masked by clearing the TMR0IE bit of the INTCON register.
At least that’s the way I understand it.
Wayne
Art, I would add one more thing,
@ BCF INTCON, GIE
Write EEPROM...................................
@ BSF INTCON, GIE
should do the trick if using interrupts durring a Write to EEPROM.
Wayne
With all the quotes from the manual and datasheet, I thought for sure someone would have seen ...
The difference being that it is built-in to the WRITE command.Originally Posted by PBP Manual: WRITE command
Interrupts only need to be disabled during the "unlock" sequence written to EECON2 which takes 5 instructions.
@ 4Mhz, that's only 5uS, @ 20Mhz it's 1uS.
By wrapping the WRITE command with GIE=0 / GIE=1, you are disabling interrupts for the full time it takes to complete the WRITE to EEPROM.
@ any OSC, that's 4-6mS.
Many interrupts can be lost in that much time.
DT
Just for the note.
I also had same issue as Art.
DEFINE WRITE_INT 1 did not solve the issue, but GIE solved.
BTW; I am also using
@ INT_DISABLE RX_INT
before the write command and then enable it.
Only by itself it did not work, DEFINE WRITE_INT 1 also did not work.
Disabling GIE worked.
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Bookmarks