Activity #2 - What's A Microcontroller?
TheTech69
Posts: 51
Is the RCTIME command to be ONLY used with potentiometers,humidity, and temperature sensors? I am trying to figure out how to use RCTIME with discrete passive components to get the same values as I got with the PBASIC coding in Activity #2. I tried inputting some of the coding from RCTIME into the coding from Activity #2 and measurements do take place; just not the same as with the original coding. The goal is to get the original coding in Activity #2 and the coding using RCTIME to have the same time constant decay values.
I am using BS2 on Board of Education Rev.c.
Thank you,
Jason
I am using BS2 on Board of Education Rev.c.
Thank you,
Jason
Comments
What exactly are you trying to do?
The resistor is usually the unknown and supplied by the sensor. The capacitor can be the unknown with the resistor known. RCTIME can also be used to measure small voltages using known resistors. See the discussion at http://www.emesystems.com/stamp.html.
I am trying to get the same values from the same circuitry using the two different coding methods. I use a stop watch with the original Activity #2 and the value I get on the stopwatch is not even close to what the Stamp measures. The difference between what I measure with a stop watch and what the Stamp measures is bugging me. I am curious as to why it is so far off. I thought RCTIME would be more accurate and closer to what I get with the stopwatch, but I am having difficulty getting the circuitry and coding to work together.
Thank you both (Mr. Green, also) for assisting with this.
In addition, when I replace the .1 micro-farad capacitor with the 3300 micro-farad capacitor in Activity #3, there is no reading from the program.
There are a few different ways to create a program and use different commands that will get the SAME RESULT; which is what I am trying to do here. I know RCTIME may be more efficient and quicker that using timeCounter = timeCounter +1, but I was still expecting to get the same time constant values. However, I didn't get the same values.
The GOAL is to get the same values using the two different coded programs BUT using the same or slightly modified circuitry.
Thank you.
That sounds about right. That huge capacitor will take a very long time to discharge compared with the 0.1 µF capacitor. A value like that is not practical for such an application and using RCTIME.
If we take the circuit on Page 145 of WAM 3.0 and plug in the capacitor value we get:
RCTIME = 635 x R (in K) x C (in uF) = 635 x R (in K) x C (3300 uF) = 2,095,500 x R (in K)
2,095,500 (0.47K) = 984,885 which is greater than 65535
2,095,500 (1K) = 2,095,500 which is greater than 65535
2,095,500 (2K) = 4,191,000 which is greater than 65535
2,095,500 (10K) = 20,955,000 which is greater than 65535
The capacitor is too large for RCTIME to use because the discharge time is longer than RCTIME can count.
Using the same circuit on Page 151 of WAM 3.0:
RCTIME = 635 x R (in K) x C (in uF) = 635 x (10K) x (0.1 uF) = 635, which is a lot smaller than 65535.
Also note what it says at the bottom of page 363 of the Basic Stamp Manual:
"If Pin remains in State longer than 65535 timing cycles RCTIME returns 0."
http://www.parallax.com/sites/default/files/downloads/27218-Web-BASICStampManual-v2.2.pdf
Thank you very much!