PDA

View Full Version : RCTIME questions

mpark
05-24-2010, 01:29 PM
This is from RCTIME:

''State = 0 (Preferred)
''
'' 220Ω C
''I/O Pin ──┳── GND
'' │
'' ┌R
'' │ │
'' └─┻─── GND
''

Questions:
1. What is the purpose of the 220 resistor? Is it necessary?
2. What does "State = 0" mean? I've wired up a pot and cap (but no 220 resistor) as shown and can read it with RCTIME(16, 1, @x) but not RCTIME(16, 0, @x) which makes me think it should say "State = 1".

StefanL38
05-24-2010, 05:20 PM
the 220ohm-resistor limits the current flowing from the IO-Pin to the capacitor.

state means the second parameter of the method RCTIME

this parameter controls if you measure
the discharging-timefrom 3.3V down to 1.65V (state=1)

or the charging-time from 0.0V up to 1.65V (state=0)

If it does not work the values of R and C are chosen "unlucky"

Can you post your values of R and C?

The circuit shown in the propeller Education Kit Labs Fundamentals Version 1.1 page 122ff is without the 220-Ohm-resistor

what EXACT values for the decay-time do you get?

Post the values when using RCTIME(16, 1, @x) AND when using RCTIME(16, 0, @x)

best regards

Stefan

mpark
05-24-2010, 09:56 PM
Stefan, thanks for replying.

You know, I hate it when people say "it doesn't work" and don't describe what they mean, so imagine my embarrassment to realize that I committed that very offense. Sorry about that.

With a 10k pot and 0.1uF cap (values very approx.) RCTIME(16, 1, @x) gives x=4500 give or take—that is expected. On the other hand, RCTIME(16, 0, @x) hangs indefinitely (I'm using "foreground" mode).

Since it works for me with state=1, I'm wondering why the diagram is labeled "State = 0".

Beau Schwabe
05-24-2010, 11:04 PM
mpark,

The 220 Ohm resistor is to limit the current charging the capacitor as well as prevent any damage to the I/O when the R value from the POT is very LOW.

...Your right, State "0" and State "1" seem to be reversed. Just on the schematic though. I will update this immediately.

State "1" - In this mode the capacitor is 'charged' through the 220 Ohm resistor and the I/O. After it is charged, 'R' begins to discharge the capacitor. A timer also begins counting until the I/O pin reads as a "0" or a LOW.

State "0" - In this mode the capacitor is 'dis-charged' through the 220 Ohm resistor and the I/O. After it is dis-charged, 'R' begins to charge the capacitor. A timer also begins counting until the I/O pin reads as a "1" or as a HIGH.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

StefanL38
05-25-2010, 03:47 AM
@Beau:

where is the schematic that has the 220-Ohm-resistor included?

I'm using Propeller-Tool 1.2.7 and PE Kit Manual 1.1 from 2009-05-12

The RCTIME-object contains no circuit at all. The PE-Kit manual shows a circuit without current-limiting resistor.
There is even a comment that the propeller isn't sensible about "short-cuts". To keep the IO-pins alive even for real-dumb-users
the schematic and the comment should be revised

best regards

Stefan

mpark
05-25-2010, 07:15 AM
Stefan, the schematic is in the demo program included when you download RCTIME from the obex.

Beau, I think it would be a good idea to incorporate the schematic into RCTIME.spin itself.

mpark
05-25-2010, 01:06 PM
Beau, one more question: Why did you decide to divide the time (in clock ticks) by 16?

Beau Schwabe
05-25-2010, 10:26 PM
mpark,

The division by 16 was just to remove some of the LSBits (Least Significant Bits)... The Spin version was almost too sensitive. Dividing by 16 still gives resolution values way above what the Basic Stamp is able to offer.

"Beau, I think it would be a good idea to incorporate the schematic into RCTIME.spin itself." - I'll make note of that and try to incorporate it.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.