Shop OBEX P1 Docs P2 Docs Learn Events
Digital signal monitor - please help — Parallax Forums

Digital signal monitor - please help

MeepoMeepo Posts: 24
edited 2007-06-28 20:00 in BASIC Stamp
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...

Comments

  • Vern GranerVern Graner Posts: 337
    edited 2007-06-26 22:31
    Meepo said...
    I'm trying to monitor asynchronous serial commands
    <snip>
    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.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Vern Graner CNE/CNA/SSE    | "If the network is down, then you're
    Senior Systems Engineer    | obviously incompetent so why are we
    Texas Information Services | paying you? Of course,if the network
    http://www.txis.com        | is up, then we obviously don't need
    Austin Office 512 328-8947 | you, so why are we paying you?" ©VLG
    
    
  • MeepoMeepo Posts: 24
    edited 2007-06-28 12:19
    I may download that program, but for my own benefit, I'd really like to know what is wrong with the above code...as fasr as I can see it should work, but doesn't...
  • FranklinFranklin Posts: 4,747
    edited 2007-06-28 14:36
    try a label and a goto on the outside loop. Also what "does not work"?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-06-28 15:05
    What do you have on the inputs of P8 and P9? If it 'floats' (in other words, doesn't give you a hard +5 or a hard 0 volts) then P8 and P9 will trigger 'randomly' (actually, at a 60 HZ rate, there's a lot of 60Hz 'noise' an unterminated input pin will pick up).
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-06-28 15:30
    Have you considered the relative baud rates of the external system versus DEBUG? Each time DEBUG outputs, it prints six characters; and when this happens, your program is deaf for more than 6mS while it does the output. (6 characters * 10 bits/char / 9600 bits/sec = 6.25 mS.) What's coming from the external system during this time that you're missing?

    -Phil
  • MeepoMeepo Posts: 24
    edited 2007-06-28 18:41
    Pin 8 is the clock and pin 9 the serial line. My first post describes the problem. I hadn't considered the Debug pause, that may explain why I keep getting the same signals outputted, when it should only print a change. I'll try a signal buffer, as well as putting a delay in the source program to slow down the output. I'm not sure of the relative baud rate, though it's probably slower than 9600.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-06-28 19:10
    It needs to be considerably slower than 150 baud for your scheme to work.

    -Phil
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-06-28 20:00
    For $200 or so, the ANT-8 makes a really nice 8-channel digital capture logic analyzer. That might help you more.
Sign In or Register to comment.