LCD Showes Some Wrong Letters


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2008
    Posts
    8

    Default LCD Showes Some Wrong Letters

    hello,
    Never posted here before. But I do read a lot.
    Any way maybe this will help some one starting out with LCD's
    I use Pic Basic Pro Version 2.50a
    Micro Code Studio Version 3.0.0.5
    I have A Microchip PIC 12F628A
    and a Hantronix HDM20216L-1 20x2 LCD

    I started off with the "Hello World" LCD Toturial.
    plugged in a chip, set the right chip in PBP, programed it up, soldered a few test leads to my lcd. and this is what i got

    Code: -------------------------------------------------------------------
    Pause 500 ' Wait for LCD to startup

    loop: Lcdout $fe, 1 ' Clear LCD screen
    Lcdout "Hello" ' Display Hello
    Pause 500 ' Wait .5 second

    Lcdout $fe, 1 ' Clear LCD screen
    Lcdout "World"
    Pause 500 ' Wait .5 second

    Goto loop ' Do it forever

    -------------------------------------------------------------------
    Screen 1: Hello

    Screen2: HelloWo ld

    (well this is wrong! Hello was suppose to disappear and last i checked "Wo ld" had an r in the middle)

    ok lets modify the code and try something new

    new code: -------------------------------------------------------------------

    Pause 1000 ' Wait for LCD to startup

    loop: Lcdout $fe, 1 ' Clear LCD screen
    lcdout $fe, $80
    pause 1000
    Lcdout "abcdefghijklmnopqrst" ' Display Hello
    lcdout $fe, $c0
    Lcdout "uvwxyz0123456789ABCD"
    pause 1000

    Lcdout $fe, 1 ' Clear LCD screen
    lcdout $fe, $80
    pause 1000
    Lcdout "EFGHIJKLMNOPQRSTUVWX" ' Display Hello
    lcdout $fe, $c0
    Lcdout "VZ~!@#$%^&*()_+-=,.?"
    pause 1000

    Goto loop ' Do it forever
    END

    -------------------------------------------------------------------
    Screen 1:
    abcdefghijklmno7qrst
    uvwxyz0123456789ABCD

    Screen 2:
    EFGHIJKLMNO QRSTUVWX
    YZ>!@#$%^&*()_2-= .?

    ok still not even close since when is "p" = "7" and "~" = a right arrow, "+" = "2", and a comma = nothing.

    new thought maybe i have a bad wire, maybe i have a non compatible LCD, maybe I'm a rock

    well the answer is number three, after reading lots and finding nothing, i found a post about an LCD with a gridded out screen. several posts in the thread someone suggested that he had spelled CMCON = 7 wrong
    then i thought i don't have a turn off analog statement in my code.
    guess what,
    that's it works like a champ

    my only question is what if i need a analog input? say i want a battery meter on my project.
    now what i have no analog ports, can anyone suggest something for me
    Last edited by sbobowski; - 7th September 2008 at 15:36. Reason: wrong PBP Version

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Hi and welcome to the forum.

    You do not have to use the pins in the schematic in the manual for your LCD. You can assign other PIC pins for LCD usage by using the various DEFINE LCD statements. So, in that case, you can reassign the LCD to use other Ports/Pins leaving your Analog pins free.

    Here is an example where all the Data and Register connections for an LCD have been assigned to PortC... (PIC16F876)...
    Code:
    	Define LCD_DREG PORTC				' Port for LCD Data
    	Define LCD_DBIT 4				' Use upper 4 bits of Port
    	Define LCD_RSREG PORTC				' Port for RegisterSelect (RS) bit
    	Define LCD_RSBIT 3				' Port Pin for RS bit
    	Define LCD_EREG PORTC				' Port for Enable (E) bit
    	Define LCD_EBIT 0				' Port Pin for E bit
    	Define LCB_BITS 4				' Using 4-bit bus
    	Define LCD_LINES 2				' Using 2 line Display
    	Define LCD_COMMANDUS 2000			' Command Delay (uS)
    	Define LCD_DATAUS 50				' Data Delay (uS)

  3. #3
    Join Date
    Feb 2008
    Posts
    8


    Did you find this post helpful? Yes | No

    Talking

    Works GREAT thank you!!
    i did it on a pic16f628A and moved them to Port.B

Similar Threads

  1. Is this code not initialising the LCD properly?
    By Platypus in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 30th January 2010, 19:14
  2. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 19:54
  3. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  4. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30

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