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 CCS Technical Support

Problem with LCD

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



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

Problem with LCD
PostPosted: Fri Jul 13, 2012 12:44 am     Reply with quote

Hi! I'm controlling LCD with 2 row, 16 symbols each. My controller is 18F4520. Everything works fine, but there is a small glitch. When I turn on the power nothing happens. So I have to turn it off and next again to turn on the supply. Next everything is OK. But I want to fix this. I turn on the WDT but without any success. I put 2 caps nearby the controller (100nF and 100uF electrolytic) - nothing. Do you have any idea what's causing this???
Thanks!
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

Re: Problem with LCD
PostPosted: Fri Jul 13, 2012 12:59 am     Reply with quote

stoyanoff wrote:
Hi! I'm controlling LCD with 2 row, 16 symbols each. My controller is 18F4520. Everything works fine, but there is a small glitch. When I turn on the power nothing happens. So I have to turn it off and next again to turn on the supply. Next everything is OK. But I want to fix this. I turn on the WDT but without any success. I put 2 caps nearby the controller (100nF and 100uF electrolytic) - nothing. Do you have any idea what's causing this???
Thanks!



Do you have a time-delay pull-up on MCLR?

(i.e. VCC <--- 100K -> MCLR <-- 100nF --> GND)??

Do you have a schematic you can post?
You should post a short example of your code (just enough to show the problem) as well as your compiler version.

Cheers,

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Fri Jul 13, 2012 1:21 am     Reply with quote

Yes, I have 100b cap on MCLR, too. I`m using 2 74HCT373 buffs connected to port B. The hardware works fine. My program too. The problem is this small glich on first turn on. I think something cause controller blocking.
Code:

#include <18F4520.h>
#FUSES H4,WDT128,WDT
#use delay(clock=40M)

void main()
{
   restart_wdt();
   initialLCD();
        setup_adc_ports(AN0_TO_AN2);
   setup_adc(ADC_CLOCK_INTERNAL);
   
        while(1)
        {
               restart_wdt();
               ....................
        }

}


So this is a part of my code. On this bug the LCD is not even initialized!
Ttelmah



Joined: 11 Mar 2010
Posts: 19480

View user's profile Send private message

PostPosted: Fri Jul 13, 2012 2:48 am     Reply with quote

_Pause_.

A lot of the 'clone' LCD's, take longer to wake up, than the original standard Hitachi chips. Also though, many LCD's, don't start to power up till the supply gets up to perhaps 4v, while the PIC starts powering up much earlier. The rise time of the LCD supply will be being made worse by the capacitors!.

So:
Code:

#include <18F4520.h>
#FUSES H4,WDT128,WDT,PUT //PUT delays the PIC fractionally till the
//clock is stable
#use delay(clock=40M,restart_wdt)
//You need this, since there are significant delays in the LCD code.
void main(void) {
   restart_wdt();
   delay_ms(250); //Allow time for the LCD to actually power up
   initialLCD();
   setup_adc_ports(AN0_TO_AN2);
   setup_adc(ADC_CLOCK_INTERNAL); //This is _not_ legal at 40MHz
   //read the data sheet.
   while(1) {
        restart_wdt();
               ....................
   }
}


Best Wishes
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Fri Jul 13, 2012 11:25 pm     Reply with quote

I fix it! The problem was elsewhere. As I said I`m using 2 74HCT373 buf to pass data to LDC with only 1 port. So this buffers must be set before starting the initialization procedure.
Ttelmah your code has good pratices in i which I can use. Thanks!
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