Shop OBEX P1 Docs P2 Docs Learn Events
BS2p40 to Scott edwards BPK serial LCD — Parallax Forums

BS2p40 to Scott edwards BPK serial LCD

Pressus LimitedPressus Limited Posts: 23
edited 2010-08-11 13:55 in BASIC Stamp
Hi guys,

I have a BS2p40 linked to a scott edwards BPK serial LCD driver IC feeding a 4 x 20 LCD.

all works fine, until i try to display counts.

I am displaying counts from 0-9999 and then scrolling back to 00000.· My problem is that the count is starting at the wrong end in other words 1 is displayed as 1000, 2 is 2000, 12 is 1200, 121 is 1210 etc.

does anybody know the command code to send to the serial driver to make it right justified, or is there something I can do to the data I send up?

count var word········································ ' count variable
line1 con 128··········································· ' starting address of line 1 on LCD
I con 254················································ ' instruction command code to lcd
cls con 1················································· ' clear screen code for lcd

count=0·················································· ' zero count

serout 15,N9600,[noparse][[/noparse]I,cls]······························ ' send clear screen command to lcd
serout 15,N9600,[noparse][[/noparse]I,line1+15, dec4 count]······ ' display initial count

start:
·if in4=0 then gosub counting······················ ' count?
·if in2=0 then gosub count_reset················· ' reset count?
goto start

counting:
·count=count+1//10000······························ ' add 1 to count upto 9999
·serout 15,N9600,[noparse][[/noparse]I,line1+15,dec4 count]······ ' update count on lcd
return

count_reset:
·count=0·················································· ' reset count
·serout 15,N9600,[noparse][[/noparse]I,line1+15,dec4 count]······ ' update count on lcd

thanks,

Jon
·

Comments

  • FranklinFranklin Posts: 4,747
    edited 2010-08-05 20:40
    Perhaps there is a setting to reverse that. It's the display that is wrong but you could write code to correct it. (I'll leave that up to you)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Sam_sneakSam_sneak Posts: 14
    edited 2010-08-07 05:57
    You have to reverse your ACSII data output before you send the number to the LCD.
    Serout seems to claim to do this for you, but apparently something is wrong. Does the LCD have its own reversing feature (so you are getting a double reverse)?

    Serially it seems that it gets 1..0..0..0... when you should be sending 0..0..0..1

    At least that is what I suspect. The LCD usually won't reverse anything. You could do a rather complex cursor control, but It might just be less code to do it all in the BasicStamp.
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2010-08-07 10:17
    Look at the ctrl-R (ascii 18) right align text command in the Seetron manual for the 4x20 display. For example,
    [ serout 15,N9600,[ I,line1+19, 18, 4,dec mycount,CR] ' display initial count
    
    That will position the cursor at line1+19, but back up 4 characters, accept up to 4 digits of mycount, and then print them right justified in the 4 character field without leading zeros.

    (BTW notice that count is a reserved command word, so you can't use count as a variable)
  • Pressus LimitedPressus Limited Posts: 23
    edited 2010-08-11 13:55
    Look at the ctrl-R (ascii 18) right align text command in the Seetron manual for the 4x20 display. For example,
    [ serout 15,N9600,[ I,line1+19, 18, 4,dec mycount,CR] ' display initial count
    
    That will position the cursor at line1+19, but back up 4 characters, accept up to 4 digits of mycount, and then print them right justified in the 4 character field without leading zeros.

    (BTW notice that count is a reserved command word, so you can't use count as a variable)

    Thanks for the tip, but unfortunately, the BPK doesn't support the right justify command 18, that's used on the ILM series screens.

    thanks

    Jon
Sign In or Register to comment.