Shop OBEX P1 Docs P2 Docs Learn Events
Back to TI-83Plus and Stamps — Parallax Forums

Back to TI-83Plus and Stamps

Buck RogersBuck Rogers Posts: 2,178
edited 2011-09-21 11:27 in BASIC Stamp
Hello!
This is the code I am using:
' {$STAMP BS1}
' {$PBASIC 1.0}

SYMBOL serData = B2

Main:
SERIN 7, T2400, serData
DEBUG serData
serData = serData + 1
DEBUG serDATA
SEROUT 7, T2400, (serData)
DEBUG serDATA
OUTPUT 0
PIN0 = 1
DEBUG serDATA
PAUSE 500
PIN0 = 0
INPUT 1
DEBUG PIN1
DEBUG PIN0
GOTO Main

It is based on this translation:
' {$PBASIC 1.0}

SYMBOL serData = B2

Main:
SERIN 7, T2400, serData
DEBUG serData
serData = serData + 1
SEROUT 7, T2400, (serData)
GOTO Main

The idea came from this article:
http://smallrobot.bizland.com/bs2ti.html

In it he provides three examples. Two for the calculator, and one for a BS2. I had the program translated to that spoken by a BS1 by one of the good people here.

In it he describes the numbers displayed on the calculator.

This is the stamp2 program as I understand it:
' {$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 this is what I came up with for the Stamp2 for the same idea, and whilst running that same stamp I came up with a series of ideas that, ah, rattled my collection of logic.

Now the point of all this, can someone spot the reasoning why I'm not getting the numbers on my calculator when running the Stamp1 version, and normally getting them on the Stamp2 version?

Comments

  • dandreaedandreae Posts: 1,375
    edited 2011-09-21 07:57
    Are you able to use an oscilloscope to view the data? this may help determine if the calculator is receiving the correct data.

    Dave
  • Buck RogersBuck Rogers Posts: 2,178
    edited 2011-09-21 09:16
    dandreae wrote: »
    Are you able to use an oscilloscope to view the data? this may help determine if the calculator is receiving the correct data.

    Dave

    Hello!
    I did that the first time around. I confirmed that the calculator was indeed receiving the correct data.

    I'll keep investigating.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2011-09-21 10:47
    Well, if I had to guess, it would seem that in the BS2 program you're expecting continuous data from the calculator. So, without knowing how it operates I am guessing it is sending back data to the BS2. However, in the BS1 program once you've sent the return data you do something (presumably light an LED?) and PAUSE, missing any data coming back into the BS1. If you remove the section with the PAUSE commands it should work. The problem I think is you're comparing two programs that don't do the same thing. If you made the BS2 program do what the BS1 program is doing with the extra pins and PAUSE commands it wouldn't work either.
  • Buck RogersBuck Rogers Posts: 2,178
    edited 2011-09-21 11:27
    Well, if I had to guess, it would seem that in the BS2 program you're expecting continuous data from the calculator. So, without knowing how it operates I am guessing it is sending back data to the BS2. However, in the BS1 program once you've sent the return data you do something (presumably light an LED?) and PAUSE, missing any data coming back into the BS1. If you remove the section with the PAUSE commands it should work. The problem I think is you're comparing two programs that don't do the same thing. If you made the BS2 program do what the BS1 program is doing with the extra pins and PAUSE commands it wouldn't work either.

    Hello!
    An excellent guess. As it happens Chris and Dave, I've found and loaded the original BS2 ones, and indeed recreated my original prototype for a Basic Stamp2 board. I also spent yesterday online tracking down the resources for the calculator I did not have here. I refreshed the programming on the unit.

    It's got me reaching for a dictionary of four-letter words.

    I will now present the programs being used: (original program from site)
    ' {$STAMP BS2}
    ' {$PBASIC 2.0}
    
    serdata   VAR   Byte
    
    again:
    '*****this will wait for serial from calculator
    DEBUG DEC serdata, CR
    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]
    DEBUG DEC serdata, CR
    GOTO again
    

    And then this one: (One of my edits)
    ' {$STAMP BS2}
    ' {$PBASIC 2.0}
    
    serdata   VAR   Byte
    
    again:
    '*****this will wait for serial from calculator
    DEBUG DEC serdata, CR
    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]
    DEBUG DEC serdata, CR
    GOTO again
    

    Even with a minor change it does indeed work as described.

    Some history now: I saw the original discussions on the old Yahoo group, obtained the calculator about the same time. I had Jon Williams translate the original to the Stamp1 style. And then went ahead and did the steps I outlined in the first note.

    The layout of the original program all but compelled me to work out how to obtain a Stamp2. Then one was being given away. That's how I obtained the Stamp2 being used here.

    By the time we reach when I posted the beginnings there,(Original messages discussing a theory in eight bits), I had gotten to the point where I felt I could hang stuff off of the original program, and yes I did have it triggering a blink from an LED. In fact one of the Stamp1 programs does do that, through logic.

    I'll keep working on it, and advise. (Its what's called "Investigate and advise".)
Sign In or Register to comment.