RC time
Archiver
Posts: 46,084
Does any one the practical limits of R & C on the RC time command? In
other words would it be possible to accurately measure capacitance of
around 10 pf to 75 pf?
thanks for your help.
Leroy Hall
other words would it be possible to accurately measure capacitance of
around 10 pf to 75 pf?
thanks for your help.
Leroy Hall
Comments
>other words would it be possible to accurately measure capacitance of
>around 10 pf to 75 pf?
Hi Leroy,
The RCtime command is at best good for about 10 bits of accuracy.
That is when you can achieve an RC time constant of around 1000
counts (2000 microseconds). With 10pf, the R required would be ~200
megaohms, which is not practical.
Now, say you have a 1 megaohm resistor, the RC time constant will be
roughly 10 microseconds, which is an RCTIME count of only 5. So that
is not what you would call, "accurate". Even with 10 megs R, the
count is only ~50.
You also have to consider that the input pin of the PIC or SX chip
itself has a capacitance of ~5pf, plus whatever leadframe and wiring
capacitance there is in your layout. (Warning to those using white
block breadboards--the capacitance between nodes is a whopping
~300pf).
For those small capacitances, you are probably better off using an
external IC, even a '555, to generate a frequency you can measure
with the COUNT or PULSIN command.
-- regards,
Tracy Allen
electronically monitored ecosystems
mailto:tracy@e...
http://www.emesystems.com
>
>thanks for your help.
>
>Leroy Hall
I am trying to use the RC time with a BS2 and I can't get it to
work. If you put a resistor and cap in parallel, isn't that an RC
time constant? I don't know if my code is wrong or what the problem
is. Can anyone point me in the right direction or help me with some
code.
Thanks,
Chris
code.
-- Jon Williams
-- Parallax
In a message dated 12/7/02 6:50:25 PM Central Standard Time,
CHRIS@R... writes:
> Hi everyone,
>
> I am trying to use the RC time with a BS2 and I can't get it to
> work. If you put a resistor and cap in parallel, isn't that an RC
> time constant? I don't know if my code is wrong or what the problem
> is. Can anyone point me in the right direction or help me with some
> code.
>
> Thanks,
>
> Chris
>
[noparse][[/noparse]Non-text portions of this message have been removed]
--- In basicstamps@yahoogroups.com, jonwms@a... wrote:
> Both the manual and the compiler help file show the proper
connections and
> code.
>
> -- Jon Williams
> -- Parallax
>
> In a message dated 12/7/02 6:50:25 PM Central Standard Time,
> CHRIS@R... writes:
>
>
> > Hi everyone,
> >
> > I am trying to use the RC time with a BS2 and I can't get it to
> > work. If you put a resistor and cap in parallel, isn't that an
RC
> > time constant? I don't know if my code is wrong or what the
problem
> > is. Can anyone point me in the right direction or help me with
some
> > code.
> >
> > Thanks,
> >
> > Chris
> >
>
>
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
-- Jon Williams
-- Parallax
In a message dated 12/7/02 7:09:16 PM Central Standard Time,
CHRIS@R... writes:
> What is the compiler?
>
[noparse][[/noparse]Non-text portions of this message have been removed]
I did not ask that question but I was wandering if you could help me.
I have very little programming experience but I have very technical
background in electronics.
I am building a project and I need help on some coding.
I am building 3 seperate control boards with a n/o momentary switch and a
led circuit to flash on each board.
I want to push all 3 switches at once, and let my stamp determine which
board pushed first and light up only that boards led circuit to flash and
then push a reset button to start it again.
An a example would be like a 3 contestant game show. The first one to push
their button the fastest, their podium light will flash.
I have most of the circuits designed just don't know how to start my code.
Thanks,
Todd Kaiser
Original Message
From: <jonwms@a...>
To: <basicstamps@yahoogroups.com>
Sent: Saturday, December 07, 2002 9:51 PM
Subject: Re: [noparse][[/noparse]basicstamps] Re: RC TIME
> The editor/compiler is what you use to program BASIC Stamps.
>
> -- Jon Williams
> -- Parallax
>
> In a message dated 12/7/02 7:09:16 PM Central Standard Time,
> CHRIS@R... writes:
>
>
> > What is the compiler?
> >
>
>
>
>
> [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/
>
>
>
think I'm encouraging bad ("quick and dirty") coding habits. Please download
StampWorks from our web site -- it will help you to understand this little
program.
sw1 VAR In0
sw2 VAR In1
sw3 VAR In2
rst VAR In3
Leds VAR OutB
Led1 VAR Out4
Led2 VAR Out5
Led3 VAR Out6
Setup:
Leds = %0000
DirB= %0111
Check_1:
IF (sw1 = 1) THEN Check_2 ' not pressed
Led1 = 1 ' turn LED on
GOTO Wait_For_Reset
Check_2:
IF (sw2 = 1) THEN Check_3
Led2 = 1
GOTO Wait_For_Reset
Check_3:
IF (sw3 = 1) THEN Check_1
Led3 = 1
GOTO Wait_For_Reset
Wait_For_Reset:
IF (rst = 1) THEN Wait_For_Reset
Leds = %0000
GOTO Check_1
This program assumes inputs are active low -- that is, they are normally
pulled up to 5 volts [noparse][[/noparse]through 10K] until a N.O. button them to ground. The
LEDs are active high. Connect the LED outputs to LEDs through suitable
current limiting resistors [noparse][[/noparse]470 ohms].
Consult the manual and the StampWorks book to fully understand the program.
Basically, when a button is pressed, the associated LED is lit and will stay
lit until you press the reset button. This is a very simplistic approach.
You could also grab all three inputs at once, then scan the captured inputs.
Try this version first; then upgrade it as you improve your programming
skills.
-- Jon Williams
-- Parallax
In a message dated 12/7/02 9:26:57 PM Central Standard Time,
tkaiser@w... writes:
> John,
> I did not ask that question but I was wandering if you could help me.
>
> I have very little programming experience but I have very technical
> background in electronics.
>
> I am building a project and I need help on some coding.
>
> I am building 3 seperate control boards with a n/o momentary switch and a
> led circuit to flash on each board.
>
> I want to push all 3 switches at once, and let my stamp determine which
> board pushed first and light up only that boards led circuit to flash and
> then push a reset button to start it again.
>
> An a example would be like a 3 contestant game show. The first one to push
> their button the fastest, their podium light will flash.
>
> I have most of the circuits designed just don't know how to start my code.
>
> Thanks,
>
>
[noparse][[/noparse]Non-text portions of this message have been removed]
writes:
Jon Williams is the "guru," however, I strongly suggest you use his second
suggestion to grab all inputs at once. The reason is as follows, if you want
to be really "precise" with your idea.....
What can happen is this: The code Jon suggested checks each switch one at a
time, the first sw, the second sw, then the third sw and then repeats the
checks. It takes a some time (not much, maybe 500 us) to check the status of
each sw before it checks the next sw.
In theory, the person who pushes button one can get screwed if .....the stamp
checks pin one, and during the time the stamp is checking pin 2, user 1 and 3
both press their button, but user one presses before user three. Since the
stamp just finished checking user 1 and is about to check user 3, the stamp
will indicate user 3 was first when in reality user one was first.
The chances of this occuring are remote, but if you want to be precise, this
method is just as easy to code, and more exact to meet your requirement.
My syntax below might be wrong (stamp book is at work and I don't use it much
more in favor of the SXAC because it is "lighting fast" compared to the stamp
and $50 cheaper. But at the same time, the Stamp is MUCH EASIER to write code
for)
Anyway, you can read the status of 4 input pins at once as follows (again
syntax might be wrong)
buttons var nib
buttons = INA 'which will grab the status of pin 0, pin 1, pin 2 and pin
3.
'Tie the unwanted input pin low. Once you grab the nibble (4 bit value INA)
buttons = INA AND %0111 'this assumes that bit 4 (pin 3 is the unwanted pin)
Then check the which bit is low, p0, p1 or p2 using the code Jon wrote
Again, if you want to be more "precise", use the second suggestion from Jon,
that is read all pins at once for the reason I described. I actually made
this circuit once (Like the Jeapordy game....who pressed first) just using
four IC's, which is a much cheaper solution than the stamp with one draw
back, that is the time to wire it.
That is what is so beautiful about the Basic Stamp, its ease of use. I used
to build all kinds of "custom" hobby circuits from discrete IC's. The Basic
Stamp can save lots of time for some extra $$. It's all a trade off......
if you want details on the discrete IC circuit I would be glad to share it
with you.
Regards
>
> This program assumes inputs are active low -- that is, they are normally
> pulled up to 5 volts [noparse][[/noparse]through 10K] until a N.O. button them to ground. The
>
> LEDs are active high. Connect the LED outputs to LEDs through suitable
> current limiting resistors [noparse][[/noparse]470 ohms].
>
> Consult the manual and the StampWorks book to fully understand the program.
>
> Basically, when a button is pressed, the associated LED is lit and will
> stay
> lit until you press the reset button. This is a very simplistic approach.
>
> You could also grab all three inputs at once, then scan the captured
> inputs.
> Try this version first; then upgrade it as you improve your programming
> skills.
>
> -- Jon Williams
> -- Parallax
[noparse][[/noparse]Non-text portions of this message have been removed]
one especially. I have been throwing ideas around as to how I can make one
of these, and I was wondering if I could see your discrete IC circuit. Thank
you very much.
Matthew Mangione
Original Message
From: smartdim@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=IRx3slzIy6ogkKZ5tkjrmO5WsOewH4l2zv4Ly5yU_vl5Z5s5yk7eECx1AuZc1z_xlJNqk2cB9FowZ0g]smartdim@a...[/url
Sent: Sunday, December 08, 2002 12:17 AM
To: basicstamps@yahoogroups.com; JonWms@a...
Subject: Re: [noparse][[/noparse]basicstamps] Re: RC TIME
In a message dated 12/7/2002 8:01:00 PM Pacific Standard Time,
jonwms@a...
writes:
Jon Williams is the "guru," however, I strongly suggest you use his second
suggestion to grab all inputs at once. The reason is as follows, if you want
to be really "precise" with your idea.....
What can happen is this: The code Jon suggested checks each switch one at a
time, the first sw, the second sw, then the third sw and then repeats the
checks. It takes a some time (not much, maybe 500 us) to check the status of
each sw before it checks the next sw.
In theory, the person who pushes button one can get screwed if .....the
stamp
checks pin one, and during the time the stamp is checking pin 2, user 1 and
3
both press their button, but user one presses before user three. Since the
stamp just finished checking user 1 and is about to check user 3, the stamp
will indicate user 3 was first when in reality user one was first.
The chances of this occuring are remote, but if you want to be precise, this
method is just as easy to code, and more exact to meet your requirement.
My syntax below might be wrong (stamp book is at work and I don't use it
much
more in favor of the SXAC because it is "lighting fast" compared to the
stamp
and $50 cheaper. But at the same time, the Stamp is MUCH EASIER to write
code
for)
Anyway, you can read the status of 4 input pins at once as follows (again
syntax might be wrong)
buttons var nib
buttons = INA 'which will grab the status of pin 0, pin 1, pin 2 and pin
3.
'Tie the unwanted input pin low. Once you grab the nibble (4 bit value INA)
buttons = INA AND %0111 'this assumes that bit 4 (pin 3 is the unwanted
pin)
Then check the which bit is low, p0, p1 or p2 using the code Jon wrote
Again, if you want to be more "precise", use the second suggestion from Jon,
that is read all pins at once for the reason I described. I actually made
this circuit once (Like the Jeapordy game....who pressed first) just using
four IC's, which is a much cheaper solution than the stamp with one draw
back, that is the time to wire it.
That is what is so beautiful about the Basic Stamp, its ease of use. I used
to build all kinds of "custom" hobby circuits from discrete IC's. The Basic
Stamp can save lots of time for some extra $$. It's all a trade off......
if you want details on the discrete IC circuit I would be glad to share it
with you.
Regards
>
> This program assumes inputs are active low -- that is, they are normally
> pulled up to 5 volts [noparse][[/noparse]through 10K] until a N.O. button them to ground.
The
>
> LEDs are active high. Connect the LED outputs to LEDs through suitable
> current limiting resistors [noparse][[/noparse]470 ohms].
>
> Consult the manual and the StampWorks book to fully understand the
program.
>
> Basically, when a button is pressed, the associated LED is lit and will
> stay
> lit until you press the reset button. This is a very simplistic approach.
>
> You could also grab all three inputs at once, then scan the captured
> inputs.
> Try this version first; then upgrade it as you improve your programming
> skills.
>
> -- Jon Williams
> -- Parallax
[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/
fax a schematic Monday.....
Sorry, 5 IC's.....not 4, still less than $10.00
The heart of the circuit it a HEX, Quad or Octal D Flip Flop (ex 74HC174, or
74HC175 or 74HC273) depending on how many switches you want to monitor.
Lets say 4 inputs (switches) for example
Connected to the clock input of the D FF is a logic level pulse from the
output of a 74HC20 4 input nand gate. The input to two of the pins of the
74HC20 come from a 555 timer that is running at 1k hertz or much higher. If
you run the 555 (or other device) at 1k hz the switch status is checked every
millisecond. If you run the 555 at 10k hz the switch status is checked every
100 uS. You can even go up to 50kHz or higher.
Anyway, a logic level frequency goes to the clock input of the D Flip Flop,
but through the nand gate. You will see why later. (I actually ran the output
of the 555 to the base of a 2n3904 transistor through 63k ohms. Emitter of
the 3904 to ground and the colletor to 5 volts through 10k ohms and the
collector to the input of the nand gate. This will ensure the clock input of
the FF goes all the way to 5 volts and darn close to 0 volts as the 555
output typically falls short of making good logic level voltages)
The HC174 has 6 D inputs...
FOUR INPUTS of the D Flip flop will have the following:
(The other 2 inputs tie to ground)
10K ohms to +5 volts and to one side of a normally open switch.
The other end of the N.O. switch to ground.
The four Q outputs of the D FF that correspond to the four D inputs used (D1
- Q1, D2, Q2 etc) will have the following (the two unused ones leave open, no
connection):
The Q outputs will go to TWO places:
1) the input terminal of a 4 input nand gate (like a 74HC20)
2) the input terminal of a buffer (like a 74HC125)
All "C" terminals of theHC125 to ground
Each output of the HC125 to an LED through 470 ohms to +5 volts
The output of the nand gate goes to the input of an XOR gate (like a 7486)
The other input of the XOR gate goes to one terminal of a normally open
switch, the other end of the switch to ground.
The output of the XOR gate goes to the other two pins of the remaining nand
gate that has the output of the 555 timer.(the 74HC20 has two 4 input nand
gates)
The other two pins of the HC20 get connected to the collector of the 2n3904
as previously described.
So.....this is how it works (I will probably need to fax a schematic!!)
1) With no switch pressed the input to each D FF (ignore the two FF D inputs
grounded) if HIGH
2) Each output of the D FF is HIGH
3) Each output of the HC125 output is HIGH turning off each LED
4) The output of the 4 input nand gate (the one connected the Q outputs of
the FF) LOW
5) The XOR gate has one input HIGH via the reset switch not pressed and one
input LOW from the output described in 4 above
6) The XOR output is HIGH and connected to the "other" 4 input nand gate,
this allows the 1kHz 555 signal to get through to the D FF.
7) Every clock edge of to the D FF the input switches are check.
NOW, WHEN SOMEBODY PRESSES A SWITCH THIS IS WHAT HAPPENS
1) The D input of the HC174 is LOW, making the Q output LOW.
2) The input of the HC20 buffer is LOW making the output LOW turning of the
LED
3) At the instant the output of the HC174 goes LOW the input of the 4 input
nand gate (the one connected to the Q outputs of the D FF) goes HIGH
4) Step 3 makes both inuts to the XOR gate high which makes it output LOW
5) Step 4 makes two of the inputs of the "2nd" nand gate LOW effective
shutting off the clock input to the D FF.
At this point the circuit is "latched" with whatever switch went low.
To reset the circuit when you push the rest switch the clock pulses then go
to the HC174 and as long as none of the user switches are pushed, all LEDs
are off and again the circuit is checking the status of switches every
1/clock frequency
WHEW!!!! Whats your fax number. About 1/2 way through I realized this is
not easy to explain how to wire it. As they say a picture (schematic) is
worth a thousand words. How true in this case!!
Again, if will fax a schematic if you want and can provide more explanation
is needed....
Good luck!
[noparse][[/noparse]Non-text portions of this message have been removed]
You might be interested in the program "state machine: game show" posted at
http://www.emesystems.com/BS2fsm.htm
This is a tight 4-line program that shows the first, second and third
place finishers by the rate of flashing of the lights. The program
came from a question on this list a while back.
-- Tracy
>John,
> I did not ask that question but I was wandering if you could help me.
>
>I have very little programming experience but I have very technical
>background in electronics.
>
>I am building a project and I need help on some coding.
>
>I am building 3 seperate control boards with a n/o momentary switch and a
>led circuit to flash on each board.
>
>I want to push all 3 switches at once, and let my stamp determine which
>board pushed first and light up only that boards led circuit to flash and
>then push a reset button to start it again.
>
>An a example would be like a 3 contestant game show. The first one to push
>their button the fastest, their podium light will flash.
>
>I have most of the circuits designed just don't know how to start my code.
>
>Thanks,
>
>Todd Kaiser
>
>
>
>
Original Message
>From: <jonwms@a...>
>To: <basicstamps@yahoogroups.com>
>Sent: Saturday, December 07, 2002 9:51 PM
>Subject: Re: [noparse][[/noparse]basicstamps] Re: RC TIME
>
>
> > The editor/compiler is what you use to program BASIC Stamps.
> >
> > -- Jon Williams
> > -- Parallax
> >
> > In a message dated 12/7/02 7:09:16 PM Central Standard Time,
> > CHRIS@R... writes:
> >
> >
> > > What is the compiler?
> > >
> >
> >
> >
> >
> > [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/
> >
> >
> >
>
>
>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/