Potentiometer on a 16f628

Status
Not open for further replies.

brentonw2004

New Member
Hello all. I am new to this board so hello. Here is my problem. I am using a Pic 16f628 to build a car part. I am programming it with Pic Basic Pro. I need to get an 8-bit reading from a 100K potentiometer. I have tried to use the "POT" command, but I am having very little luck with this. I am debugging my chip with a serial cable connected to my computer. The pot seems to work, but it seems to increase the value of my variable way too fast, it stays at zero until nearly half way through the turn, then it increases very rapidly to 255 and stays there for the rest of the turn. How can I space this out to were 0 is at one end and 255 is at the other. I have a lot of these chips, so changing to a different chip with an a/d converter would be very costly, and I cannot simplify my design to not use a microchip. Also, could I use the POT command with a pressure sensor as well, it is after all just another type of variable resistor? Thanks!
 

I don't use PIC BASIC, so I can't comment specifically on the Pot routine, but it works in a standard way - by timing the charge or discharge of a capacitor. Obviously this time depends on the resistor and capacitor values used, presumably these values are explained in the manual?.

Another point, which type of pot are you using?, linear or log, and is the pot OK - a broken track in the pot would tend to cause this effect.
 
I would test your pot by checking the resistance with a multimeter.....
What capacitance do you have?

According to the manual:

Most of the time I use a PIC with a ADC in it so that this process is more effective and exact. The PIC16F876 or 877 will have that..... also you can use a serial ADC (8 pins) to have it more accurate than the pot. Remember that depending on the capacitor you are going to have a change of +/-20% to +/-5% of the value add that to your linear pot which might have a +/-20% to +/-10% and you are going to have a heck of a time.

Ivancho
 
Buy a new POT. Either your pot is bad or your using an audio tapper pot. I'm assuming you just have the pot connected to the A/D of the PIC
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…