Timing Question using potentiometer

Can anyone point me to an example of how the adjust the timing of a delay loop +\- a given time using a potentiometer? I am using a PIC16c84 or PIC 16F84 controller.

Example.

Push a button to light an led for 10 seconds after which it turns off. (I have figured this out.)

I want to include a potentiometer to adjust this time delay +\- 5 seconds.

Any help would be greatly appreciated, as I am new to pics.

Reply to
Jagrolet
Loading thread data ...

It would be easier (and cheaper) to use a more modern microcontroller with an on-board ADC such as the PIC16F819, which will convert the pot rotation into a binary number from 0x000 to 0x3FF, which you can then use to calculate the delay time.

Best regards, Spehro Pefhany

--
"it's the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

Don't know if it can be done on this PIC but the classic way to do this was to use a comparator input with the pot connect to it as an RC network which charged up the cap from the supply. How long the cap takes to reach the comparator threshold depends on the pot postiton. The time gives you a value determined by the pot.

Ian

Reply to
ruffrecords

Mmm, it would be much easier and cheaper to use a 555..... But I guess now it gets off topic...

Meindert

Reply to
Meindert Sprang

You could use another button to cycle through a series of preset delays, maybe in 1-second increments? Or do you need "infinite" adjustability?

Reply to
dh

Maybe. You can get better initial accuracy and repeatability (including first cycle) and less drift over time/temperature using a microcontroller. The 555/CMOS 555 is ideal for crude timing, short times, or driving a heavy load.

Best regards, Spehro Pefhany

--
"it's the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

Since the PIC has a RC oscillator mode, why not simply put the variable resistance in there, and change the clock speed ? Would do all the OP asked for, and is very like a 555 :)

-jg

Reply to
Jim Granville

Sounds like it combines the worst features of both. ;-)

Best regards, Spehro Pefhany

--
"it's the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.