PDA

View Full Version : POT command



LarryZ
- 25th July 2009, 02:21
I have been using the MicroCode Studio Help to get the Basic commands that are available.
On of them is "POT" and it is supposed to work using "POT pin, scale, var.
I tried to use it with the Pot on my PICkit2 with the statement
POT PORTA.0,255,duty
Duty is supposed to be something between 1 and 255.
Anyone have any Ideas?
Larry

Bill Legge
- 25th July 2009, 03:40
I presume that you have a circuit with:

1. A variable resistor, say 10k, connected to +5 Volts.
2. A capacitor, say 0.1mfd, connected to the the other end of the variable resistor and ground.
3. The wiper of the pot/variable resistor connected to pin A.0.

'Duty' should be a BYTE sized variable.
'Scale' is used to get the best results. Try Scale=127, to start.

The value of 'Duty' will be proportional to the setting of the variable resistance.

See page 118 of the PBP handbook

Regards Bill legge

LarryZ
- 25th July 2009, 15:59
Thank you Bill
I was using the pot on the PICkit and I don't think it is wired that way.
I'll use another 10 K variable resister and Capasitor connected to the board.
Thanks again
Larry:)