Original program to accept input from a TI83Plus calculator works, but next one does not work
Buck Rogers
Posts: 2,208
in BASIC Stamp
Hello!
Okay I've managed to work out how to have the original program for connecting a TI83Plus calculator to BS2 send its data to a display instead of the screen.
I guess what I'm looking for is a second opinion on the way the code is written as to why it does not want to work.
Okay I've managed to work out how to have the original program for connecting a TI83Plus calculator to BS2 send its data to a display instead of the screen.
' {$STAMP BS2}
' {$PBASIC 2.5}
serData VAR Byte
T2400 CON 396
' -----[ I/O Definitions ]-------------------------------------------------
TX PIN 12 ' serial output to LCD
' -----[ Constants ]-------------------------------------------------------
LcdBkSpc CON $08 ' move cursor left
LcdRt CON $09 ' move cursor right
LcdLF CON $0A ' move cursor down 1 line
LcdCls CON $0C ' clear LCD (use PAUSE 5 after)
LcdCR CON $0D ' move pos 0 of next line
LcdBLon CON $11 ' backlight on
LcdBLoff CON $12 ' backlight off
LcdOff CON $15 ' LCD off
LcdOn1 CON $16 ' LCD on; cursor off, blink off
LcdOn2 CON $17 ' LCD on; cursor off, blink on
LcdOn3 CON $18 ' LCD on; cursor on, blink off
LcdOn4 CON $19 ' LCD on; cursor on, blink on
LcdLine1 CON $80 ' move to line 1, column 0
LcdLine2 CON $94 ' move to line 2, column 0
Reset:
HIGH TX ' setup serial output pin
PAUSE 100 ' allow LCD to initialize
Main:
PAUSE 250
'DEBUG DEC serData, CR
SERIN 15,T2400,[serData]
SEROUT TX,T2400,[serData]
'SEROUT TX,T2400, [LcdRt]
'SEROUT TX,T2400,[HEX serData, CR]
'DEBUG DEC serData, CR
serData = serData + 1
'DEBUG DEC serData, CR
SEROUT 15,T2400,[serData]
SEROUT TX,T2400, [DEC serData, CR]
'SEROUT TX,T2400, [HEX serData, CR]
'PAUSE 900
'DEBUG DEC serData, CR
'SEROUT TX, T2400, [LcdCls]
GOTO Main
Which works perfectly. However as I work towards my next goal that of having the stamp and the calculator work with logic and with an outside source applied to that logic, the first idea does not.
' {$STAMP BS2}
' {$PBASIC 2.5}
serData VAR Byte
stuffdata VAR Byte
T2400 CON 396
'T1200 CON 813
' -----[ I/O Definitions ]-------------------------------------------------
TX PIN 12 ' serial output to LCD
' -----[ Constants ]-------------------------------------------------------
LcdBkSpc CON $08 ' move cursor left
LcdRt CON $09 ' move cursor right
LcdLF CON $0A ' move cursor down 1 line
LcdCls CON $0C ' clear LCD (use PAUSE 5 after)
LcdCR CON $0D ' move pos 0 of next line
LcdBLon CON $11 ' backlight on
LcdBLoff CON $12 ' backlight off
LcdOff CON $15 ' LCD off
LcdOn1 CON $16 ' LCD on; cursor off, blink off
LcdOn2 CON $17 ' LCD on; cursor off, blink on
LcdOn3 CON $18 ' LCD on; cursor on, blink off
LcdOn4 CON $19 ' LCD on; cursor on, blink on
LcdLine1 CON $80 ' move to line 1, column 0
LcdLine2 CON $94 ' move to line 2, column 0
Reset:
HIGH TX ' setup serial output pin
PAUSE 100 ' allow LCD to initialize
Main:
PAUSE 250
'DEBUG DEC serData, CR
SERIN 15,T2400,[serData]
'SEROUT TX,T2400,[serData]
SEROUT 0,T2400,[serData]
serData = serData + 1
'SEROUT TX,T2400, [LcdRt]
'SEROUT TX,T2400,[HEX serdata, CR]
'DEBUG DEC serData, CR
'DEBUG DEC serData, CR
SERIN 1,T2400, [stuffdata]
SEROUT 15,T2400,[serData]
SEROUT TX,T2400, [DEC serData, CR]
SEROUT TX,T2400, [DEC stuffdata, CR]
'PAUSE 500
'DEBUG DEC stuffdata, CR
'SEROUT TX, T2400, (LcdCls)
GOTO Main
I guess what I'm looking for is a second opinion on the way the code is written as to why it does not want to work.

Comments
What is happening is that the calculator display is showing 128 instead of the expected value of 192.
The LCD is not showing anything.
With the Px connections to the logic block and the display line for the logic block's output commented out the program works the same as the first.