Цецо
"А всъщност най страшното е че това е документирано на баба им на задника. А не където се документират такива неща. Е тва е страшното"
Потърсих най-старите PDF файлове на Мicrochip с които разполагам. За съжаление не можах да намеря по стари от 1998г. Но и това е достатъчно. В документа DS30445C.pdf (PIC16C84) на
старница 44 раздел 8.9
Interrupts е написано и подчертано:
Note 2: If an interrupt occurs while the Global
Interrupt Enable (GIE) bit is being cleared,
the GIE bit may unintentionally be
re-enabled by the user’s Interrupt Service
Routine (the RETFIE instruction). The
events that would cause this to occur are:
1. An instruction clears the GIE bit while
an interrupt is acknowledged
2. The program branches to the
Interrupt vector and executes the
Interrupt Service Routine.
3. The Interrupt Service Routine
completes with the execution of the
RETFIE instruction. This causes the
GIE bit to be set (enables interrupts),
and the program returns to the
instruction after the one which was
meant to disable interrupts.
The method to ensure that interrupts are
globally disabled is:
1. Ensure that the GIE bit is cleared by
the instruction, as shown in the
following code:
LOOP BCF INTCON,GIE ;Disable All
; Interrupts
BTFSC INTCON,GIE ;All Interrupts
; Disabled?
GOTO LOOP ;NO, try again
; Yes, continue
; with program
; flow
Има диаграми и всичко е ясно обяснено.
Има го написано по същия начин и в документ DS30605B
PIC16C63/73B/65B/74B и вероятно в многи други .
Сигурен се, че това е отразено и в документи преди 1998г. защото съм работил с тях.
В случая, не трябва да виним MICROCHIP.
