Shop OBEX P1 Docs P2 Docs Learn Events
LCD display — Parallax Forums

LCD display

tempesttempest Posts: 10
edited 2004-12-21 19:41 in Learn with BlocklyProp
The task is simply to write your first name on the top line of the LCD display
does anyone know where I can find some code to this? or give me a helping start?
****· LCD display program· ******
'····· 4 line by 16 char display
'····· first initialize for 8-bit mode
·
DIRS = %0000001111111111····· ··········· ‘set pins P0-P9 as outputs
E········ con ··········· 8········· ······················· ··········· ‘set Enable pin as I/O pin P8
RS····· con··········· 9········· ······················· ··········· ‘set RS pin as I/O pin P9
·
Low RS········ ··········· ··········· ‘Place the HD44780 in instruction mode
pause 20······ ··········· ··········· ‘wait at least 15mS after power ON to initialize
·
outl = %00110000· ··········· ‘Basic code for initialization
pulsout E,1
pause 20······ ··········· ··········· ‘wait at least 4.1mS
·
pulsout E,1·· ··········· ··········· ‘Already the correct code, just repeat the pulsout
pause 20······ ··········· ··········· ‘wait at least 100uS
·
pulsout E,1
pause 20
·
outl = %00111000· ··········· ‘(0011NFxx)··········· N=number of lines: 1 = 2, 0 = 1 set = 1
pulsout E,1·· ··········· ··········· ‘F = font:1 = 5x10 pixel, 0 = 5x7 set = 0
pause 10
·
outl = %00001000· ··········· ‘(display off)
pulsout E,1
pause 10
·
outl = %00000001· ··········· ‘(clear display and set DD ram to address 0)
pulsout E,1
pause 10
·
outl = %00000110· ··········· ‘(000001I/D S) I/D = increment (1) or decrement(0)
pulsout E,1·· ······················· ‘cursor or display on entry,· set = 1
pause 10······ ······················· ‘S = shift entire display (1) or not (0) set = 0
·
outl = %00001111· ··········· ‘(000011CB)· C = Full cursor (1) or underline (0)
pulsout E,1·· ··········· ··········· ‘B = cursor blinking (1) or not (0)
pause 10
·
' Initialization done
·
stop
thats what I got so far to make the cursor blink ..but where do I find code to display my name on it?

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-12-21 19:34
    We have bunches of LCD code demonstrations -- though nearly all in 4-bit mode.· Still, you can use these demos as guidance.

    You can find code in StampWorks, and in our LCD AppMod documentation.

    BTW ... your excessive PAUSE values are simply wasting time.·· Better to match the spec (or get as close as you can) before making big changes.· Most instructions that don't require a specific pause time (as in the beginning of the sequence) require about a 40 microsecond delay.· Since the BASIC Stamp takes longer than this to load an instruction, you don't need the delays toward the end of your sequence.· Exceptions are clear and home instructions, which need a millisecond or two to finish.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office


    Post Edited (Jon Williams) : 12/21/2004 7:38:18 PM GMT
  • tempesttempest Posts: 10
    edited 2004-12-21 19:37
    ya I'm looking at the demos right now. this is fun stuff I'm hope to understand how to do it soon lol, some of the coding is confusing but it nice to see information on what a line of code does beside it
  • tempesttempest Posts: 10
    edited 2004-12-21 19:39
    whats the easiest way you would put in code for displaying letters onto an LCD? like an example code of something easy and simple would be nice TIA
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-12-21 19:41
    AN example?... we've got loads! (so I'm not going to write another). Look, specifically, how strings are stored in DATA statements and terminated with a zero value. That way, you can "point" to a string and wisk it off to a subroutine that puts in in the LCD.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
Sign In or Register to comment.