Hice un código para un circuito que tiene que encender 2 leds. El primero se enciendo y en un breve tiempo se apaga y enciende el 2º que este hace lo mismo y el primero se vuelve a encender... hace un bucle. Microcontrolador: 16f84a
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Ensamblador para microcontroladores ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; TABLA DE VARIABLES ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; NOMBRE RUTA VALOR ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Control 0x0D 00000000 ;;
;; BucleControl 0x0C 0x03 ;;
;; BycleNm 0x0E 0xff ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Control equ 0x0D;
BucleControl equ 0x0C;
BucleNm equ 0x0E;
BSF 03h,5;
BSF 06h,0;
BSF 06h,1;
BSF 06h,2;
BSF 06h,3;
BCF 03h,5;
call Asignacion
InicioCrea
call CreacionBucles;
Inicio
DECFSZ 0x0C;
goto Bucle;
goto Ciclo_Fin;
Bucle DECFSZ 0x0E;
goto Bucle;
goto Inicio;
Ciclo_Fin
BTFSC 0x0D,0;
goto Led_0;
goto Led_1;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; FUNCIONES
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Asignacion
movlw b'00000000';
movwf 0x0D;
return;
Asignacion_Bucle0_Contador
movlw 0xff;
movwf 0x0E;
return;
Asignacion_Bucle0_Control
movlw 0x03;
movwf 0x0C;
return;
Led_0
BSF 03h,5;
BCF 06h,0;
BSF 06h,1;
movlw b'00000000';
movwf 0x0D;
BCF 03h,5;
goto InicioCrea;
Led_1
BSF 03h,5;
BCF 06h,1;
BSF 06h,0;
movlw b'00000001';
movwf 0x0D;
BCF 03h,5;
goto InicioCrea;
CreacionBucles
call Asignacion_Bucle0_Contador;
call Asignacion_Bucle0_Control;
return;
END;