LCD Problem. Drawing dots on a SGX-120L
Hope I am not wearing out my welcome.· Have some free time this week, so working on a few projects.
I am continuing to experiment with my Tiny Touch Pad.· Now I want to draw on it and have the dots show on my SGX-120L.
My code looks right to me, and the SGX-120L part should work. (hehe)· Could someone look at it for me.· I really appreciate it.
SGX-120L.· I have read some other posts, and suspect I am not sending the correct information in the ESC P line?
Thanks, I really appreciate guidance on this. (note to Jon:· Notice I am finally using your template [noparse]:)[/noparse])
Post Edited (neoteric) : 2/23/2006 9:13:15 PM GMT
I am continuing to experiment with my Tiny Touch Pad.· Now I want to draw on it and have the dots show on my SGX-120L.
My code looks right to me, and the SGX-120L part should work. (hehe)· Could someone look at it for me.· I really appreciate it.
SGX-120L.· I have read some other posts, and suspect I am not sending the correct information in the ESC P line?
Thanks, I really appreciate guidance on this. (note to Jon:· Notice I am finally using your template [noparse]:)[/noparse])
' {$STAMP BS2p}
' {$PBASIC 2.5}
' -----[noparse][[/noparse] I/O Definitions ]-------------------------------------------------
RX PIN 0 ' input device = Tiny Touch Pad
LCD PIN 4 'LCD
' -----[noparse][[/noparse] Constants ]-------------------------------------------------------
#SELECT $STAMP
#CASE BS2, BS2E, BS2PE
T1200 CON 813
T2400 CON 396
T4800 CON 188
T9600 CON 84
T19K2 CON 32
TMidi CON 12
T38K4 CON 6
#CASE BS2SX, BS2P
T1200 CON 2063
T2400 CON 1021
T4800 CON 500
T9600 CON 240
T19K2 CON 110
TMidi CON 60
T38K4 CON 45
#CASE BS2PX
T1200 CON 3313
T2400 CON 1646
T4800 CON 813
T9600 CON 396
T19K2 CON 188
TMidi CON 108
T38K4 CON 84
#ENDSELECT
SevenBit CON $2000
Inverted CON $4000
Open CON $8000
Baud CON T9600
clrLCD CON 12 ' Clear entire LCD screen.
posCmd CON 16 ' Position cursor.
ESC CON 27 ' Escape code for graphics instructions.
ibaud CON T9600+Inverted ' 9600bps/inv. baud for LCD
LCDLghtOn CON 14
' -----[noparse][[/noparse] Variables ]-------------------------------------------------------
whatsit VAR Byte(5)
x VAR Word
y VAR Word
newx VAR Word
newy VAR Word
divx VAR Word
divy VAR Word
loopit VAR Word
finx VAR Byte
finy VAR Byte
'-----------[noparse][[/noparse]MAIN}---------------------------
Main:
PAUSE 10000 'let lcd power up
SEROUT lcd,ibaud,[noparse][[/noparse]clrLCD] ' Clear screen.
DEBUG "Begin" ' to pc debug screen
SEROUT lcd,iBaud,[noparse][[/noparse]LCDlghtOn] 'works
SEROUT lcd,ibaud,[noparse][[/noparse]"hello"] 'works, but sometime inverted
DO
SERIN RX, baud,[noparse][[/noparse]STR whatsit\5] ''
x = whatsit(2)<< 7 + whatsit(1)-115 '' Reads X,Y from input device
y = whatsit(4)<< 7 + whatsit(3)-90 ''
IF whatsit(0) = 137 THEN ''
'DEBUG "x = ",DEC x,",y=",DEC y,CR ''
newx=119*x/1650 '' Converts to <120
newy=31*y/3850 '' Converts to <32
finx=newx '' Stores as Byte
finy=newy '' Stores as Byte
DEBUG DEC x," - ", DEC y," ",DEC finx," ", DEC finy,CR 'View results on PC Screen Works'
[b]SEROUT LCD,ibaud,[noparse][[/noparse]ESC,"P",finx,finy] ''' draw point DRAWS GARBAGE?????[/b]
ENDIF
LOOP
END
Post Edited (neoteric) : 2/23/2006 9:13:15 PM GMT

Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Anyway, I figured it out from the docs.· I misunderstood it in thier sample code.
Thier doc on thier site·says "Numbers can be expressed either as ASCII text (e.g. "123") followed by a throwaway character, or as single-byte shortcuts. Shortcuts are the one-byte sum of the number to be sent, plus 64. Numbers up to 191 can be sent this way to increase serial throughput. See the user manual for examples."· To plot a point at x,y·- ESC P X,Y.·
Apparently I need to add 64.· So the code would read:
Thanks.· Sometimes these docs are a little difficult for a beginner.· Like the phrase "followed by a throwaway character."· What the heck is a throwaway character?· Sometimes a newbie has to read a line from the doc, do a google search.· Read the next line, do a google search.· Its·very easy to miss something, or get confused.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com