Shop OBEX P1 Docs P2 Docs Learn Events
Beeping when requesting an INPUT 7 on the Stamp — Parallax Forums

Beeping when requesting an INPUT 7 on the Stamp

Buck RogersBuck Rogers Posts: 2,181
edited 2011-10-07 21:58 in BASIC Stamp

Hello!
I've taken the original BS2 to TI83 Plus program and added some features to it. Yes it is blinking LEDs but they are filtered via logic. This is the program involved:
' {$STAMP BS2}
' {$PBASIC 2.0}

serdata   VAR   Byte
Z         VAR   Byte
FOR Z=1 TO 128:
'*****this will wait for serial from calculator
SERIN 0,396,[serdata]

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

'***this will send the same data plus 1 back to the calculator
serdata=serdata + 1
SEROUT 0,396,[serdata]
DEBUG HEX serdata, CR
SEROUT 1,396,[serdata]
DEBUG DEC Z, CR
OUTPUT 2
OUTPUT 3
OUTPUT 4
OUTPUT 5
INPUT 7
SEROUT 6,396,[serdata]
DEBUG HEX serdata, CR
DEBUG 7
NEXT
END

Okay here is the input line:
INPUT 7


And I also included a line to tell me if there is an input to read from:
DEBUG 7


Even with the logic output not active it still makes the ding noise.

Is it because of the chosen P7 line that I'm getting it,as if the stamp is delivering a character 7 to the debug terminal? But the logic behind that statement might be invalid because of the other statement.... I don't know.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-10-07 20:27
    "DEBUG 7" sends the character $07 to the PC and this byte value is called BEL. Guess why? Once upon a teletype it rang the bell.

    "INPUT 7" sets I/O pin 7 to input mode. It doesn't actually read the state of the I/O pin. Read the BASIC Stamp Syntax and Reference Manual chapter on the INPUT statement for details.

    These two instances of 7 are completely unrelated.

    I don't know why you have the OUTPUT 2, OUTPUT 3, etc. These statements just set the specified I/O pin to output mode. They don't specify which state (high or low) they're to have although the default is low.
  • Buck RogersBuck Rogers Posts: 2,181
    edited 2011-10-07 21:58
    Mike Green wrote: »
    "DEBUG 7" sends the character $07 to the PC and this byte value is called BEL. Guess why? Once upon a teletype it rang the bell.

    "INPUT 7" sets I/O pin 7 to input mode. It doesn't actually read the state of the I/O pin. Read the BASIC Stamp Syntax and Reference Manual chapter on the INPUT statement for details.

    These two instances of 7 are completely unrelated.

    I don't know why you have the OUTPUT 2, OUTPUT 3, etc. These statements just set the specified I/O pin to output mode. They don't specify which state (high or low) they're to have although the default is low.

    Hello!
    I had an inspired guess as to what was happening after I sent that off. As for the OUTPUT 2 and OUTPUT 3 entries, and the other two, I've got them connected to the logic entries that need to be turned on at program start up. They were supposed to do something else, but that's where my reasoning, took a walk. I'll need to read on that usage as well.

    I'll keep working at it, but now that I've got that one down, our old friend BEL who was the ringer on the teletypes during that timeperiod, it answers my questions. And of course I'll read the corresponding entries you've cited. It seems I do need a refresher course on programming the stamp. It happens to us all I should think.
Sign In or Register to comment.