PDA

View Full Version : Pot Commands



ngeronikolos
- 20th September 2005, 10:34
Hello boys&girls,

I was working using a potetiometer conecting to my PIC16F628 via a capasitor to the GND.I want to read the resistor of a potetiometer(700ohm) whick included in an pan&tilt mechanism.I want to translate that to degree and display that on the LCD.
I manage to do that but I have a problem translating the resistor-->degrees!!
Range: 0-360
Resistor : 0-700ohm


Any idea??

In adittion,if I use the internal oscillator of the 16f628 the pins15&16 goes to RA6&RA7 without any additional command?

Thanks
Nikos

CocaColaKid
- 20th September 2005, 12:45
The POT command works between 0-255 when properly scaled so :

x = POT Value * 141
degrees = (POT Value * 141 / 100) . (POT Value * 141 / 10)

This comes from 360º / 255 = 1.41...

In order for this to work properly you must make certain you scale the POT command so that it reaches 255 at the very end otherwise the numbers will be off.

nomada
- 21st September 2005, 00:08
Hi

In adition to what cocacolakid wrote and as in the PBP manual I think that using 700Ohm will be a pain in the ...

They suggest to use something between 5k to 50k, I've already tried it with 1k pot and the results were not good.

I think that one of the real experts ( Melanie, Darrel, Bruce ...) on this things had already wrote that the best results were achieved with pot greater than 5K. Run a search

regards

nomada

mister_e
- 21st September 2005, 04:31
i'm not an expert but it read the RC time so, it will be a perfect match of your resistor and your Capacitor.

The logic will say ===> lower resistor + Higer cap = Higher resistor + lower capacitor.

ngeronikolos
- 21st September 2005, 10:52
Thanks boys for your usefull information.

I will try to read the POT Value and as cocacolakid said the
degrees = (POT Value*141)/100
displaied on LCD.

Cocacolakid,A GUESTION?For POT Value max = 255 how I should find the scale?

Does anyone have an expirience using smaller R than the range of 5k-50k?
I am going to measure a POT = 700Ohm

Please any adittional information would be grate for me.

Regards
Nikos

CocaColaKid
- 21st September 2005, 13:09
Look up the POT command in the manual. It has a really good description for setting the scale.