Connect with us

PIC18F4550 interface display is not working on power ON

Discussion in 'Microcontrollers, Programming and IoT' started by shindehari, Dec 23, 2018.

Scroll to continue with content
  1. shindehari


    May 19, 2014

    I am using 16x2 LCD display interfaced with pic18f4550. I can display latters on it, but if I switch OFF and then tried to switch ON my display is not showing only boxes. Display is showing latter's only when I reset the controller. I don't know why this is happening. I have added 100nf capacitor to the VCC pin of controller.

    Please suggest me any solution that can help me to resolve the issue.
  2. Harald Kapp

    Harald Kapp Moderator Moderator

    Nov 17, 2011
    Obviously the LCD controller is not reset correctly on power on. Obvious solution: send a reset command to the LCD as part of your PIC's initializaton routine.
  3. shindehari


    May 19, 2014
    Thanks for the suggestion.

    Now my display is working properly but once I enable the keypad scan function my display is continuously getting reset. It looks like PIC18F 4550 is getting reset, I have monitored (using scope) reset pin of controller, it is showing clean 5 volt DC. I don't know why my display is continuously flashing the displayed charectors.

    Below is the code for my keypad scan

    void keypad(){
        unsigned char col_sense=0x00;
        col_sense = PORTB & 0x07;
        if(col_sense != 0x07){
            col_sense = PORTB & 0x07;
            if(col_sense != 0x07){
                LATB = 0x1F;
                col_sense = PORTB & 0x07;
                if(col_sense == 0x03){
                    while(col_sense == 0x03)col_sense = PORTB & 0x07;
  4. BobK


    Jan 5, 2010
    Your code makes little sense to me. What is it trying to do?

    Here is what it appears to do:

    if the low 3 bits of PORTB are all 1, we are done, return.
    wait 20 msec.
    if the low 3 bits of PORTB are all 1 we are done, return.
    set LATB to 0x1F (four low bits on, all others off)
    if the low 3 bits of PORTB are 011, do some LCD commands (this seems unlikely since you just set them to 111.)

    wait until the low 3 bits of PORTB are not 011
    delay 20 ms

    Don't know what the LCD commands do and I am too lazy to look them up.
    Most likely that is what is flashing your screen.

    Also, the statement LATB = 0x1F might be problematical if you did not intend to alter the high 4 bits.

  5. shindehari


    May 19, 2014
    Thanks for the reply.

    The keypad code here is used to display charecter '1' on LCD display once key is pressed. The 3x3 matrix keypad is used. Coloums of the display are connected to PB0 to PB2 and Rows are connected to PB3 to PB5. The above code is just scanning the key at 1x1 position.

    "Most likely that is what is flashing your screen" - I tried commenting the LCD code in keypad function but it doesn't help.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day