PIC 16F887 LCD Interfacing Problem

Home Forums Microcontrollers PIC Microcontroller PIC 16F887 LCD Interfacing Problem

Tagged: , ,

This topic contains 2 replies, has 2 voices, and was last updated by  Rob Edge 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #13135

    Rob Edge
    Participant

    Hello,

    I am trying to use the lcd.h header, with a PIC16F887, and xc8.
    The code compiles fine, but the lcd will only power up, giving solid blocks on the first line.
    The code is directly copied from the tutorial with the following changes.

    #define _XTAL_FREQ 20000000
    #define RS RB2
    #define EN RB3
    #define D4 RB4
    #define D5 RB5
    #define D6 RB6
    #define D7 RB7
    #include <xc.h>
    #include "lcd.h";
    TRISB = 0x00;
    ANSELH = 0x00;
    

    I have checked the connections, and all are ok. I suspect that port b is not working for some reason, but I have studied the datasheet, and can’t see that I have missed anything.
    Can anyone please help?

    Regards
    Bob.

    #13141

    Ligo George
    Keymaster

    Hi,

    First make sure that PORTB is functing correctly by connecting some LEDs and programing accordingly.

    Did you connected the contrast adjusting variable resistor to the LCD ? If so try adjusting the contrast.

    #13152

    Rob Edge
    Participant

    Thank you Ligo for your reply.

    It is working fine on port d. After I removed the return from the example code.

    Feel a bit silly now. I have the PICkit 2 connected to port b, so it would not work at the same time as I was debugging it.

     

    Kind regards

    Bob.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.