bajar var portb.5
subir var portb.4
led var portb.3
intensidad var BYTE
indicador var bit
intensidad=100
High led
pause 500
low led
inicio:
PWM portb.0,intensidad,30
low led
if subir=0 then suma
if bajar=0 then resta
indicador=0
GOTO inicio
suma:
if intensidad> 249 then maximo
if indicador=1 then inicio
High led
indicador=1
intensidad=intensidad+25
goto inicio
resta:
if intensidad<26 then maximo
if indicador=1 then inicio
High led
indicador=1
intensidad=intensidad-25
goto inicio
maximo:
HIGH led
goto inicio
end