LCD will not start


Closed Thread
Results 1 to 40 of 50

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hey Brian,

    > a/ Can I perform a full PIC reset in code ?
    No. With a 16F, you can reset the program, but not the pic itself. (unless you tie an output pin to the MCLR pin, and set the output LOW). But even that doesn't reset everything to "Power-ON" settings. However, that won't solve your problem anyways.

    > b/ Any one else experienced this and found a fix?
    Yes, see below.

    > c/ Bad news that the forum does not allow a serach on 3 characters. LCD is automatically thrown out and there are no hits found searching for "Liquid Crystal Display"
    See this thread. It's a sticky at the top of the FAQ forum that you posted this message in. (but I've moved this thread)
    A better Search tool for the Forum
    http://www.picbasic.co.uk/forum/showthread.php?t=4751

    Now for the LCD.

    LCD's can't initialize while the pins are floating, which is the state they are in on power-up of the PIC. Once those pins are taken to the proper state, it then needs a short delay for it's internal initialization. It's usually safe to wait around 500ms, but most of the ones I have only need about 250ms.

    In your program, this section...
    Code:
    [************************** Initialise *********************************
    loopctr = 0
    pause 500 'wait for LCD to start
    doesn't do anything for the LCD since the pins are still floating. It just spends a half second doing nothing.

    Then here...
    Code:
    StartLCD:
    pause 500
    It uses another half second doing nothing again.

    Then here...
    Code:
    lcdout $FE, $01 ' Get LCD registers into active states
    pause 100 ' wait for LCD to start 
    lcdout $FE, $01 ' for justin
    This is the first place that the pins are no longer floating, but the pause is only 100ms so the next lcdout will interfere with the start-up.

    So here's how to fix it.

    Up at the ***** Initialise ****** lines, change it to this...
    Code:
    LCDOUT $FE,1
    pause 500 'wait for LCD to start
    .. Remove all the other pauses and clear screens.
    .. Remove the LCD_COMMANDUS 5000 and LCD_DATAUS 250 lines, they are way too high.

    It'll start up every time.
    DT

  2. #2
    Join Date
    Mar 2003
    Posts
    41


    Did you find this post helpful? Yes | No

    Default Thanks Darryl

    Thanks,

    I will be back on that project in 48 hours so I will let you know how it goes. Your explanations make excellent sense.

    Thanks again

    Brian

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    And a simple add at the bottom of the List...
    Code:
    @ Device pic16F877A, HS_OSC, BOD_OFF, PWRT_ON, WDT_ON, PROTECT_OFF
    1. You Should also disable the LVP mode, sometime it could do some strange behaviour..

    2. Could be interesting to enable the BOD... safety sake.

    good luck!
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Mar 2003
    Posts
    41


    Did you find this post helpful? Yes | No

    Default LCD still unreliable

    I have implemented Darrel's suggestions and they improve the situation but do not fix it. The LCD now starts about 50% of the time - up from less than 10% - but still not a solid solution.

    I think the problem lies (in part) in the power supply dV/dT at startup. Depending where in the mains cycle the unit is turned on, the power rise time can be from 20 - 90 mSecs. The data sheet implies the rise time should be under 10 mSecs and if that cannot be guaranteed, then a software reset sequence should be followed.

    Does anyone know the software sequence for 4 bit mode? The only examples I can find are both ambiguous and written for 8 bit mode which I cannot implement on this existing PCB with all i/o pins used on the PIC16F877A.

    Cheers
    Brian

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    What happen if you tie the PORTB.3 to gnd via 10K (or less)?

    Did you tried to enable the BOD (brown out voltage) and disable the LVP (Low voltage programming) mode?

    If nothing work, maybe, you could add a little capacitor (0.1-1uF) between MCLR and GND... maybe.

    Schematic?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    Mar 2003
    Posts
    41


    Did you find this post helpful? Yes | No

    Default LVP, BOD, etc

    Hi Mister-e.

    The PIC always starts. I know this because I have solenoids and switches and the switches always control the solenoids correctly. I think that rules out BOD or LVP issues. The 2 x 16 LCD always starts with the top row all black boxes and the lower row blank. When it starts properly, the LCD clears in about 500 mS and shortly afterwards the expected characters appear. When it does not start, the top line remains black and nothing appears on the lower line.

    I have tried 100 nf, 1uf and 10 uF as the MCLR capacitor with 10k to +5. Again the PIC always starts.

    The big 12 V 10 amp power supply is relatively slow to start and turning it on/off at the wall shows the LCD problem much more often than leaving the power supply on all the time and make/break the power line to the processor board. A scope shows the +5V rise time as 20-100 mS for on/off at the wall and under 1 mS for make/break to the 12 volt feed to the processor board. dV/dT is clearly part of the problem.

    A web search has turned up www.densitron.com and they have a discussion on timing aspects plus 4 bit and 8 bit modes. They make much of the tight timing restrictions between the Enable, RegisterSelect, data transitions and Read/Write lines and say this is a common problem with faster processors. sadly their app note is shot with typos and they do not define the pin functions (should RS be high or low during write? - they show it as both)

    I have the distinct feeling that PBP may be marginal with some brands of LCD at higher crystal speeds.

    Cheers
    Brian

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    try...

    Code:
    Start:
        Pause 1000
        LCDOUT $FE,1,"First"
        Pause 1000
        FLAGS=0
        LCDOUT $FE,1,"Second"
        pause 1000
        FLAGS=0
        LCDOUT $FE,1,"Third"
    Loop:
        Goto Loop
    What happen?

    I heard that some LCD may need up to 2 second to start correctly... but i never had one in my hand
    Last edited by mister_e; - 18th October 2006 at 00:34.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 19:54
  2. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  3. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  4. Gps with 16f628
    By dragons_fire in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 8th June 2006, 03:38
  5. Dedicated LCD Controller question
    By chuckles in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th February 2006, 14:44

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts