Skip to content

Instantly share code, notes, and snippets.

@TheMrRafus
Last active April 24, 2019 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheMrRafus/5c2f68613541b14838924ff03039d890 to your computer and use it in GitHub Desktop.
Save TheMrRafus/5c2f68613541b14838924ff03039d890 to your computer and use it in GitHub Desktop.
LED PIC16F84A
;Programa que simplemente enciende un LED conectado a RB0
LIST P=16F84A ;Declaramos el uC a usar
include "p16f84a.inc" ;Incluimos la hoja de definiciones para ese uC
__CONFIG _XT_OSC & _WDT_OFF ;Declaramos la palabara de configuracion del uC
ORG 0
goto inicio
ORG 5
inicio
banksel TRISB ;Nos desplazamos al banco dónde está TRISB
clrf TRISB ;Limpiamos TRISB,por si hubiera algo aún definido, y de paso lo ponemos como salida
;Si pusieramos el bit correspondiente de TRISB a 1,el puerto correspondiente en PORTB sería entrada
banksel PORTB ;Volvemos al banco dónde esta PORTB
clrf PORTB ;Limnpiamos PORTB, por si hubiera algo definido previamente
bsf PORTB,RB0 ;Activamos el bit 0 de PORTB, iluminando el LED
espera ;Bucle infinito intencionalmente puesto, para que no se apague el led
goto espera
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment