Forums

Timing Question using potentiometer

Started by Jagrolet September 5, 2004
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.
On Sun, 05 Sep 2004 16:37:21 GMT, the renowned Jagrolet
<jagrolet@yahoo.com> wrote:

>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.
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
Jagrolet wrote:
> 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.
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
"Spehro Pefhany" <speffSNIP@interlogDOTyou.knowwhat> wrote in message
news:q4hmj096g7pfq0e1ri9a8g55dfhga4lm71@4ax.com...
> 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.
Mmm, it would be much easier and cheaper to use a 555..... But I guess now it gets off topic... Meindert
"Jagrolet" <jagrolet@yahoo.com> wrote in message 
news:lsfmj0p1674g1vh45c4ega631uv2ntcrq5@4ax.com...
> 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.
You could use another button to cycle through a series of preset delays, maybe in 1-second increments? Or do you need "infinite" adjustability?
On Sun, 5 Sep 2004 21:50:40 +0200, the renowned "Meindert Sprang"
<mhsprang@NOcustomSPAMware.nl> wrote:

>"Spehro Pefhany" <speffSNIP@interlogDOTyou.knowwhat> wrote in message >news:q4hmj096g7pfq0e1ri9a8g55dfhga4lm71@4ax.com... >> 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. > >Mmm, it would be much easier and cheaper to use a 555..... >But I guess now it gets off topic... > >Meindert
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
Spehro Pefhany wrote:
> On Sun, 5 Sep 2004 21:50:40 +0200, the renowned "Meindert Sprang" > <mhsprang@NOcustomSPAMware.nl> wrote: > > >>"Spehro Pefhany" <speffSNIP@interlogDOTyou.knowwhat> wrote in message >>news:q4hmj096g7pfq0e1ri9a8g55dfhga4lm71@4ax.com... >> >>>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. >> >>Mmm, it would be much easier and cheaper to use a 555..... >>But I guess now it gets off topic... >> >>Meindert > > > 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.
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
On Mon, 06 Sep 2004 10:43:33 +1200, the renowned Jim Granville
<no.spam@designtools.co.nz> wrote:

>Spehro Pefhany wrote: >> On Sun, 5 Sep 2004 21:50:40 +0200, the renowned "Meindert Sprang" >> <mhsprang@NOcustomSPAMware.nl> wrote: >> >> >>>"Spehro Pefhany" <speffSNIP@interlogDOTyou.knowwhat> wrote in message >>>news:q4hmj096g7pfq0e1ri9a8g55dfhga4lm71@4ax.com... >>> >>>>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. >>> >>>Mmm, it would be much easier and cheaper to use a 555..... >>>But I guess now it gets off topic... >>> >>>Meindert >> >> >> 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. > >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
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