0% encontró este documento útil (0 votos)
16 vistas19 páginas

Programas EDA

El documento describe varios programas en ensamblador para el microcontrolador PIC16F84A, incluyendo operaciones de suma, resta, complemento de un registro y corrimiento de LEDs. Cada sección incluye la configuración del PIC, la creación de registros y las condiciones iniciales, seguidas de la lógica para realizar las operaciones deseadas. Además, se implementan subrutinas para manejar tiempos de espera entre las operaciones.
Derechos de autor
© © All Rights Reserved
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como PDF, TXT o lee en línea desde Scribd
0% encontró este documento útil (0 votos)
16 vistas19 páginas

Programas EDA

El documento describe varios programas en ensamblador para el microcontrolador PIC16F84A, incluyendo operaciones de suma, resta, complemento de un registro y corrimiento de LEDs. Cada sección incluye la configuración del PIC, la creación de registros y las condiciones iniciales, seguidas de la lógica para realizar las operaciones deseadas. Además, se implementan subrutinas para manejar tiempos de espera entre las operaciones.
Derechos de autor
© © All Rights Reserved
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como PDF, TXT o lee en línea desde Scribd

SUMA

;ENCABEZADO

LIST P=16F84A ;PIC A UTILIZAR

;PALABRA DE CONFIGURACION

__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC ;PALABRA DE


CONFIGURACION

#INCLUDE <P16F84A.INC> ;LIBRERIA DEL PIC

;CONFIGURACION DEL PIC

bsf 0x03,5 ;INGRESAR AL BANCO 0

movlw 0x1f ;w = 0001 1111

clrf 0x05 ;DEFINIMOS PUERTO A COMO ENTRADAS

clrf 0x06 ;DEFINIMOS PUERTO B COMO SALIDAS

bcf 0x03,5 ;INGRESAR AL BANCO 1

;CREACION DE REGISTROS

dato equ 0x20 ;EL BANCO DE MEMORIA 0X20 SE LLAMA DATO

reg1 equ 0x21 ;EL BANCO DE MEMORIA 0X21 SE LLAMA reg1

reg2 equ 0x22 ;EL BANCO DE MEMORIA 0X22 SE LLAMA reg2

reg3 equ 0x23 ;EL BANCO DE MEMORIA 0X23 SE LLAMA reg3

reg4 equ 0x24 ;EL BANCO DE MEMORIA 0X24 SE LLAMA reg4

;CONDICIONES INICIALES

movlw 0x00 ;W = 0000 0000

movwf PORTB ;PORTB = 0000 0000

movlw 0x83 ;W = 1000 0011

movwf dato ;dato = 1000 0011

inicio ;ETIQUETA INICIO

MOVF dato, W ; Lee el valor del registro Dato y lo guarda en W

movwf PORTB ; PORTB = dato

movwf dato ; vuelve a llevar el valor de w a dato

MOVF dato, W ; Lee el valor del registro Dato y lo guarda en W


ADDWF PORTA, W ; Suma el valor de A al valor en W

MOVWF PORTB ; Muestra el resultado en el puerto B

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

GOTO inicio ; Salta de nuevo a la etiqueta

Inicio

tiempo

MOVLW 0x64 ; Carga el valor 0x64 (100 en decimal) en W

MOVWF reg1 ; Almacena el valor en reg1

MOVLW 0x32 ; Carga el valor 0x32 (50 en decimal) en W

MOVWF reg2 ; Almacena el valor en reg2

MOVLW 0x0A ; Carga el valor 0x0A (10 en decimal) en W

MOVWF reg3 ; Almacena el valor en reg3

Espera1Segundo:

MOVLW 0x3C ; Carga el valor 0x3C (60 en decimal) en W

MOVWF reg4 ; Almacena el valor en reg4

Espera100Ms:

DECFSZ reg4, F ; Decrementa reg4 y salta si es cero

GOTO Espera100Ms ; Si reg4 no es cero, espera más

DECFSZ reg3, F ; Decrementa reg3 y salta si es cero

GOTO Espera1Segundo ; Si reg3 no es cero, espera otro segundo

DECFSZ reg2, F ; Decrementa reg2 y salta si es cero

GOTO Espera1Segundo ; Si reg2 no es cero, espera otro segundo

DECFSZ reg1, F ; Decrementa reg1 y salta si es cero

GOTO Espera1Segundo ; Si reg1 no es cero, espera otro segundo

RETURN ; Retorna de la subrutina

End
RESTA
;ENCABEZADO

LIST P=16F84A ;PIC A UTILIZAR

;PALABRA DE CONFIGURACION

__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC ;PALABRA DE


CONFIGURACION

#INCLUDE <P16F84A.INC> ;LIBRERIA DEL PIC

;CONFIGURACION DEL PIC

bsf 0x03,5 ;INGRESAR AL BANCO 0

movlw 0x1f ;w = 0001 1111

clrf 0x05 ;DEFINIMOS PUERTO A COMO ENTRADAS

clrf 0x06 ;DEFINIMOS PUERTO B COMO SALIDAS

bcf 0x03,5 ;INGRESAR AL BANCO 1

;CREACION DE REGISTROS

dato equ 0x20 ;EL BANCO DE MEMORIA 0X20 SE LLAMA DATO

reg1 equ 0x21 ;EL BANCO DE MEMORIA 0X21 SE LLAMA reg1

reg2 equ 0x22 ;EL BANCO DE MEMORIA 0X22 SE LLAMA reg2

reg3 equ 0x23 ;EL BANCO DE MEMORIA 0X23 SE LLAMA reg3

reg4 equ 0x24 ;EL BANCO DE MEMORIA 0X24 SE LLAMA reg4

;CONDICIONES INICIALES

movlw 0x00 ;W = 0000 0000

movwf PORTB ;PORTB = 0000 0000

movlw 0x83 ;W = 1000 0011

movwf dato ;dato = 1000 0011

inicio
;ETIQUEA INICIO

MOVF dato, W ; Lee el valor del registro Dato y lo guarda en W

movwf PORTB ; PORTB = dato

movwf dato ; vuelve a llevar el valor de w a dato


MOVF dato, W ; Lee el valor del registro Dato y lo guarda en W

SUBWF PORTA, W ; Resta el valor de A al valor en W

MOVWF PORTB ; Muestra el resultado en el puerto B

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

GOTO inicio ; Salta de nuevo a la etiqueta Inicio

tiempo

MOVLW 0x64 ; Carga el valor 0x64 (100 en decimal) en W

MOVWF reg1 ; Almacena el valor en reg1

MOVLW 0x32 ; Carga el valor 0x32 (50 en decimal) en W

MOVWF reg2 ; Almacena el valor en reg2

MOVLW 0x0A ; Carga el valor 0x0A (10 en decimal) en W

MOVWF reg3 ; Almacena el valor en reg3

Espera1Segundo:

MOVLW 0x3C ; Carga el valor 0x3C (60 en decimal) en W

MOVWF reg4 ; Almacena el valor en reg4

Espera100Ms:

DECFSZ reg4, F ; Decrementa reg4 y salta si es cero

GOTO Espera100Ms ; Si reg4 no es cero, espera más

DECFSZ reg3, F ; Decrementa reg3 y salta si es cero

GOTO Espera1Segundo ; Si reg3 no es cero, espera otro segundo

DECFSZ reg2, F ; Decrementa reg2 y salta si es cero

GOTO Espera1Segundo ; Si reg2 no es cero, espera otro segundo

DECFSZ reg1, F ; Decrementa reg1 y salta si es cero

GOTO Espera1Segundo ; Si reg1 no es cero, espera otro segundo

RETURN ; Retorna de la subrutina

End
COMPLEMENTO DE UN REGISTRO
;ENCABEZADO

LIST P=16F84A ;PIC A UTILIZAR

;PALABRA DE CONFIGURACION

__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC ;PALABRA DE


CONFIGURACION

#INCLUDE <P16F84A.INC> ;LIBRERIA DEL PIC

;CONFIGURACION DEL PIC

bsf 0x03,5 ;INGRESAR AL BANCO 0

movlw 0x1f ;w = 0001 1111

clrf 0x05 ;DEFINIMOS PUERTO A COMO ENTRADAS

clrf 0x06 ;DEFINIMOS PUERTO B COMO SALIDAS

bcf 0x03,5 ;INGRESAR AL BANCO 1

;CREACION DE REGISTROS

dato equ 0x20 ;EL BANCO DE MEMORIA 0X20 SE LLAMA DATO

reg1 equ 0x21 ;EL BANCO DE MEMORIA 0X21 SE LLAMA reg1

reg2 equ 0x22 ;EL BANCO DE MEMORIA 0X22 SE LLAMA reg2

reg3 equ 0x23 ;EL BANCO DE MEMORIA 0X23 SE LLAMA reg3

reg4 equ 0x24 ;EL BANCO DE MEMORIA 0X24 SE LLAMA reg4

;CONDICIONES INICIALES

movlw 0x00 ;W = 0000 0000

movwf PORTB ;PORTB = 0000 0000

movlw 0x83 ;W = 1000 0011

movwf dato ;dato = 1000 0011

inicio
;ETIQUEA INICIO

MOVF PORTA, W ; Lee el dato del puerto A y lo guarda en W


; Realiza el complemento a uno

COMF W, W ; Complemento a uno del registro W (dato ingresado)

MOVWF PORTB ; Muestra el resultado en el puerto B

CALL tiempo ; LLAMA A LA SUBRUTINA DE TIEMPO

GOTO inicio ; Salta de nuevo a la etiqueta Inicio

tiempo

MOVLW 0x64 ; Carga el valor 0x64 (100 en decimal) en W

MOVWF reg1 ; Almacena el valor en reg1

MOVLW 0x32 ; Carga el valor 0x32 (50 en decimal) en W

MOVWF reg2 ; Almacena el valor en reg2

MOVLW 0x0A ; Carga el valor 0x0A (10 en decimal) en W

MOVWF reg3 ; Almacena el valor en reg3

Espera1Segundo:

MOVLW 0x3C ; Carga el valor 0x3C (60 en decimal) en W

MOVWF reg4 ; Almacena el valor en reg4

Espera100Ms:

DECFSZ reg4, F ; Decrementa reg4 y salta si es cero

GOTO Espera100Ms ; Si reg4 no es cero, espera más

DECFSZ reg3, F ; Decrementa reg3 y salta si es cero

GOTO Espera1Segundo ; Si reg3 no es cero, espera otro segundo

DECFSZ reg2, F ; Decrementa reg2 y salta si es cero

GOTO Espera1Segundo ; Si reg2 no es cero, espera otro segundo

DECFSZ reg1, F ; Decrementa reg1 y salta si es cero

GOTO Espera1Segundo ; Si reg1 no es cero, espera otro segundo

RETURN ; Retorna de la subrutina

End
CORRIMIENTO DE LEDS
;ENCABEZADO

LIST P=16F84A
;PIC A UTILIZAR

;PALABRA DE CONFIGURACION

__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC ;PALABRA DE


CONFIGURACION

#INCLUDE <P16F84A.INC> ;LIBRERIA DEL PIC

;CONFIGURACION DEL PIC

bsf 0x03,5 ;INGRESAR AL BANCO 0

clrf 0x05 ;DEFINIMOS PUERTO A COMO SALIDAS

clrf 0x06 ;DEFINIMOS PUERTO B COMO SALIDAS

bcf 0x03,5 ;INGRESAR AL BANCO 1

;CREACION DE REGISTROS

reg1 equ 0x20 ;EL BANCO DE MEMORIA 0X20 SE LLAMA REG1

reg2 equ 0x21 ;EL BANCO DE MEMORIA 0X21 SE LLAMA REG2

reg3 equ 0x22 ;EL BANCO DE MEMORIA 0X22 SE LLAMA REG3

;CONDICIONES INICIALES

movlw 0x00 ;W = 0000 0000

movwf PORTB ;PORTB = 0000 0000

inicio
;ETIQUEA INICIO

movlw 0x80 ;W = 1000 0000

movwf PORTB ;PORTB = 1000 0000

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0x40 ;W = 0100 0000

movwf PORTB ;PORTB = 0100 0000

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO


movlw 0x20 ;W = 0010 0000

movwf PORTB ;PORTB = 0010 0000

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0x10 ;W = 0001 0000

movwf PORTB ;PORTB = 0001 0000

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0x08 ;W = 0000 1000

movwf PORTB ;PORTB = 1000 1000

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0x04 ;W = 0000 0100

movwf PORTB ;PORTB = 0000 0100

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0x02 ;W = 0000 0010

movwf PORTB ;PORTB = 0000 0010

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0x01 ;W = 0000 0001

movwf PORTB ;PORTB = 0000 0001

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0x02 ;W = 0000 0010

movwf PORTB ;PORTB = 0000 0010

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0x04 ;W = 0000 0100

movwf PORTB ;PORTB = 0000 0100

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0x08 ;W = 0000 1000

movwf PORTB ;PORTB = 1000 1000

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0x10 ;W = 0001 0000

movwf PORTB ;PORTB = 0001 0000


call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0x20 ;W = 0010 0000

movwf PORTB ;PORTB = 0010 0000

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0x40 ;W = 0100 0000

movwf PORTB ;PORTB = 0100 0000

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0x80 ;W = 1000 0000

movwf PORTB ;PORTB = 1000 0000

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

goto inicio ;VE A LA ETIQUETA DE INICIO

;subrutina de tiempo

tiempo

movlw 0XAC;w= 1010 1100

movwf reg1 ;REG1=1010 1100

LeeREG2

movlw 0XF6;w= 1111 0110

movwf reg2 ;REG2= 1111 0110

LeeREG3

movlw 0X12 ;w= 0001 0010

movwf reg3 ;REG3= 0001 0010

DecREG3

decfsz reg3,1 ;Decrementar en 1 REG3 y salta si REG3 es 0

nop ; NO REALIZA NINGUNA OPERACION


decfsz reg2,1 ;Si REG3 Si es 0, decrementa REG2 en 1

goto LeeREG3 ;Si REG2 No es0, vuelve a cargar el valor de REG3

decfsz reg1,1 ;Si REG2 Si es 0, decrementa REG1 en 1 y salta si REG1 es 0

goto LeeREG2 ;Si REG1 No es 0, vuelve a cargar el valor de REG2

RETURN ;Si REG1 Si es 0, regresa al programa principal

END
MOTOR
;ENCABEZADO

LIST P=16F84A ;PIC A UTILIZAR

;PALABRA DE CONFIGURACION

__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC ;palabra de configuracion

#INCLUDE <P16F84A.INC> ;librerias del pic a utilizar

;CONFIGURACION DEL PIC

bsf 0x03,5 ;ingresamos al banco 0

movlw 0x1f ;w=00011111

movwf 0x05 ;declaramos bits del puerto A como entradas

clrf 0x06 ;declaramos puerto B como salidas

bcf 0x03,5 ;regresamos al banco 1

;programa 8 con botones

inicio ;etiqueta inicio

movlw 0x00 ;w=0000 0000

movlw PORTA ;PORTA=0000 0000

movlw 0x00 ;W=0000 0000

movwf PORTB ;PORTB=0000 0000

botona ;etiqueta botona

btfss 0x05,0 ;RA0=1?

goto botonc ;SI RA0 NO ES 1 VE A LA ETIQUETA DE BOTONC

goto arranque ;SI RA0 SI ES 1 VE A LA ETIQUETA DE ARRANQUE

botonc ;etiqueta botonc

btfss 0x05,1 ;RA1=1?

goto botona ;SI RA1 NO ES IGUAL A 1 VE A LA ETIQUETA BOTONA

goto cambio ;SI RA1 SI ES IGUAL A 1 VE A LA ETIQUETA CAMBIO

arranque ;etiqueta arranque

movlw 0x01 ;W = 0000 0001


movwf PORTB ;PORTB = 0000 0001

btfss 0x05,2 ;RA2 = 1?

goto arranque ;SI RA2 NO ES IGUAL A 1 VE A LA ETIQUETA ARRANQUE

goto inicio ;SI RA2 SI ES IGUAL A 1 VE A LA ETIQUETA INICIO

cambio ;etiqueta cambio

movlw 0x02 ;W = 0000 0010

movwf PORTB ;PORTB = 0000 0010

btfss 0x05,2 ;RA2 = 1?

goto cambio ;SI RA2 NO ES IGUAL A 1 VE A LA ETIQUETA CAMBIO

goto inicio ;SI RA2 SI ES IGUAL A 1 VE A LA ETIQUETA INICIO

END
DISPLAY
;ENCABEZADO

LIST P=16F84A ;PIC A UTILIZAR

;PALABRA DE CONFIGURACION

__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC

;PALABRA DE CONFIGURACION

#INCLUDE <P16F84A.INC> ;LIBRERIA DEL PIC

;CONFIGURACION DEL PIC

bsf 0x03,5 ;INGRESAR AL BANCO 0

clrf 0x05 ;DEFINIMOS PUERTO A COMO SALIDAS

clrf 0x06 ;DEFINIMOS PUERTO B COMO SALIDAS

bcf 0x03,5 ;INGRESAR AL BANCO 1

;CREACION DE REGISTROS

reg1 equ 0x20 ;EL BANCO DE MEMORIA 0X20 SE LLAMA REG1

reg2 equ 0x21 ;EL BANCO DE MEMORIA 0X21 SE LLAMA REG2

reg3 equ 0x22 ;EL BANCO DE MEMORIA 0X22 SE LLAMA REG3

;programa 9

inicio ;ETIQUEA INICIO

movlw 0xbf ;W = 1011 1111

movwf PORTB ;PORTB = 1011 1111

movlw 0x00 ;W = 0000 0000

movwf PORTA ;PORTA = 0000 0000

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0x86 ;W = 1000 0110

movwf PORTB ;PORTB = 1000 0110

movlw 0x01 ;W = 0000 0001

movwf PORTA ;PORTA = 0000 0001

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0xdb ;W = 1101 1011


movwf PORTB ;PORTB = 1101 1011

movlw 0x02 ;W = 0000 0010

movwf PORTA ;PORTA = 0000 0000

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0xcf ;W = 1100 1111

movwf PORTB ;PORTB = 1100 1111

movlw 0x03 ;W = 0000 0011

movwf PORTA ;PORTA = 0000 0011

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0xe6 ;W = 1110 0110

movwf PORTB ;PORTB = 1110 0110

movlw 0x04 ;W = 0000 0100

movwf PORTA ;PORTA = 0000 0100

call tiempo ` ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0xed ;W = 1110 1101

movwf PORTB ;PORTB = 1110 1101

movlw 0x05 ;W = 0000 0101

movwf PORTA ;PORTA = 0000 0101

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0xfd ;W = 1111 1101

movwf PORTB ;PORTB = 1111 1101

movlw 0x06 ;W = 0000 0110

movwf PORTA ;PORTA = 0000 0110

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0xc7 ;W = 1100 0111

movwf PORTB ;PORTB = 1100 0111

movlw 0x0 ;W = 0000 0111

movwf PORTA ;PORTA =0000 0111

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO


movlw 0xff ;W = 1111 1111

movwf PORTB ;PORTB = 1111 1111

movlw 0x08 ;W = 0000 1000

movwf PORTA ;PORTA = 0000 1000

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0xe7 ;W = 1110 0111

movwf PORTB ;PORTB = 1110 0111

movlw 0x09 ;W = 0000 1001

movwf PORTA ;PORTA = 0000 1001

call tiempo ;W = LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0xf7 ;W = 1111 0111

movwf PORTB ;PORTB = 1111 0111

movlw 0x0a ;W = 0000 1010

movwf PORTA ;PORTA = 0000 1010

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0xfc ;W = 1111 1100

movwf PORTB ;PORTB = 1111 1100

movlw 0x0b ;W = 0000 1011

movwf PORTA ;PORTB = 0000 1011

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0xb9 ;W = 1011 1001

movwf PORTB ;PORTB = 1011 1001

movlw 0x0c ;W = 0000 1100

movwf PORTA ;PORTA = 0000 1100

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0xde ;W = 1101 1110

movwf PORTB ;PORTB = 1101 1110

movlw 0x0d ;W = 0000 1101

movwf PORTA ;PORTA = 0000 1101


call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0xf9 ;W = 1111 1001

movwf PORTB ;PORTB = 1111 1001

movlw 0x0e ;W = 0000 1110

movwf PORTA ;W = 0000 1110

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

movlw 0xf1 ;W = 1111 0001

movwf PORTB ;PORTB = 1111 0001

movlw 0x0f ;W = 0000 1111

movwf PORTA ;PORTA = 0000 1111

call tiempo ;LLAMA A LA SUBRUTINA DE TIEMPO

goto inicio ;VE A LA ETIQUETA DE INICIO

;subrutina de tiempo

tiempo

movlw 0XAC ;w= 1010 1100

movwf reg1 ;REG1=1010 1100

LeeREG2

movlw 0XF6 ;w= 1111 0110

movwf reg2 ;REG2= 1111 0110

LeeREG3

movlw 0X12 ;w= 0001 0010

movwf reg3 ;REG3= 0001 0010

DecREG3

decfsz reg3,1 ;Decrementar en 1 REG3 y salta si REG3 es 0

nop ; NO REALIZA NINGUNA OPERACION

decfsz reg2,1 ;Si REG3 Si es 0, decrementa REG2 en 1

goto LeeREG3 ;Si REG2 No es0, vuelve a cargar el valor de REG3

decfsz reg1,1 ;Si REG2 Si es 0, decrementa REG1 en 1 y salta si REG1 es 0


goto LeeREG2 ;Si REG1 No es 0, vuelve a cargar el valor de REG2

RETURN ;Si REG1 Si es 0, regresa al programa principal

END
PROGRAMA 1

status equ 03h

porta equ 05h

portb equ 06h

trisa equ 85h

trisb equ 86h

org 0x00

bsf status,5

movlw b'00000000'

movf porta

clrf trisb

bcf status,5

tarea:

movf porta,w

movwf portb

end
PROGRAMA 2

trisb equ 86h

status equ 03h

portb equ 06h

dato equ 20h

;configuracion del micro

org 0x00

bsf status,5

movlw b'11110000'

movwf trisb

bcf status,5

tarea:

swapf portb

end

;movt portb,w

;movwf dato

;swapf dato,w

;movwf portb

;end

También podría gustarte