Shop OBEX P1 Docs P2 Docs Learn Events
Returning to the Stamp — Parallax Forums

Returning to the Stamp

Hello!
After taking a vacation from the Stamp, whilst waiting for this laptop to arrive I decided to try out a variation on a theme of the TI-83 Plus Calculator and the BS2 device.
This is the code I used.
' {$STAMP BS2}
serdata  VAR  Byte

again:
'*****this will wait for serial from calculator
SERIN 15,396,[serdata]

'***this will send it to the pc debug screen
DEBUG DEC serdata, CR


'***this will send the same data plus 1 back to the calculator
serdata=serdata + 1
DEBUG DEC serdata, CR
SEROUT 15,396,[serdata]
DEBUG DEC serdata, CR
GOTO again

As all of you can see it is much the same as the original code our friend at Norland Research created years earlier when someone on the original Yahoo/eGroups list raised the issue of how would he connect a Stamp 2 to just such a calculator. The code he presented is such:
' {$STAMP BS2}
' {$PBASIC 2.0}

serdata  VAR  Byte

again:
'*****this will wait for serial from calculator
SERIN 15,396,[serdata]

'***this will send it to the pc debug screen
DEBUG DEC serdata, CR


'***this will send the same data plus 1 back to the calculator
serdata=serdata + 1
SEROUT 15,396,[serdata]

GOTO again

And of course it also worked.

I also have the translation to that of the code that would run on a Stamp 1 as it happens should anyone here ask about it.
----
And the following message is sponsored by the Friends of Dwarf Grumpy.

Comments

  • And now the same idea will display the numbers on a video input for an ordinary TV set using the (sadly now discontinued) Prop Backpack:
    ' =========================================================================
    '
    '   File...... screentest7.bs2
    '   Purpose... screener
    '   Author.... GCL -- Jedi Knight Computers
    '   E-mail.... gregg@levine.name
    '   Started... 10 Mar 2014
    '   Updated... 11 Mar 2014
    '
    '   {$STAMP BS2}
    '   {$PBASIC 2.5}
    '
    ' =========================================================================
    
    ' -----[ Program Description ]---------------------------------------------
    
    ' This program outputs video to an NTSC color monitor via a Propeller
    ' Backpack module and demonstrates the various features of the video driver.
    
    
    ' -----[ I/O Definitions ]-------------------------------------------------
    
    io     PIN 12       ' Serial I/O pin for Propeller Backpack.
    
    ' -----[ Constants ]-------------------------------------------------------
    
    ' Baudrate definitions. Serial I/O must be open-drain. The Propeller Backpack
    ' includes a pullup internally.
    
    #SELECT $STAMP
      #CASE BS2, BS2E, BS2PE
        baud    CON  84 + 32768
      #CASE BS2SX, BS2P
        baud    CON  240 + 32768
      #CASE BS2PX
        baud    CON  396 + 32768
    #ENDSELECT
    
    ' The following is a table of "command" constants for the Propeller Backpack
    ' that can be copied to other programs. The ones that are commented are already
    ' defined by the BASIC Stamp Editor and perform the same functions as they
    ' would in a DEBUG screen.
    
    'CLS           CON $00  'clear screen
    'HOME          CON $01  'home
    'CRSRXY        CON $02  'set X, Y position (X, Y follow)
    'CRSRLF        CON $03  'cursor left
    'CRSRRT        CON $04  'cursor right
    'CRSRUP        CON $05  'cursor up
    'CRSRDN        CON $06  'cursor dn
     USECLR        CON $07  'use color C (C follows)
     BS            CON $08  'backspace
    'TAB           CON $09  'tab (8 spaces per)
    'LF            CON $0A  'linefeed
    'CLREOL        CON $0B  'clear to end of line
    'CLRDN         CON $0C  'clear down (to end of window)
    'CR            CON $0D  'return
    'CRSRX         CON $0E  'set X position (X follows)
    'CRSRY         CON $0F  'set Y position (Y follows)
     DEFWIN        CON $10  'define window  W (W, Left, Top, nCols, nRows follow)
     USEWIN        CON $11  'use window W (W follows)
     DEFCLR        CON $12  'define color C (C, FG, BG follow)
     SCRLLF        CON $13  'scroll window left
     SCRLRT        CON $14  'scroll window right
     SCRLUP        CON $15  'scroll window up
     SCRLDN        CON $16  'scroll window down
     CHGCLR        CON $17  'change all colors in window to C (C follows)
     SCRSIZ        CON $1D  'set screen size (Rows, Columns follow)
     CLRW          CON $1E  'same as CLR, but can be used in strings.
     ESC           CON $1F  'escape next character C (i.e. print as-is) (C follows)
     ZERO          CON $FF  'can be used for 0, which is not allowed in strings, for command arguments
    
    '-------[ Variables ]----------------------------------------------------------
    
    i             VAR Word
    char          VAR Byte
    serdata       VAR Byte
    '-------[ Program starts here. ]-----------------------------------------------
    
    LOW io            'Reset the Propeller Backpack
    PAUSE 500
    INPUT io
    
    PAUSE 2000        'Wait for it to come out of reset.
    again:
    SERIN 15,396,[serdata]
    SEROUT io, baud, [DEFWIN, 1, 20, 2, 7, 9, USEWIN, 2, CHGCLR, 13]
    serdata =serdata + 1
    SEROUT 15,396,[serdata]
    SEROUT io, baud, [DEFCLR, 12, $AD, $0C]
    'SEROUT io, baud, [" ", DEC serdata, CR]
    SEROUT io, baud, [" ", DEC serdata]
    PAUSE 700
    GOTO again
    
    

    I used both the original Norland Research ides for connecting the calculator to the stamp to accept the numbers. And one of my previously known working programs to display numbers on a yellow background. I substituted the code he wrote for the gathering of data from the calculator for the whole number display routine which started this idea off. And for those of us who have both the calculator and the Stamp2 on a BOE and the BackPack it can be easily demonstrated.

    Oh and the code I started with is this:
    ' =========================================================================
    '
    '   File...... screentest1.bs2
    '   Purpose... screener
    '   Author.... GCL -- Jedi Knight Computers
    '   E-mail.... gregg@levine.name
    '   Started... 10 Mar 2014
    '   Updated... 11 Mar 2014
    '
    '   {$STAMP BS2}
    '   {$PBASIC 2.5}
    '
    ' =========================================================================
    
    ' -----[ Program Description ]---------------------------------------------
    
    ' This program outputs video to an NTSC color monitor via a Propeller
    ' Backpack module and demonstrates the various features of the video driver.
    
    
    ' -----[ I/O Definitions ]-------------------------------------------------
    
    io     PIN 15       ' Serial I/O pin for Propeller Backpack.
    
    ' -----[ Constants ]-------------------------------------------------------
    
    ' Baudrate definitions. Serial I/O must be open-drain. The Propeller Backpack
    ' includes a pullup internally.
    
    #SELECT $STAMP
      #CASE BS2, BS2E, BS2PE
        baud    CON  84 + 32768
      #CASE BS2SX, BS2P
        baud    CON  240 + 32768
      #CASE BS2PX
        baud    CON  396 + 32768
    #ENDSELECT
    
    ' The following is a table of "command" constants for the Propeller Backpack
    ' that can be copied to other programs. The ones that are commented are already
    ' defined by the BASIC Stamp Editor and perform the same functions as they
    ' would in a DEBUG screen.
    
    'CLS           CON $00  'clear screen
    'HOME          CON $01  'home
    'CRSRXY        CON $02  'set X, Y position (X, Y follow)
    'CRSRLF        CON $03  'cursor left
    'CRSRRT        CON $04  'cursor right
    'CRSRUP        CON $05  'cursor up
    'CRSRDN        CON $06  'cursor dn
     USECLR        CON $07  'use color C (C follows)
     BS            CON $08  'backspace
    'TAB           CON $09  'tab (8 spaces per)
    'LF            CON $0A  'linefeed
    'CLREOL        CON $0B  'clear to end of line
    'CLRDN         CON $0C  'clear down (to end of window)
    'CR            CON $0D  'return
    'CRSRX         CON $0E  'set X position (X follows)
    'CRSRY         CON $0F  'set Y position (Y follows)
     DEFWIN        CON $10  'define window  W (W, Left, Top, nCols, nRows follow)
     USEWIN        CON $11  'use window W (W follows)
     DEFCLR        CON $12  'define color C (C, FG, BG follow)
     SCRLLF        CON $13  'scroll window left
     SCRLRT        CON $14  'scroll window right
     SCRLUP        CON $15  'scroll window up
     SCRLDN        CON $16  'scroll window down
     CHGCLR        CON $17  'change all colors in window to C (C follows)
     SCRSIZ        CON $1D  'set screen size (Rows, Columns follow)
     CLRW          CON $1E  'same as CLR, but can be used in strings.
     ESC           CON $1F  'escape next character C (i.e. print as-is) (C follows)
     ZERO          CON $FF  'can be used for 0, which is not allowed in strings, for command arguments
    
    '-------[ Variables ]----------------------------------------------------------
    
    i             VAR Word
    char          VAR Byte
    
    '-------[ Program starts here. ]-----------------------------------------------
    
    LOW io            'Reset the Propeller Backpack
    PAUSE 500
    INPUT io
    
    PAUSE 2000        'Wait for it to come out of reset.
    
    SEROUT io, baud, [DEFWIN, 1, 20, 2, 7, 9, USEWIN, 2, CHGCLR, 13]
    SEROUT io, baud, [DEFCLR, 12, $AD, $0C]
    FOR W0 = 1000 TO 1050
    SEROUT io, baud, [" ", DEC W0, CR]
    PAUSE 700
    NEXT
    
    

    Suffice to say these programs are indeed a good suggestion for Parallax to revist the ideas for making the Prop BackPack again.
    ----
    Oh and this message is being supported by the friends of Dwarf Doc.
  • Buck,

    I was searching through the forums and I found that someone had already written code to interface directly to a TI calculator with a Propeller.
    https://forums.parallax.com/discussion/95591/ti-92-calculator-low-level-driver-checking-interest

    I happen to have an 83+ so one of these days I will try it out.
    Have you by chance seen breadboard friendly 2.5 or 3.5 mm jacks?
  • Genetix wrote: »
    Buck,

    I was searching through the forums and I found that someone had already written code to interface directly to a TI calculator with a Propeller.
    https://forums.parallax.com/discussion/95591/ti-92-calculator-low-level-driver-checking-interest

    I happen to have an 83+ so one of these days I will try it out.
    Have you by chance seen breadboard friendly 2.5 or 3.5 mm jacks?

    Not really regarding that idea. Mine was a regular 3.5 mm one attached to three jumpers, who were attached to the sort of cable used to connect a sound card to a device. Then a board was made up to accept the regular latching connector. (I had bought from Jameco one or more of the connectors those things attach to. Will be buying more.)

    Sparkfun also sells such the 3.5 mm ones but they are not easy to use. Read the comments on using them. To connect to my TI-83+ for my jig I tracked down a stereo cable along the lines of what could be used to connect to the auxiliary input on a sound card.
    Oh and here are the unmodified programs for all purposes. (I stuck the three of them into a Zip file because the forum software does not grok the kinds of files used for the Calculator. You do also have the gadget used by it to upload programming into it I hope. And for comparison I include the Stamp 1 version that Jon translated the BS2 one to so that you'd be able see what a difference it was between the two.
  • Buck,

    I don't have a TI connectivity cable which is why I liked the idea of talking directly to the TI with the Propeller.

    I've seen a PIC based translator online as well as descriptions of how the TI protocol works.
    I also disassembled the Z80 program that runs on the TI and bit-bangs the Link Port for standard serial.
    I've figured out what most of the Z80 program does but I don't know how the count-down value was derived.

    I could use an inline jack or a plug through a size adapter for now.
  • Genetix wrote: »
    Buck,

    I don't have a TI connectivity cable which is why I liked the idea of talking directly to the TI with the Propeller.

    I've seen a PIC based translator online as well as descriptions of how the TI protocol works.
    I also disassembled the Z80 program that runs on the TI and bit-bangs the Link Port for standard serial.
    I've figured out what most of the Z80 program does but I don't know how the count-down value was derived.

    I could use an inline jack or a plug through a size adapter for now.

    Oh wow.
    I believe Staples sill sells the kit. But you'll need to track down the right software as the disk hasn't been updated since the Win98 days. That's available on the TI site for the calculators. Oddly enough the description for the basic calculator on the Staples site insists that that the USB cable used for the job came with it. In my case it didn't. But that's another matter.
    ----
    Oh and this message is sponsored by the friends of the Dwarves of the Lonely Mountain.
  • Buck,

    The newer models use USB but the old models needed special adapter cables.
  • Genetix wrote: »
    Buck,

    The newer models use USB but the old models needed special adapter cables.

    Define one of those? Or do you mean that it contains a USB connector natively? I bring up the subject because you mentioned using a 3/32 stereo connector to connect to yours, and that's what my adapter device uses.

    Mine is one of the blue colored ones. I started with a different body model but the display got stuck and TI refused to let me send it in to be repaired.

    I worked out that it would cost more to send it in to be repaired, then to buy the one I am using which I bought used.

    At the different Maker Faire events held here each September or October every year now for the past six years so far, and for the past two or three has been an individual who shows just what anyone else can do with one of these. Search Hack A Day for the calculator. First time around I told him about the BS2 to TI83+ or BS1 to TI83+ and he was suitably impressed.

    I believe we're on the right track with everything so far anyway.
  • Buck,

    The TI-89 uses USB.

    I looked over that TI-92 Propeller code and it's about 95% complete.
    The basic Link Port code is there but it doesn't seem to do anything with the Acknowledgment from the calculator other than receive it.
    The main program send a few direct commands to the calculator and only a few things need to be changed to use the TI-83+.
    Also, the TI-83+ sends a 2nd Acknowledgement when it is done executing a command.
    The main program also uses a PC for input and output but the Propeller can use a PS/2 keyboard and mouse and a TV or VGA monitor.

    One experiment I would like to eventually try is send a series of X and Y values to the calculator and have it do statistics and regression and return the results.
    I have some data sets that I did with Excel and another statistical program so I can verify the results are correct.
  • Genetix wrote: »
    Buck,

    The TI-89 uses USB.

    I looked over that TI-92 Propeller code and it's about 95% complete.
    The basic Link Port code is there but it doesn't seem to do anything with the Acknowledgment from the calculator other than receive it.
    The main program send a few direct commands to the calculator and only a few things need to be changed to use the TI-83+.
    Also, the TI-83+ sends a 2nd Acknowledgement when it is done executing a command.
    The main program also uses a PC for input and output but the Propeller can use a PS/2 keyboard and mouse and a TV or VGA monitor.

    One experiment I would like to eventually try is send a series of X and Y values to the calculator and have it do statistics and regression and return the results.
    I have some data sets that I did with Excel and another statistical program so I can verify the results are correct.

    Aha. Now we are on to something. That code, (both of them) is about the TI-83+, not the TI-89, two completely different devices. Now which device from TI are you again interested in talking to? Remember they make several models, and this does not include the grossly over priced TI-Inspire one.
Sign In or Register to comment.