Shop OBEX P1 Docs P2 Docs Learn Events
LCD Display code — Parallax Forums

LCD Display code

tempesttempest Posts: 10
edited 2004-12-22 18:55 in Learn with BlocklyProp
' {$STAMP BS2}
DIRS=%0000111111000000
e CON 7
rs CON 6
char VAR Byte
index VAR Byte
LOW rs
PAUSE 50
OUTC=%0010
PULSOUT e,1
PAUSE 20
PULSOUT e,1
PAUSE 20
PULSOUT e,1
PAUSE 20
OUTC=%0010
PULSOUT e,1
PAUSE 10
OUTC=%1000
PULSOUT e,1
PAUSE 10
OUTC=%0000
PULSOUT e,1
PAUSE 10
OUTC=%0001
PULSOUT e,1
PAUSE 10

OUTC=%0000
PULSOUT e,1
PAUSE 10
OUTC=%0110
PULSOUT e,1
PAUSE 10

OUTC=%0000
PULSOUT e,1
PAUSE 10
OUTC=%1111
PULSOUT e,1
PAUSE 10
HIGH RS
LOOKUP 0, [noparse][[/noparse]"M"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"a"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"r"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"k"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10

pbtest:
IF IN11=1 THEN lastname
GOTO pbtest
lastname:
LOW rs
PAUSE 20
OUTC=%1100
PULSOUT e,1
PAUSE 10
OUTC=%0000
PULSOUT e,1
PAUSE 10
HIGH rs
LOOKUP 0, [noparse][[/noparse]"B"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"e"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"d"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"f"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"o"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"r"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"d"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
pbtest2:
IF IN12=1 THEN time
GOTO pbtest2
time:
LOW rs
OUTC=%0000
PULSOUT e,1
PAUSE 10
OUTC=%0001
PULSOUT e,1
PAUSE 10
HIGH rs
LOOKUP 0, [noparse][[/noparse]"C"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"A"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"C"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"T"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]" "],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"2"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"2"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"1"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOW rs
OUTC=%1100
PULSOUT e,1
PAUSE 10
OUTC=%0000
PULSOUT e,1
PAUSE 10
HIGH rs
LOOKUP 0, [noparse][[/noparse]"S"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"T"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"."],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]" "],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"L"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"A"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"W"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"R"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"E"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"N"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"C"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"E"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 3000
LOW RS
OUTC=%0000
PULSOUT E,1
PAUSE 10
OUTC=%0001
PULSOUT E,1
PAUSE 10
HIGH RS
LOOKUP 0, [noparse][[/noparse]"M"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"A"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"R"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"K"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOW RS
OUTC=%1100
PULSOUT E,1
PAUSE 10
OUTC=%0000
PULSOUT E,1
PAUSE 10
HIGH RS
LOOKUP 0, [noparse][[/noparse]"B"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"e"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"d"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"f"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"o"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
LOOKUP 0, [noparse][[/noparse]"r"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 10
LOOKUP 0, [noparse][[/noparse]"d"],char
OUTC =char.HIGHNIB
PULSOUT e,1
OUTC=char.LOWNIB
PULSOUT e,1
PAUSE 3000
GOTO time
STOP

ok I'm trying to get that to go out to my stamp 2..but it wont display anything it just shows dashes along the bottom. I was wondering if there was something wrong with my coding?? if anyone can check it over and try to figure it out

Comments

  • steve_bsteve_b Posts: 1,563
    edited 2004-12-22 17:56
    I got dizzy looking at your code....so what I'll suggest is just trying a simple demo program to see if you can put ANYTHING in the display.

    Do you have your byte order right wrt your LCD pins?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-12-22 18:55
    Zoiks, I'm dizzy too. We've got loads of BS2 examples using LCDs ... seems it would be simpler to adapt proven code.

    Since you did try, let me point out a something extremely wasteful:

    LOOKUP 0,[noparse][[/noparse]"M], char

    This line could be simplified as:

    char = "M"


    Also, you're repeating the same lines of code over and over and over and over again. A subroutine is in order here. I've attached an older program to get you started. Note that this program does not take advantage of conditional compilation (I expect that would just make things confusing at this point).

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


    Post Edited (Jon Williams) : 12/22/2004 6:57:04 PM GMT
Sign In or Register to comment.