Digital signal monitor - please help
Meepo
Posts: 24
I'm trying to monitor asynchronous serial commands sent from another project, so I'm trying to use a HomeWork Board as a sort of oscilloscope. Here's the code I'm using, which doesn't work:
' {$STAMP BS2}
' {$PBASIC 2.5}
op8 VAR Bit
op9 VAR Bit
change VAR Bit
p8 PIN 8
p9 PIN 9
DEBUG CR
INPUT 8
INPUT 9
change = 0
DO
DO UNTIL change=1
IF op8 <> p8 THEN change=1
IF op9 <> p9 THEN change = 1
LOOP
op8 = p8
op9 = p9
change = 0
IF op8 = 1 THEN
DEBUG " I"
ELSE
DEBUG "I "
ENDIF
DEBUG " "
IF op9=1 THEN
DEBUG " I"
ELSE
DEBUG "I "
ENDIF
DEBUG CR
LOOP
What am I doing wrong? Basically I want to tilt my head to the right and read the data stream. As far as I can see, I shouldn't get a readout until either 8 or 9 changes, but I keep seeing the same signals repeated, and though I know the device I'm monitoring is sending the correct commands, I'm not seeing these commands displayed...
' {$STAMP BS2}
' {$PBASIC 2.5}
op8 VAR Bit
op9 VAR Bit
change VAR Bit
p8 PIN 8
p9 PIN 9
DEBUG CR
INPUT 8
INPUT 9
change = 0
DO
DO UNTIL change=1
IF op8 <> p8 THEN change=1
IF op9 <> p9 THEN change = 1
LOOP
op8 = p8
op9 = p9
change = 0
IF op8 = 1 THEN
DEBUG " I"
ELSE
DEBUG "I "
ENDIF
DEBUG " "
IF op9=1 THEN
DEBUG " I"
ELSE
DEBUG "I "
ENDIF
DEBUG CR
LOOP
What am I doing wrong? Basically I want to tilt my head to the right and read the data stream. As far as I can see, I shouldn't get a readout until either 8 or 9 changes, but I keep seeing the same signals repeated, and though I know the device I'm monitoring is sending the correct commands, I'm not seeing these commands displayed...
Comments
Ok so monitoring a serial stream seems to be the ultimate goal of the exercise, not so much the troubleshooting of the BSII code. [noparse]:)[/noparse] If so, you might want to have a look at this very useful free program:
http://www.serial-port-monitor.com
I've used it very successfully to capture data streams going to/from my PC and an external serial device (such as a uMP3 or a Soundgin etc.).
Hope that helps.
[noparse]:)[/noparse]
Vern
PS: I don't have any affiliation with the above company, I just found them in a google search a while back and thought I'd share my experience.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
-Phil
-Phil