Quote Originally Posted by Bruce View Post
If you power down the LCD before sleep you will need to reinitialize it on wakeup. Try placing flags = 0 just before @ SLEEP so PBP will reinitialize it first.

Or, if you're using an external oscillator, you might need a short delay after wakeup for it to stabilize before sending data to the display.
Thank you Bruce.

I am using internal osc.

Here is my simplified code.

Would you please indicate where do I need to put the flags and what exactly o I need to do?
IF I put CLEAR command before sleep, it helps but does not solve the issue completely.


Code:
LCDVdd var PORTA.0
Switch var PORTB.0
Input switch  ' An external 220K is tied to Vdd. Draws approx. 0.12mA.
OPTION_REG.6 = 1    ' Int on rising edge.
INTCON = %00010000   
IntFlag VAR INTCON.1 
START:
    
    low lcdvdd               ' Turn off lcd.
    
    ' Keep all pins low to draw minimum current.
    low LCD_DB5
    low LCD_DB6
    low LCD_DB7
    low LCD_RS
    low LCD_E 

    IntFlag = 0
@ SLEEP         ; Sleeping now. If switch is released, then processor will wake up.
@ NOP          
    high lcdvdd     ' Power up LCD.
    pause 250       ' LCD wakes up.
    
ChkBtn:
    lcdout $fe,1,"Test"
    pause 1000
    
  
    if Switch then chkbtn    ' Loop until Switch is down.
    ' Here, switch is down now.
    
    goto start