EJEMPLOS DE LED
El archivo rar contiene codigo fuente para modificar, simulacion en proteus 8
LED INTERMITENTE
parpadeo un led con intervalos de 1 segundo
led var portb.0 ;etiqueta para el puerto b.0
pepe: ;línea asignado con el nombre pepe
high led ;encender el led
pause 1000 ;esperar 1000 milisegundos (1 segundo)
low led ;apagar el led
pause 1000 ;esperar 1000 milisegundos (1 segundo)
goto pepe ;ir a la línea que tenga el nombre pepe
end ;fin de las instrucciones
LINK:
LED INTERMITENTE 2 (ALTERNADO)
Define Osc 4
TRISB = %00000000
PORTB = %00000000
Inicio:
PORTB = %01010101
Pause 1000
PORTB = %10101010
Pause 1000
GoTo Inicio
End
LINK:
LED INTERMITENTE INSTRUCCION FOR
Define osc 4
x var byte
led var portb.4
TRISB = %11101111
Inicio:
for x =1 to 4
high led
pause 2500
low led
pause 500
next
end
LED INTERMITENTE (TIEMPO COMO CONSTANTE)
Define osc 4
Trisb = %00000000
tiempo var word
tiempo = 700
led1 var portb.0
led2 var portb.1
Inicio:
high led1
low led2
pause tiempo
low led1
high led2
pause tiempo
goto Inicio
end
LED INTERMITENTE (DESDE EL CENTRO HACIA AFUERA)
Define osc 4
tiempo var byte
tiempo = 200
trisb=%00000000
barrido:
portb=%00011000
pause tiempo
portb=%00100100
pause tiempo
portb=%01000010
pause tiempo
portb=%10000001
pause tiempo
goto barrido
end
No hay comentarios:
Publicar un comentario