Shop OBEX P1 Docs P2 Docs Learn Events
20mV is high??? — Parallax Forums

20mV is high???

grkblood13grkblood13 Posts: 31
edited 2007-04-09 23:29 in BASIC Stamp
hey, can any1 tell me why this program for a set of tripwires wont read IN9 as 0 when it trips low to 20mV?
Aircraft_Ident VAR Word
Aircraft_pass VAR Word
Current_weight VAR Word
Aircraft_weight  VAR Word
Yes_No VAR Bit
 

begin:
IF IN9 = 0 AND IN10 = 1 THEN calc    'tells program to weigh'
IF IN9 = 1 AND IN10 = 0 THEN standby   'someone is walking through scale backwards'
IF IN9 = 1  AND IN10 = 1  THEN begin   'loops tripwire'
 
standby:
DO
IF IN9 = 1 OR IN10 = 1 THEN  begin   'this is just to make sure there are no glitches'
LOOP
 
calc:
location CON 0
i VAR Nib
total VAR Word
Aircraft_Ident = 0
Aircraft_Ident = 50              'test value
DEBUG DEC Aircraft_Ident
PAUSE 1000                       'delay to compensate for time to get on scale'
total = 0
FOR i = 1 TO 15
total = total + (INS & $01FF) - Aircraft_Ident     'takes reading from IN0 - IN8'
PAUSE 100                         'this delay is because the converter is running at 10 Hz'
NEXT
total = total / 15
WRITE location,total
DEBUG CR, DEC total

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-04-09 22:38
    Any action that depends on IN9 being zero also depends on IN10 being one. Are you sure BOTH conditions are being met?

    -Phil
  • grkblood13grkblood13 Posts: 31
    edited 2007-04-09 22:42
    they're both being met. the only thing that i can get to work is the both high case. ive got a multimeter hooked up and is reading about 15mV when low b/c i changed a resistor. but the prog still wont read low. the pins are arbitrarely reading high also, im guessing they're supposed to though
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-04-09 22:44
    Also, do you have pull-down resistor on those inputs so they are not floating high? Use a simple loop of ? IN9 and ? IN10 to watch their states. You don't say really how the electrical connections are.
    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-04-09 22:44
    Exactly how is the pin connected? If it’s floating in the LOW state it may not actually be LOW.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • grkblood13grkblood13 Posts: 31
    edited 2007-04-09 22:47
    i have the load wire from the tripwire coming into a node with a resistor running to ground and a wire from the node to the pin. when it trips the pin reads 15mv. when not tripped it read 7V
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-04-09 23:21
    Seven volts? Connected directly to the Stamp pin? You may have fried the input circuitry.

    -Phil
  • grkblood13grkblood13 Posts: 31
    edited 2007-04-09 23:29
    i can also run the resistor to Vdd and switch the order around.
    but i think it might be fried, i tried writing

    LOW 9
    LOW 10

    P10 would read low but P9 would read like 5 volts on the multimeter
Sign In or Register to comment.