Shop OBEX P1 Docs P2 Docs Learn Events
4x20 LCD Problem — Parallax Forums

4x20 LCD Problem

babinda01babinda01 Posts: 54
edited 2008-06-16 05:53 in Propeller 1
Hello
I have begun my first project with the prop, and have run into my first problem (I am sure I will have more).· I am using a 4x20 LCD display which has the ks066 control, which I am told is compatible with the HD44780.· I am using the LCDDEMO which I have found in the object exchange, and I have got the display working a little.· My problem is that it is just writing·lines 1 and 3 and not to lines 2 and 4.· Does anyone know what I am doing wrong?? Do I need to change the line addresses???
Thanks
Andrew

Comments

  • vampyrevampyre Posts: 146
    edited 2008-06-12 09:06
    I havn't actually got a 4x20 but, if im not mistaken lines 1 and 3 are the same line, and line 2 and 4 are the same line (as far as the LCD is concerend) so its actually a 2 line display. So that if you write, say 60 charachters to line one, it will wrap around to line 3.
    can you post the relevent portions of your code here?

    If i'm not mistaken it should look like this

    'line one
    pos(1,1)
    writestr(string("Hello"))
    
    'line four
    pos(4,1)
    writestr(string("Goodbye"))
    
    
  • babinda01babinda01 Posts: 54
    edited 2008-06-12 09:31
    Hi
    Thanks for your input, but I am still having troubles.
    Here is a snippit of the code.

    · LCD.init····················· 'Initialize the display

    · LCD.pos(1,1)················ 'Set the third line position
    · LCD.writestr(@text)·········· 'Write the first string
    ·
    · LCD.pos(2,1)················ 'Set the third line position
    · LCD.writestr(@next1)········· 'Write the second string
    ·
    · LCD.pos(3,1)················ 'Set the third line position
    · LCD.writestr(@try1)·········· 'Write the third string
    ·
    · LCD.pos(4,1)················ 'Set the third line position
    · LCD.writestr(@last)·········· 'Write the fourth string



    dat

    text····· byte· "Andrew", eos
    next1··· byte "Was", eos
    try1····· byte·"Here", eos
    last····· byte "Today",eos

    The result of this is that Andrew is displayed on line 1 and Here is displayed on line 3, but lines 2 and 4 are blank.

    Andrew
    ·
  • BTXBTX Posts: 674
    edited 2008-06-12 11:57
    Hi Andrew
    I guess you're using the "LCDDEMO Version 1.2 April 21,2007 "

    Please DO NOT tied the D0..D3 lines to gnd, only use the D4..D7 lines of the LCD, and keep the others data lines open, that I think, will solve your problem.
    Try it please.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Regards.

    Alberto.
  • ColeyColey Posts: 1,110
    edited 2008-06-12 12:21
    Hi Andrew,

    I have working code for a 4*20 HD44780 LCD

    If you can let me know your pin assingments I will adapt my code to suit so that you can test your setup.

    Regards,

    Coley

    PS Alberto is right, D0..D3 must be left un-connected, unless you are in 8 bit mode of course!!!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PropGFX Forums - The home of the Hybrid Development System and PropGFX Lite
  • StefanL38StefanL38 Posts: 2,292
    edited 2008-06-12 12:37
    hello Andrew,

    i took a look inside a manual of a 4x20 Display.

    DD-RAM-ADRESSES to chacterposition in the display

    4x20
    Line 1 $00-$13
    Line 2 $40-$53
    Line 3 $14-$27
    Line 4 $54-$67

    As you can see from the adresses it starts with line 1 and then next ADRESS is Line 3
    then there is a gap from $28 to $39 and then comes line 2 and line 4

    For analysing your display you should do some systematical tests

    set cursor to first line first columm

    make loop that repeats four times
    inside this loop write another loop that sends 20 characters
    starting with A,B,C, twenty letters
    for sending the characters to the display
    do NOT use LCD.writestr()
    use the method that sends a SINGLE character

    These two nested loops will send 80 characters to the display.
    Look on the display what will be displayed.

    If you do not understand how the characters are mixed up take a photo of the display and post it here.

    I'm not sure about which object you are using

    "LCD Driver HD44780 16x2 4 bit 8 bit DEMO" and "Parallel LCD Driver"
    don't have methods named "writestr" or "pos"

    Also if your code is not top secret attach ALL the files that are nescessary to compile the WHOLE project
    The it will be much easier to analyze the whole thing.

    best regards

    Stefan
  • babinda01babinda01 Posts: 54
    edited 2008-06-12 12:44
    Hi everyone.
    Thanks for everyones assistance, it is greatly appreciated.· Alberto wins the apple pie.......
    I had tried D0-D3 to ground, and this was causing my problems.· Thanks again Alberto.

    Regards
    Andrew
    ·
  • BTXBTX Posts: 674
    edited 2008-06-12 14:07
    Happy to be usefull for you Andrew.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Regards.

    Alberto.
  • scottascotta Posts: 168
    edited 2008-06-12 16:59
    I have attached a simple LCD object. It lets you add fields to the
    display, you can specify the position, length and formatting
    of each field.

    It requires debug_lcd,Simple_Numbers,FloatString,FloatMath, so make
    sure they are in your library search path.


    Example Usage:
    #################################################
    OBJ
    LCD : "LCD"
    VAR
    long debug1,debug2,debug3,debug4,debug5,debug6,debug7,debug8

    PRI Main
    SetupLcd
    repeat
    debug1:=cnt
    '...

    PRI SetupLCD | LCD_PIN,LCD_BAUD,LCD_LINES,LCD_BACKLIGHT_PIN,LCD_BACKLIGHT_SECONDS

    LCD_PIN := 27
    LCD_BAUD := 19_200
    LCD_LINES := 4
    LCD_BACKLIGHT_PIN := LCD#NO_BACKLIGHT_PIN
    LCD_BACKLIGHT_SECONDS := 0

    LCD.Stop
    LCD.Setup(LCD_PIN, LCD_BAUD, LCD_LINES,LCD_BACKLIGHT_PIN,LCD_BACKLIGHT_SECONDS)
    LCD.SetPrecision(4)
    'line 1
    LCD.AddField( 0,0,string("A") , 2,0,@debug1 ,LCD#LONG_,8,0)
    LCD.AddField(10,0,string("B") ,12,0,@debug2 ,LCD#LONG_,8,0)
    'line 2
    LCD.AddField( 0,1,string("C") , 2,1,@debug3 ,LCD#LONG_,8,0)
    LCD.AddField(10,1,string("D") ,12,1,@debug4 ,LCD#LONG_,8,0)
    'line 3
    LCD.AddField( 0,2,string("E") , 2,2,@debug5 ,LCD#LONG_,8,0)
    LCD.AddField(10,2,string("F") ,12,2,@debug6 ,LCD#LONG_,8,0)
    'line 4
    LCD.AddField( 0,3,string("G") , 2,3,@debug7 ,LCD#LONG_,8,0)
    LCD.AddField(10,3,string("H") ,12,3,@debug8 ,LCD#LONG_,8,0)
    LCD.Start
  • babinda01babinda01 Posts: 54
    edited 2008-06-16 05:53
    Hi Guys

    I am having another little problem, that I am hoping someone can help me with.

    I am quite happy sending constants to the lcd using either LCD.writestr(@Splash1), where @Splash1 is stored in the dat area as·Splash1···· byte "CNC Control Pendant",cr,eos·or by·LCD.writstr(string("CNC Control Pendant",cr, eos)).· But now I am wanting to display data that I am recieving from a serial device -·I am using·FullDuplexSerial.· I have the following code where I want to display on the LCD the string for the recieved data, but I am not sure how to a. convert to a string the serial data and b. how to dispay a variable using lcd.writestr.

    I hope all that made sense.



    repeat
    ···· if ser.rxcheck
    ······ ch:=ser.rx ' get char
    ······ lcd.pos (4,10)

    Thanks

    Andrew
Sign In or Register to comment.