LCD -- melabs sample program


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1

    Default LCD -- melabs sample program

    I've written code far more complex that this but for the very first time I need to engage an LCD and LCDOUT. Believe it or not, I've been in electronics for years but never had the need for an LCD display.

    SO --

    As a very basic introduction, I looked at the sample program here --

    http://melabs.com/samples/PBP-mixed/lcd.htm

    What could be simpler right ?

    BUT --

    It doesn't work and I've triple checked everything. Only to see that in the code, Port A4 and port B3 AREN'T EVEN REFERENCED IN THE FRIGGIN'
    PROGRAM ! They're setup to connect to register select and enable on the LCD BUT why in the hell would they be assigned to a port and then not even used ! ?? And as a sidenote how about making mention of the backlight pins 15 and 16 on the LCD? Think that might be worth mentioning?

    Melabs documentation (to me) has always been piss poor but please, could someone explain why you would connect these pins to A4 and B3 and then do NOTHING with those ports ??? !!! *&$%&()

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: LCD -- melabs sample program

    I do realize that the ports default low and maybe that's what RS and E need so perhaps that's why they aren't referenced. Whatever is going on with this, i can't get it to work.
    using a 16C72 so I put in adcon1 = 7 and define osc 4 I even tried every combination of RS and E high/low

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: LCD -- melabs sample program

    Backlight is not part of the LCD controler (HD44780 or compatible) so it's got nothing to do with the LCDOUT command.

    As far as the ports goes I'm not sure I follow. What do you mean by not even used? Have you looked in the generated assembly listing and determined they'r not used or do you mean in the the PBP program?

    They ARE used, behind the scenes, by the LCDOUT command. And what the comments in the example program shows are the default Connection pinout. This can be changed by using a series of DEFINE directives, see the LCDOUT command in the manual.

    There are several reasons for it not working. What chip are you using? Make sure all the pins used for the LCD are configured as digital pins (comparator(s) turned off, digital buffers enabled).

    /Henrik.

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,636


    Did you find this post helpful? Yes | No

    Default Re: LCD -- melabs sample program

    ever heard of default settings ?

    from the book
    PBP assumes the LCD is connected to specific pins unless told otherwise using DEFINEs. It assumes the LCD will be used with a 4-bit bus with data lines DB4 - DB7 connected to PIC MCU PORTA.0 - PORTA.3, Register Select to PORTA.4 and Enable to PORTB.3.
    have you set port a to be digital ?
    Warning I'm not a teacher

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: LCD -- melabs sample program

    As I said, never picked up an LCD display in my life so yes, knowing the backlight pins beforehand would have been nice. Who's to say the backlight wasn't powered through the Vdd and Vss? If you're new to something, best to spell it all out, right?

    My bad on not considering the code within the command LCDOUT and A4 and B3 being part of it's instruction set.

    It would have been nice to see that in larger print or part of the example. We all are newbies at one point with everything so no need to -- well, you know.

    Thanks kindly for the reply. It must be the fact I'm using a 16c72 but like I say, ADCON1 = 7 sets all pins to digital and it has Ports A & B as most PICs do.

    Everything compiles fine also -- I'll get there. Spent too much time on it yesterday.

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: LCD -- melabs sample program

    I'll have to look at ADCON1 -- maybe it doesn't influence Port A -- who knows.

  7. #7


    Did you find this post helpful? Yes | No

    Default Re: LCD -- melabs sample program

    I hope you know the pic16"C"72 is a one time programmable pic vs. pic16"F"72. So you only get one shot to make it work. Also a common beginner's LCD problem is the contrast control.

  8. #8


    Did you find this post helpful? Yes | No

    Default Re: LCD -- melabs sample program

    contrast is fine.

    I have a few thousand 16c72.

    just a beginner with LCDOUT. It's using default ports is something you don't think of.

Similar Threads

  1. Lcd 16x2 circuit and sample program...
    By larzazral in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 22nd July 2012, 11:21
  2. melabs U2 programmer won't program 12F675
    By BrianT in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 21st November 2011, 01:14
  3. meLabs Program Header aid
    By boroko in forum General
    Replies: 0
    Last Post: - 13th November 2009, 09:37
  4. CTCSS Tone Decoder Sample Program
    By sozkarabacak in forum General
    Replies: 0
    Last Post: - 20th October 2009, 06:15
  5. DS1307 sample Program
    By Mark in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 29th September 2004, 02:25

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