Shop OBEX P1 Docs P2 Docs Learn Events
O'Scope Question — Parallax Forums

O'Scope Question

Fast MiconFast Micon Posts: 16
edited 2005-04-09 02:57 in BASIC Stamp
This is the Optascope plot of a led connected to a Stamp 1 pin.· The code that generates this is something like this:

LOW 7
do something
TOGGLE 7
do something
TOGGLE 7
return to main program

Why the voltage goes from 0V to 1V, then goes to 5V, then goes back to 1V before dropping to 0V again?

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-03-21 00:43
    It would be helpful to see the whole program and know what is connected to the pin.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • Fast MiconFast Micon Posts: 16
    edited 2005-03-21 00:47
    Here it goes:

    Main:
    · LOW pREDE···· ······················'Enables LTC1487 receiver
    · SERIN pRODI, cBaud, ($AA), vAddress, vCommand, vCounter···'Waits for sync byte, match ID and then reads command
    · IF vAddress <> cMyID THEN Main···············'Ignores message if not for the node
    · vCounter = vAddress + vCommand - vCounter
    · IF vCounter <> 0 THEN Main·················'Loops if checksum is not correct
    · IF vCommand = $00 THEN CircuitOff··············'Changes the behaviour of pActivity to signal that circuit is off
    · IF vCommand = $01 THEN CircuitOn··············'Changes the behaviour of pActivity to signal thet circuit is on
    CircuitOff:
    · LOW pActivity
    · GOTO StartRead
    CircuitOn:
    · HIGH pActivity
    StartRead:
    · GOSUB ReadTemp·······················'Reads the raw temperature parameters
    · TOGGLE pActivity
    · GOSUB XmitTemp
    · PAUSE 40
    · TOGGLE pActivity
    · GOTO Main
    · END

    I have a led attached to pActivity (which is I/O 7) with a 470ohm resistor.· The pin is sourcing.


    ·
  • BeanBean Posts: 8,129
    edited 2005-03-21 01:05
    The COMPLETE program would help more.
    Most likely you are setting the pin to an input somewhere, but without the complete program that's just a guess.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out· the "SX-Video Display Module"

    www.sxvm.com

    "A problem well defined, is a problem·half solved."
    ·
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-03-21 01:11
    The issue could be the use of TOGGLE -- it reads the state of the output port and then swaps it.· I suggest that you initialize the LED output to a known state before TOGGLE ever has a chance to run.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • Fast MiconFast Micon Posts: 16
    edited 2005-03-21 01:51
    Here goes the complete program:



    The schematic goes here:



    The other problem I have is very strange too.· When vCommand is $00 the progam works, with the strange behavior explained before.· When ·vCommand is $01 the Stamp resets.

    I really don't understand....
  • BeanBean Posts: 8,129
    edited 2005-03-21 02:26
    Sounds like you are drawing too much current at some point. This would explain the resetting and the odd voltage level.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out· the "SX-Video Display Module"

    www.sxvm.com

    "A problem well defined, is a problem·half solved."
    ·
  • Fast MiconFast Micon Posts: 16
    edited 2005-04-09 02:57
    I have checked everything and calculated currents again. No excesses whatsoever.

    I finally replaced the BS1 with a new one............and all works perfectly well again. I guess I have an ESD damaged BS1....

    Regards,

    Fernando
Sign In or Register to comment.