Shop OBEX P1 Docs P2 Docs Learn Events
Parallax serial LCD question — Parallax Forums

Parallax serial LCD question

DiabloDiablo Posts: 11
edited 2005-11-07 16:05 in BASIC Stamp
Hi,

I have a serial lcd connect to BOE with BS2p wire same as "Get Started with the Parallax Serial LCD" but use pin 0.· I have the following code execute:

' Example Program - LcdTestMessage.bs2
' Display a test message on the Parallax serial LCD>

' {$STAMP BS2p}·························· ·' Target device = BASIC Stamp 2
' {$PBASIC 2.5}···························· ·' Language····· = PBASIC 2.5
'· HIGH 0····································· · ' Set pin high to be a serial port
'· PAUSE 100·································· ' Pause for Serial LCD to initialize
SEROUT 0, 240, [noparse][[/noparse]18]
SEROUT 0, 240, [noparse][[/noparse]22, 12]················ ·' Initialize LCD
PAUSE 5
SEROUT 0, 240, [noparse][[/noparse]"See this?", 13,······ ' Text message, carriage return
······················· ·"The LCD works!"]·· ' more text on line 2.
SEROUT 0, 240, [noparse][[/noparse]17]
PAUSE 1000·<
"When I execute till here, it stop.· The rest of the code
··························································································· won't run.·
SEROUT 0, 240, [noparse][[/noparse]128, "Hello", 13,
······························· ·"Hey you"]
END················································· ' Program end


The second problem I have:

' Example Program - MoreLcdControlCharacters.bs2
' Display number values with the Parallax serial LCD.
' {$STAMP BS2p}························································· ' Target device = BASIC Stamp 2
' {$PBASIC 2.5}··························································· ' Language····· = PBASIC 2.5
index················VAR········ Nib······································· ' FOR...NEXT loop index
character···········VAR········ Byte·· ·································· ' Character storage
offset··············· VAR········ Byte······································ ' Offset value

'SEROUT 0, 240, [noparse][[/noparse]22, 12]··············································· ' Initialize LCD
'PAUSE 500····································································' 1/2 second delay

' Display evenly spaced characters on line-1 every 200ms.
SEROUT 0, 240, 200, [noparse][[/noparse]128, "L",·· <
·The 200ms pacing won't pace.· If I take out 200,·It·only show the
·······································································································whole characters "LINE-1" !
································ 131, "I",
································ 134, "N",
································ 137, "E",
································ 140, "-",
································ 143, "1"]
PAUSE 100

' Shift "line-2" across line-2 right to left, then left to right.
FOR index = 9 TO 0
· SEROUT 0, 240, [noparse][[/noparse]148 + index, "Line-2"]
· PAUSE 250
NEXT····<
It won't shift right here.· Only display "Line-2"

PAUSE 1000························································ ' 1 second delay

' Clear LCD, then display then Display "ALL DONE" in center and flash 5 times
SEROUT 0, 240, [noparse][[/noparse]12]: PAUSE 5············ ················ ' Clear LCD
SEROUT 0, 240, [noparse][[/noparse]135, "ALL", 13, 154, "DONE!"]···· ·' "ALL" and "DONE" centered
FOR index = 1 TO 4·············································· ' Flash display 5 times
· SEROUT 0, 240, 500, [noparse][[/noparse]21, 22]
NEXT
END···································································· ' Program end


I want to know the serial LCD need individual power supply to hook up or can power up from BOE +5V?

Anyone can explain to me, please

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-04 20:20
    Hello,

    ·· The LCD requires 5V and a common ground with the BASIC Stamp...I tried your first code and it works fine, with the exception of your line 1 command only partially prints over the original text.· The second·code is too messed up from all the commenting through it and the way it's pasted into the main message body.· I would recommend checking out our example code, as well as the demo code.· You might also attach your code so it can be compiled.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • DiabloDiablo Posts: 11
    edited 2005-11-04 21:04
    I have re-check my first code. If I change Pause from 1000 to 100, it works but new characters cover the old characters(that's ok). Also change to 150, 200, or 500, it won's execute the rest of the code. Don't know why?

    I also start from here:

    SEROUT 0, 240, [noparse][[/noparse]18]

    SEROUT 0, 240, [noparse][[/noparse]22, 12] ' Initialize LCD
    PAUSE 5

    SEROUT 0, 240, [noparse][[/noparse]17]

    PAUSE 130 <
    130 works but not 150, 200 or 1000. Only LCD backlight works!

    SEROUT 0, 240, [noparse][[/noparse]128, "Hello", 13,
    "Hey you"]

    END

    I wonder what's wrong with the Pause command over 1000. It should looks fine wait 1 sec(1000) for the BS2p but looks like it don't like Pause over 100 or my LCD display has problem. (This is the first example. When I follow the other example code, it won't work.)
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-05 01:09
    I will check your code out, but I removed the extra thread containing it and will add it below...Please keep messages in the existing thread.· Also, if this is a BS2p program, why are you using a .BS2 extension?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • DiabloDiablo Posts: 11
    edited 2005-11-05 02:47
    Coz, I used BS2 before. After that I bought BS2p and replace it. So forgot to "Save As" new extension (.bs2p). Even I changed to bs2p, it looks the same. Will wait for your answer. Thanks for the reply. [noparse]:)[/noparse]
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-07 15:56
    Okay,

    ·· First to address the code you sent me separately...That code runs exactly as it should.· On the BS2.· Since you're using a BS2p you would need to change the baud rate parameter.· Also, in regards to your other question, sometimes changing a PAUSE to too low of a value can cause the display to not have enough time to react to certain commands, such as CLS (Clear Display).· This is in reference to SerialLCD-Animation.bs2.

    ·· Checking your other code now...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-07 16:05
    Okay,

    ·· After getting to your other program I see one more possible reason why you're having trouble with the first code.· Your second code is also at a diferent Baud rate.· The Demo Code uses 19.2Kbps for the BS2, and your other code uses 9600 bps for the BS2p.· Obviously some changes need to be made.

    ·· Also, your second code worked fine for me, except that on the line 2 shifting the 2 trailed along.· I corrected that.· But otherwise I don't see what's wrong.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.