PDA

View Full Version : Need help with Pot command



mbox
- 21st August 2010, 10:59
Hi everyone, I want to learn how to use POT command so I tried some codes and try also to simulate it on protues.
Include "modedefs.bas" ' Include serial modes
TRISB =%00000001
Portb =%00000000
' Allocate variables
x Var Byte

CMCON = 7 ' Set PORTA to digital
Pause 100 ' Wait for LCD to start

mainloop:
Pot PORTB.0, 127, x
Serout PortB.1,T9600, [$Fe,1]
serout PortB.1,T9600,[" Pot ",#x] ' Send value to LCD
Pause 100 ' for delays
Goto mainloop ' Do it again

End I tried to play around with the variable potentiometer to see if its displays varies, but it jumps from 2-8-15-47-255. How can I make it increment by 1 to have a smooth display to 255? I tried to change the pot resistance between 5-10K but no luck.

Acetronics2
- 21st August 2010, 15:36
Hi, mBox

The best advice I can give is : FORGET about POT ... :rolleyes:

use RCTime instead, it will be far easier to work with. and result is trustable.

If your Pic ( 16F628 ??? ) had had an ADC ... surely It would have been the best solution.

AND do not forget POT only can properly work @ 4 Mhz ... Following the manual scheme ( what you didn't do ...)

Alain

AS you will insist on using it ... try " scale " around 66 - 68 ...

mbox
- 22nd August 2010, 00:30
Hi Acetronics, thanks for the tip. I will try RCTIME.