I just tested it using this code:
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 ' edited after original post per Darrel suggestion
calibraled var gpio.5
gpio=0
frequency=1000
pause 50 ' coffee break
for pote=1 to 1023
@ HPWM10 1, _pote, _Frequency
pause 10
'gosub flashled
next pote
end
flashled:
high calibraled ' I use this to visually count each loop step
pause 50
low calibraled ' by using it I saw that my switcher starts to
pause 50 ' work at hpwm=4, less than that is too low
high calibraled
pause 50
low calibraled
pause 50
high calibraled
pause 50
low calibraled
pause 700
return
Comments:
I used the flashing led routine to know when my switcher started to work, it started at hpwm=4 which is great, the power led is very dim at this value.
then I removed the flashing routine and something was too fast, because my switcher was off. So I added a little pause in there and it was solved, tried 1, 5 and settled in 10ms where it started to work again.
This is great!, now I will test it with adcin
pablo
Bookmarks