Question: Variable timing using a potentiometer & 16c84 PIC

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
I am new to PICS...Can anyone point me to any assembly or pic basic
code that will do the following: (Preferably assembly)

I want to push a button to light an LED for a specific amount of time
and then turn off.
(Got this part figured out)
I also want a potentiometer included that will adjust that time delay
plus or minus a time period.

Example:

I push the button and the POT is in the middle of its range, and it
lights the LED for 10 seconds. If the POT is turned all the way up,
the time is now 15 seconds, and if the POT is turned all the way down
the time is now 5 seconds.

I am using a 16c84 or 16f84 PIC.

Any help is greatly appreciated

Thanks,

Terry Best

Re: Question: Variable timing using a potentiometer & 16c84 PIC

Quoted text here. Click to load it

Probably better ways to do this on parts that have an analogue to digital
converter or a comparator. The 16x84's have neither. The usual way would
be to charge a capacitor through a resistor ( in this case pot ) using
one of the port pins and then periodically change that pin to an input
and measure how long it takes to flip state as the capacitor charges.
Varying the pot will vary the RC time constant of the setup which can be
measured by the PIC. The time from when the charge cycle starts to when
the pin changes state is related to the position of the pot.
The manual that comes with the PICKit 1 demo board explains the technique
but unfortunately doesn't have any code examples >
http://ww1.microchip.com/downloads/en/DeviceDoc/40040b.pdf
( look at tip #13 )

Better still move from the 16x84's to the better (and cheaper) 16F628.
It is pretty much identical from an upward compatible view, but has a
comparator built in as well as UART, more RAM, more OSC types ... etc.

Colin



Re: Question: Variable timing using a potentiometer & 16c84 PIC
I have seen that tecnique described in 1 other place but they too did
not have an example of the code required to accomplish it.
I am in a steep learning curve ant many code examples exist for the
16x84 chips which I seem to be picking up on fairly well.
Also thats the chip I have on hand...
I greatly appreciate your replying to my post.
Hopefully someone can provide an example.

Terry




Quoted text here. Click to load it


Re: Question: Variable timing using a potentiometer & 16c84 PIC
I'd like to reiterate that there are better parts for the job. What
you'll find is that you'll spend a lot of time negotiating workarounds
to the 16F84 limitations. I wrote a page on the subject:

http://www.finitesite.com/d3jsys/16F88.html

-I have seen that tecnique described in 1 other place but they too did
-not have an example of the code required to accomplish it.
-I am in a steep learning curve ant many code examples exist for the
-16x84 chips which I seem to be picking up on fairly well.
-Also thats the chip I have on hand...
-I greatly appreciate your replying to my post.
-Hopefully someone can provide an example.

Look at Experiment 8 here:

http://www.talkingelectronics.com/Projects/PIC_LAB-1/PicLab1_experiments-P4.html

BAJ

Re: Question: Variable timing using a potentiometer & 16c84 PIC
Quoted text here. Click to load it

All that you need for this project is a monostable timer. Save the PIC for
another day.
Peter



Site Timeline