CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

LCD Inop After Sleep

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

LCD Inop After Sleep
PostPosted: Sat Apr 29, 2006 4:01 pm     Reply with quote

Hello All,

18F4620
3.236

I've got a character LCD connected to port_d and I'm using the standard lcd.c driver. When I put the PIC to sleep the LCD won't work upon wake-up. I init it and do everything just like upon power up.

However, if I reset_cpu() I can get the LCD to work, but that generates another problem. I use a momentary switch to interrupt RB6 to wake the processor. When I push the button to wake the CPU, the interrupt 'hangs' i.e. fires continuously.

If I disable the portb interrupts in the ISR the interrupt no longer 'hangs', but I can never get the portb interupt re-enabled....

Any ideas?

Thanks,

John
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Apr 29, 2006 11:03 pm     Reply with quote

The test program shown below works OK. I tested it on a PicDem2-Plus,
which has the LCD on pins D0-D3 and A1-A3. To get the INT_RB
interrupt, I pulled out the ICD2 connector and jumpered the push-button
switch on B0 over to pin B7. When it's in Sleep mode, I push the
button and it displays this on the LCD:
Quote:

Wake up
Hello World
Sleeping

I can do that repeatedly.

Code:

#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

#include "flex_lcd.c"

#int_rb
void rb_isr(void)
{
   
disable_interrupts(INT_RB);   
}   

//======================================
void main()
{
int8 i;
int8 c;

lcd_init();

port_b_pullups(TRUE);

while(1)
  {
   lcd_putc("\fHello World");
   delay_ms(2000);
       
   c = input_b(); // Clear "change condition" on Port B
   clear_interrupt(INT_RB);    // Clear RBIF flag
   enable_interrupts(INT_RB);  // Enable RB interrupts
   enable_interrupts(GLOBAL);

   lcd_putc("\fSleeping");
   
   sleep();
   
   lcd_putc("\fWake up");
   delay_ms(2000);     
  }

}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group