RCTIME help
Archiver
Posts: 46,084
THIS CODE IS FROM THE MANUAL
Result VAR Word 'Word variable to hold result.
HIGH 7 'Discharge the cap
PAUSE 1 'for 1 ms.
RCTIME 7, 1, Result 'Measure RC charge time.
DEBUG CLS, DEC Result 'Show value on screen.
END
I used an R=3.3k with a C=1uF. Everything was fine and i get result=1933.
I used an R=39k with a C=1uF. Everything was NOT fine and i get result=0. Why?
[noparse][[/noparse]Non-text portions of this message have been removed]
Result VAR Word 'Word variable to hold result.
HIGH 7 'Discharge the cap
PAUSE 1 'for 1 ms.
RCTIME 7, 1, Result 'Measure RC charge time.
DEBUG CLS, DEC Result 'Show value on screen.
END
I used an R=3.3k with a C=1uF. Everything was fine and i get result=1933.
I used an R=39k with a C=1uF. Everything was NOT fine and i get result=0. Why?
[noparse][[/noparse]Non-text portions of this message have been removed]
Comments
manual, and your series resistor is 220, so five time constants would be
1.1 milliseconds. Your code should be safe, but the cap may be more
that 1 uF and the resistor larger too, so bump your PAUSE duration to
two milliseconds.
Then, theoretically, your RCTIME for 39k and 1uF should be about 23400.
Perhaps your 39k resistor is actually 390k since your 3.3k and 1uF parts
return an expected value [noparse][[/noparse]you can estimate RCTIME = 600 x R (in K) x C
(in uF), and 600 x 3.3 x 1 = 1980]. If the value of the RCTIME exceeds
65535 (16-bit limit), it will return 0.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: MP1428@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=_zjN9f3psycAqnRTSStg0RxmvaPj51ZycTsdDeDOAVyJUt_YxmzA2DHCygobdRfUra7fOP4]MP1428@a...[/url
Sent: Friday, October 10, 2003 9:05 PM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] RCTIME help
THIS CODE IS FROM THE MANUAL
Result VAR Word 'Word variable to hold result.
HIGH 7 'Discharge the cap
PAUSE 1 'for 1 ms.
RCTIME 7, 1, Result 'Measure RC charge time.
DEBUG CLS, DEC Result 'Show value on screen.
END
I used an R=3.3k with a C=1uF. Everything was fine and i get
result=1933. I used an R=39k with a C=1uF. Everything was NOT fine and i
get result=0. Why?
[noparse][[/noparse]Non-text portions of this message have been removed]
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
This message has been scanned by WebShield. Please report SPAM to
abuse@p....