rctime larger than 65536
CharlieC
Posts: 14
I have an app that checks the timing on an RC circuit and takes action if the timing is below a certain threshhold· (something like this)
RET VAR WORD
DO
·· PAUSE 1
·· RCTIME P1, RET
...
·· IF·RET < 700 THEN GOSUB DO_SOMTHG
LOOP
My problem is that the results returned by the rc circut can range from 0 to well over 65xxx, and once the word boundry has been reached, the ret is set to 0.
Sinse I might lagitamely have a 0 output, this is confusing things.· Is there any way to capture a value gater than·the 16 bit word?· I think from some other conversation, this might not be resolvable.
Charlie
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Charlie Chisholm
That part, at least,·I'm sure of.
RET VAR WORD
DO
·· PAUSE 1
·· RCTIME P1, RET
...
·· IF·RET < 700 THEN GOSUB DO_SOMTHG
LOOP
My problem is that the results returned by the rc circut can range from 0 to well over 65xxx, and once the word boundry has been reached, the ret is set to 0.
Sinse I might lagitamely have a 0 output, this is confusing things.· Is there any way to capture a value gater than·the 16 bit word?· I think from some other conversation, this might not be resolvable.
Charlie
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Charlie Chisholm
That part, at least,·I'm sure of.
Comments
If you use circuit (a) in the Stamp RCTime help files, with R = 220 and C = .1uf and a 5K pot you can get values on a BS2 from 0 to about 680.· A resistor of 1.2K in place of the pot will give you a reading of about 53.
Your program needs to say:
high pin
pause 5
RCTIME pin, 1, ret
debug "Time = ", dec3 ret, cr
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
NEW! 4 MB EEPROM
http://hometown.aol.com/newzed/page4.html
·
Not knowing what your actually trying to do, I cannot provide any further help.
Post Edited (Paul Baker) : 3/17/2005 4:56:31 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Charlie Chisholm
That part, at least,·I'm sure of.
you have an overflow. If you can determine this value with your circuit, then place a parallel resistor so that it in combination with your photoresistor will come
very close but never reach the overflow value.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe - Mask Designer III
National Semiconductor Corporation
(Communication Interface Division)
500 Pinnacle Court, Suite 525
Mail Stop GA1
Norcross,GA 30071
I had originally wanted to keep the wide swing in values so that I could more easily perseive a small change, but I am starting to think that would over-complicate it.
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Charlie Chisholm
That part, at least,·I'm sure of.
Keep in mind that by placing a resistor in parallel with a pot, you "de-linearize" the pot.
However, that said, the "POT" or photo resistor being used in your case is not linear to
begin with.
The image I have provided compares the effective resistance with a 5M (series 2) and 10M
(series 3) resistor in parallel with a 5M POT (series 1).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe - Mask Designer III
National Semiconductor Corporation
(Communication Interface Division)
500 Pinnacle Court, Suite 525
Mail Stop GA1
Norcross,GA 30071
For that matter you could effectively do a similar thing by just changing the reference voltage that the Cap
and/or photo resistor is tied to and maintain what ever linearity the POT has to offer. I will see if I can work
something out....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe - Mask Designer III
National Semiconductor Corporation
(Communication Interface Division)
500 Pinnacle Court, Suite 525
Mail Stop GA1
Norcross,GA 30071
The resistance varies from less than an ohm to around 5M. (photo resister),
Wow...I've never seen a photoresistor with such a range. Is this something unusual? Where can I get one? [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Name: Bruce Clemens
Work:· Clemensb@otc.edu
Good Stuff on my Blog: http://theDeadBug.journalspace.com
I haven't seen one go that low.... usually in the 100's of Ohms in full sunlight,
but the upper end is typical of a CdS cell.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe - Mask Designer III
National Semiconductor Corporation
Latest Company News
(Communication Interface Division)
500 Pinnacle Court, Suite 525
Mail Stop GA1
Norcross,GA 30071
I am going to try the parallel resister tonight and see what that does for me.
Paul, I am also intreged by the your suggestion, but I must admit that it is way over my head. I guess that is how I learn, though so I may see if I can do it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Charlie Chisholm
That part, at least,·I'm sure of.
A value this high will have very little effect in a light environment, and will get a handle on the dark resistance, limiting it to the value of the resistor.
And also making the cds more linear though it's light range.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out· the "SX-Video Display Module"
www.sxvm.com
·
of the curve of a paralleled resistor with the photocell.... The combined effect actually helps
to linearize the total resistance.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe - Mask Designer III
National Semiconductor Corporation
Latest Company News
(Communication Interface Division)
500 Pinnacle Court, Suite 525
Mail Stop GA1
Norcross,GA 30071
Ok back (using Opera, I vetted all the programs running, It must have embedded itself into IE) anyways, back to the point, sorry but ill likely not post it at least tonight, Im too frustrated at the moment to type it all out again (anyone know a program that will strip all "extras" from IE? its passing through my virus scan and spyware programs)
Post Edited (Paul Baker) : 3/18/2005 4:47:16 AM GMT
RCTIME returns zero only when the time exceeds the maximum. 65535 units, 0.13107 second on a BS2. The shortest interrval it can measure returns 1, not zero. Here is a way to make it more like you might expect, with zero the minimum and 65535 the maximum:
HIGH 1
RCTIME 1,1,ret ' result is zero if maximum time exceeded.
RET=RET-1 ' zero becomes 65536, and 1 becomes 0.
To measure longer times, you could put RCTIME in a loop.
HIGH 1
FOR ret2=0 TO 65534
RCTIME 1,1,ret
IF ret>0 THEN EXIT ' got it!
NEXT
DEBUG HEX ret2, HEX4 ret
The loop index, ret2, counts how many multiples of 0.131072 seconds pass before p1 goes low. Times out after about 2.5 hours.
While it might be okay in theory, from a hardware standpoint, this is hard not really a good idea. Leakage paths may be as significant as the resistance of the CDS cell. And, RCTIME is hugely sensitive to noise as the voltage approaches the threshold.
Another alternative, try a range switching scheme: Connect a couple of different capacitors (say 0.001uF and 0.1 uF) to the measuring pin, p1, and instead of grounding the bottom side of the 0.1uF capacitor, hook it to a Stamp pin. When that Stamp pin is an input, the capacitor is effectively out of the circuit and you can measure high resistance values against the 0.001 uf. But when the pin is a low output, it grounds the bottom plate of te 0.1 uf capacitor so that you can measure lower values of resistance.
Very low levels of light (even those that are still perceived by our scotoptic vision) can only be measured with a photomultiplier tube.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
kelvin
Tracy: You are taking more of a code direction, which is what I had orignally wanted to do. I had thought that maybe there was a way I could setup a staged reading using something remotely like what you suggest. I think this is something else I want to explore further. I have a BOE board and a homework board and I will probably setup the other board to play with your approach.
Pual: I feel your pain. My department has about 350 users spread over about thirty locations and it is an ongoing nightmare to keep educating people on the dangers of the mine field that is the internet. Most everything we have run into so far could be controlled through Nortens enterprise, ad-aware, spybot s&d and some policy and internet settings. I would like to know more about this site you hit. we have not run into one that could do as much damage as the one you discribe.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Charlie Chisholm
That part, at least,·I'm sure of.
·· In the advanced internet options, you could try unchecking, "Enable Third Party Plug-Ins."· Also, without SP2, many things can self-install on your computer.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com