Shop OBEX P1 Docs P2 Docs Learn Events
RCTime — Parallax Forums

RCTime

CarloCarlo Posts: 23
edited 2005-04-26 22:29 in BASIC Stamp
Hi guys,

I wonder if you can help me one more time...

I am trying to learn how to use RCTIME so I connected a photoresistor·(Resistance @ 1Ftc 9K, Typical resistance @100 Ftc 400R, Min dark resistance 1M) and a capacitor (0.1uF 16V) as drawn on the BS manual and copied the program. The problem is that the number that are displayed on the Debug window range from 1000 to 9000 then go back to 1000 and up to 9000 and so fourth. I was wondering if this is supposed to happen or I am doing something wrong, and if there is a way to limit the range so that the scale doesn't repeat itself?

this is the code I used:

RC············· PIN···· 14
result········· VAR···· Word

Main:
· DO
··· HIGH RC···························· ' charge the cap
··· PAUSE 1···························· '·· for 1 ms
··· RCTIME RC, 1, result··············· ' measure RC discharge time
··· DEBUG result············· ' display value
··· PAUSE 500
· LOOP
· END



Thanks
Carlo

·

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-04-26 22:18
    Assumin you copied the code right out of your editor, you should change the DEBUG line to:

    DEBUG DEC result, CR

    -- otherwise, you'll get potentially unreadable output since DEBUG goes direct to the terminal and needs to know when the data you're sending is a number for display.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • CarloCarlo Posts: 23
    edited 2005-04-26 22:29
    Thanks a lot it works!!!!

    I had copied that line wrong, however I had used the example code for RCTIME included in the BASIC STAMP Editor which reads:

    DEBUG HOME, DEC result ' display value

    which gave me the problem above.

    Anyway it works now!! Thanks again!

    Carlo
Sign In or Register to comment.