I leave a part of the program ... basically is the operating principle of the mirror (input voltage for the analog port = output voltage filter pwm)
En español:
les dejo una parte del programa... basicamente es el principio de funcionamiento del espejo (tension de entrada por el puerto analogico = tension de salida en el filtro del pwm)
Code:
DEFINE OSC 20
'****************************************************************
TRISA = 1
ADCON1 = 0
ADCON0 = %11000001
TRISB = %00000000
TRISC = %00000000
'****************************************************************
DEFINE ADC_BITS 8
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50
'****************************************************************
ent420 var word
tiempo var byte
nivel var byte
'****************************************************************
INICIO:
nivel= 1
bucle:
ADCIN 0, ent420
nivel = ent420
PWM PORTC.2,nivel,100 ;nivel PWM = (Vout * 255) / V.Fuente
;gosub grafica
goto bucle
end
Bookmarks