LCD init code ...safety


Closed Thread
Results 1 to 6 of 6

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by jorge View Post
    Is it possible to initialize and config all the defines and Ports on the run without compromise the reliability of the all system?
    One thing that can cause garbage characters like that is when a 4-bit interface gets out of sync, and it gets the low nibble from the last byte with the high nibble of the next byte.

    Sometimes you can toggle the E line once to get it back in sync, but to detect when to do that you need to have the R/W line connected to the PIC so you can see the busy flag. If it's not busy for 1.6mS after giving it a clear screen command ($FE,1) then it's probably out of sync.

    With an 8-bit interface that error can't happen.

    You can also re-initialize the LCD by clearing PBP's FLAGS system variable.
    On the next LCDOUT statement it will start from scratch as if power was turned on.

    Code:
    FLAGS = 0
    LCDOUT $FE,1
    In some cases, an LCD cannot be reset from software. It takes a power down sequence.
    If the LCD is powered from a PIC pin, you can cycle power to the LCD, then clear the FLAGS variable.

  2. #2
    Join Date
    Feb 2011
    Posts
    3


    Did you find this post helpful? Yes | No

    Default

    I would request him to let us know what he means by electrical noise. I assume that he is referring to sparking noise. I am of the view that sparking noise is caused by problems in your circuit. You will have to get the circuit repaired to solve the issue. It is not in any way related to the software part.

  3. #3
    Join Date
    Nov 2004
    Posts
    25


    Did you find this post helpful? Yes | No

    Exclamation Re: LCD init code ...safety

    Quote Originally Posted by Darrel Taylor View Post
    One thing that can cause garbage characters like that is when a 4-bit interface gets out of sync, and it gets the low nibble from the last byte with the high nibble of the next byte.

    Sometimes you can toggle the E line once to get it back in sync, but to detect when to do that you need to have the R/W line connected to the PIC so you can see the busy flag. If it's not busy for 1.6mS after giving it a clear screen command ($FE,1) then it's probably out of sync.

    With an 8-bit interface that error can't happen.

    You can also re-initialize the LCD by clearing PBP's FLAGS system variable.
    On the next LCDOUT statement it will start from scratch as if power was turned on.

    Code:
    FLAGS = 0
    LCDOUT $FE,1
    In some cases, an LCD cannot be reset from software. It takes a power down sequence.
    If the LCD is powered from a PIC pin, you can cycle power to the LCD, then clear the FLAGS variable.
    thanks for all the HELP and hints.
    Darrel , i ve no words to express my gratitude !
    You were 100% right, i used 4 bits data bus...and sometimes it was out of sycn.
    you really save my day.

    Note: i ve this card connected to another one that powers a 30A relay ...i guess the problem is here ( and i cannot redesign this card for zero crossing on-off...). Also a lot of cables are going thru the unit, and the FLAT cable i use to connecto to the LCD is probalby receiving a lot of EMF...).

    I have the FLAG option now to reset from time to time ( also i need to program again the CGRAM ) and i will make another PCB with 8bits Data Bus.
    !!!! REALLY THANKS !!!!

    PS: where can i see a full desciption of what the FLAGS = 0 does in terms of the full registers/code that is running in the CPU ( i am using almost every juice i can get from the 32K of the 18f4520 ;-)

Members who have read this thread : 0

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