BS2p40 to Scott edwards BPK serial LCD
Pressus Limited
Posts: 23
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
·
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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
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.
(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