Quote Originally Posted by mister_e View Post
mmm, could be a noisy pot as well... using your code and on many low-value ADC.. they are all stable.. no noise, no frlicker.

what happen if you stick a 0.1 uF in parallel with your POT wiper?

Any 0.1uF + 10uF capacitor close to your PIC?
I just tried with a 20 turn 10k linear pot and its the same, once I reach the lower duty cycles the led flickers.
The difference is clearly visible with the multiturn pot, once you go below a certain level it flickers, move the other way a little bit and the flicker goes away

Reading in the flicker position I get this range: from $00BB to $00BF and spurious $009F , $00B4, $00C6, $00E3 at random places
Reading in the steady position I get this range: $00CD to $00CF and no spurious readings

I only read 125 word values into the device own eeprom.
Again Im using a li-ion battery for powering the circuit (3.65v)

Weird isnt it? even weirder is that sometimes when I write the values to eeprom the written values are steady (also visually) but only when writting...

Just in case here is the code I used:
Code:
'       Pic Configuration
@ device pic12f683,INTRC_OSC_NOCLKOUT , wdt_on, mclr_off, protect_off        

'       Hardware configuration

'       I/Os
TRISIO = %00010010      ' pin1 is ADC , pin4 is the calibration button

'       ADC's
ANSEL = %00000010  
DEFINE ADC_BITS 10      ' ADCIN resolution  (Bits)
DEFINE ADC_CLOCK 1      ' ADC clock source  (Fosc/8)
DEFINE ADC_SAMPLEUS 11  ' ADC sampling time (uSec)                      
ADCON0.7 = 1            ' Right justified results

'       Comparator
CMCON0 = %00000111     ' Disable comparator
VRCON  = %00000000     ' disable
'cmcon0 = %00001110      ' Multiplexed Input with Internal Reference CIS=1
'vrcon  = %10001010      ' set vref=2.25v (from 4v input) 

include "HPWM10.pbp"

' definitions
pote 		var word
Frequency   var word
calibraled  var gpio.5
calibrapin  var gpio.4
conta       var byte

gpio=0
conta=0
frequency=1000
pause 50    ' coffee break

loop:

    adcin 1, pote
    if pote>1000 then pote=1000
    
if calibrapin=1 then
if conta < 250 then
 write conta, pote.byte1
 write conta+1, pote.byte0
 conta=conta+2
endif
endif

@ HPWM10  1, _pote, _Frequency
pause 10

goto loop
end

Pablo