Shop OBEX P1 Docs P2 Docs Learn Events
where did I go wrong? — Parallax Forums

where did I go wrong?

martintelefontmartintelefont Posts: 9
edited 2008-03-29 16:23 in BASIC Stamp
Hi all
well I tried to adapt some stamp 1 code to the stamp 2. Basic scenario P0 connects to a 10k thermistor which connects to a .1 uF capacitor which goes to ground
on the debug i get "c" when DEBUG W0 or "162" when DEBUG DEC
Any thoughts?

' {$STAMP BS2}
' {$PBASIC 2.5}
' Program THERM.BAS

co0 CON 162
co1top CON 255
co1btm CON 2125
co2bt1 CON 25
co2top CON 3
co2btm CON 50

Check_temp:
RCTIME 0,46,W0

W1 = W0*W0/co2bt1*co2top/co2btm
W0 = W0*co1top/co1btm+W0
W0 = co0+W1-W0

DEBUG DEC W0
PAUSE 1000 ' Wait 1 second for next
GOTO Check_temp ' temperature reading.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-29 16:23
    Look here for "BS1 and BS2 Conversion Tips": www.parallax.com/tabid/440/Default.aspx.

    Also remember that the BS2 has different timing than the BS1 (like for RCTIME) and that expressions are not always evaluated from left to right on the BS2 as they are on the BS1. You can use parentheses on the BS2 to group items the way you want them.
Sign In or Register to comment.