I read somewhere in microchip datasheets there might be a @NOP just past the @SLEEP ...
INT1 is the wakeup event.
here it has been working fine for me ... for about 15 years ! ( Lawn tractor computer ... )
Code:
Sommeil:
LCDOUT $FE,2, "BYE-BYE "
For I = 8 to 0 Step -1 'Animation arret
LCDOUT $FE,$C0,REP "*"\I," " ' ... 4s
PAUSE 500
NEXT I
PORTB.4 = 0 'Ports LCD à 0
PORTB.5 = 0
PORTC.7 = 0 ' PortC à 0
PORTC.6 = 0
PORTC.5 = 0
PORTC.4 = 0
AlLCD = 1 ' Coupure LCD
AlRef = 0 ' Coupure Vref
ADCON0.0 = 0 ' Désactivation ADC
T3CON.0 = 0 ' arret TMR3
T1CON.0 = 0 ' arret TMR1
T0CON.7 = 0 ' arret TMR0
INTCON.7 = 0 ' Wakeup sans interruptions
INTCON3.0 = 0 ' reset flag INT1
INTCON3.3 = 1 ' validation INT1 pour réveil
Alim = 0 'Coupure alimentation
Signal = 0 'Extinction voyant régime
@ SLEEP
@ Nop ' Redémarrage par mise du contact sans coupure générale
' Arret par décharge capa alim.
INTCON3.3 = 0 'Neutralisation INT1
INTCON3.0 = 0 'Reset Flag INT1
Alim = 1 'Remise alimentation si remise contact rapide.
'*****************************************************************************
Wakeup: 'Début du Programme - reveil du PIC / Affichage Memoire
'*****************************************************************************
'
FLAGS = 0 ' Validation Reset LCD
PORTB.4 = 0 'Ports LCD à 0
PORTB.5 = 0
PORTC.7 = 0 ' PortC.4-7 à 0
PORTC.6 = 0
PORTC.5 = 0
PORTC.4 = 0
Reveil = 1
LSelect = 0
Alain
Bookmarks