Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Potentiometer problem on PIC chip.

Status
Not open for further replies.

RumpinRufus

New Member
I'm trying to use a potentiometer to input one of four values to a 16F84 PIC chip, but I'm having problems. The value seems to go up exponentially as I slide the potentiometer, which doesn't make sense to me. As I slide it constantly, it will read:

0.........................1............2.....3.4.6.16......................................

Smaller capacitors increase the size of the range that gives me 0, but decrease the range in which it goes from 1 to 16. I get that same effect when I change the scale value on the pot command.

Thanks for any help. If I posted in the wrong forum or somesuch, I apologize.

edit: I have a diagram of the circuit, in case it helps.

**broken link removed**

My program is:

Code:
Symbol TrisB = 134
Symbol PORTB = 6
Poke TrisB, 1
Poke PORTB, 0
loop1: Pot 0, 255, B0
	   Poke PortB, B0
	   GoTo loop1
 
It's an exponential "audio taper" pot. You seem to want "linear taper".
 
Oznog said:
It's an exponential "audio taper" pot. You seem to want "linear taper".
Thank you very much, I guess I should have checked that before I bought them.

And I fixed the diagram, thanks for the help.
 
Listen to Nigel too, I didn't study the schematic. If you hooked it up like you drew the schematic, it's hooked up wrong.
 
The pot should be connected between the pin and the capacitor, not the 5v rail.
M.K.


RumpinRufus said:
I'm trying to use a potentiometer to input one of four values to a 16F84 PIC chip, but I'm having problems. The value seems to go up exponentially as I slide the potentiometer, which doesn't make sense to me. As I slide it constantly, it will read:

0.........................1............2.....3.4.6.16......................................

Smaller capacitors increase the size of the range that gives me 0, but decrease the range in which it goes from 1 to 16. I get that same effect when I change the scale value on the pot command.

Thanks for any help. If I posted in the wrong forum or somesuch, I apologize.

edit: I have a diagram of the circuit, in case it helps.

**broken link removed**

My program is:

Code:
Symbol TrisB = 134
Symbol PORTB = 6
Poke TrisB, 1
Poke PORTB, 0
loop1: Pot 0, 255, B0
	   Poke PortB, B0
	   GoTo loop1
 
Mhhh..

Isn't this a better way..

connect the + to a 220Ohm resistor then the middle pin of a potentio meter (50K) then connect the last one or the first one to the 0volt line

then put a cable from the analog pin to the middle pin of the potentiometer

you can test it whit your multimeter..!!!

when you move the resistor there will be another voltage over the smaller Res. and that's what we want.

if you use other values you will get otherreactions..when turning the pot meter.


TKS
 
TKS said:
Mhhh..

Isn't this a better way..

connect the + to a 220Ohm resistor then the middle pin of a potentio meter (50K) then connect the last one or the first one to the 0volt line

then put a cable from the analog pin to the middle pin of the potentiometer

you can test it whit your multimeter..!!!

when you move the resistor there will be another voltage over the smaller Res. and that's what we want.

if you use other values you will get otherreactions..when turning the pot meter.


TKS

He's using a 'F84 wich doesn't have an AD converter, the Pot command in basic uses a capacitor charge technique to test the voltage on the input, it measures the time taken to load the capacitor and can approximate the voltage with it. So what you discribe won't work, your system would just put a steady voltage on the input depening on the potentiometer position, measuring this requires an AD
 
ahhh

Now i untherstand..

i pulss down the pin...

and wait when it raises by it self..

and the amout of time needed for that gives him a rough indication..

of it... mhh..smart...

but not accurate..

TKS

the way i have described i sue self but self i'm finding problems because i cant find the 1023 value...
 
Re: ahhh

TKS said:
Now i untherstand..

i pulss down the pin...

and wait when it raises by it self..

and the amout of time needed for that gives him a rough indication..

of it... mhh..smart...

but not accurate..

It can be surprisingly so, and you can easily exceed 8 bit resolution - and this is actually how your PC joystick ports work!.
 
I believe it would be a good idea to put a current limiting resistor in series with the pot to prevent the latch on the I/O pin from being destroyed when the pot is set to zero.
 
kurtjo said:
I believe it would be a good idea to put a current limiting resistor in series with the pot to prevent the latch on the I/O pin from being destroyed when the pot is set to zero.

Yes, the circuit as posted has never managed to be a workable design.
 
kurtjo said:
I believe it would be a good idea to put a current limiting resistor in series with the pot to prevent the latch on the I/O pin from being destroyed when the pot is set to zero.

Or the pot could, more correctly, be connected between pin and capacitor instead of the plusV rail.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top