Programa asm - calculadora controlada por pc mediante rs232

Páginas: 6 (1300 palabras) Publicado: 8 de enero de 2012
;Taller III
;Laboratorio 4 - Calculadora controlada por PC
;Badir PJ

__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
LIST P=16F84A
INCLUDE <P16F84A.INC>

CBLOCK 0x0c
Dato1
Dato2
Resultado
Operando
Tecla
Display7s_Dato
ENDC

CERO EQU '0'
UNO EQU '1'
DOS EQU '2'
TRES EQU '3'
CUATRO EQU '4'
CINCO EQU '5'
SEIS EQU '6'
SIETE EQU'7'
OCHO EQU '8'
NUEVE EQU '9'
MAS EQU '+'
MENOS EQU '-'
IGUAL EQU '='
DIEZ10 EQU d'10'
ONCE11 EQU d'11'

#DEFINE RET .13
#DEFINE LIN .10
#DEFINE LED0 PORTB,0
#DEFINE LED1 PORTB,1
#DEFINE LED2 PORTB,2
#DEFINE LED3 PORTB,3
#DEFINE LED4 PORTB,4
#DEFINE LED5 PORTB,5
#DEFINE LED6 PORTB,6
#DEFINE LED7 PORTB,7
#DEFINE BOT PORTA,0

ORG 0

Inicio
callRS232_Inicializa
bsf STATUS,RP0
clrf TRISB
bcf STATUS,RP0
movlw b'00000000'
movwf PORTB
bsf LED7
call Retardo_1s
movlw b'00000000'
movwf PORTB
call RS232_LineasBlanco
movlw Mensaje1
call RS232_Mensaje

Principal
movlw b'00000000'
movwf PORTB
call Leer1
call LeerOp
call Leer2
call LeerIgual


Display
movf Display7s_Dato,W
andlw b'00001111'
addwfPCL,F
Tabla
DT 3Fh,06h,5Bh,4Fh,66h,6dh,7Dh,07h,7Fh,67h,79h,79h,79h,79h,79h,79h,79h,79h,79h
goto Fin

Mensajes
addwf PCL,F
Mensaje1
DT "****** C A L C U L A D O R A L I S T A ********",0x00
Mensaje2
DT RET,LIN,LIN,0x02,"***** OPERADOR INVALIDO *******",0x00
Mensaje3
DT " . Atentamente GRUPO LOS MEDIANOS",0x00
Mensaje4
DT "**** BOTON DE PRUEBA PRESIONADO ******",0x00Caracter
DT RET,LIN,0x00
Menos
DT "-",0x00
Diez
DT "10",0x00
Once
DT "11",0x00
Doce
DT "12",0x00
Trece
DT "13",0x00
Catorce
DT "14",0x00
Quince
DT "15",0x00
Dieciseis
DT "16",0x00
Diecisiete
DT "17",0x00
Dieciocho
DT "18",0x00

Leer1
call TEST
call RS232_LeeDato
movwf Tecla
xorlw CERO
btfsc STATUS,Z
goto Pantalla

movf Tecla,W
xorlw UNO
btfscSTATUS,Z
goto Pantalla

movf Tecla,W
xorlw DOS
btfsc STATUS,Z
goto Pantalla

movf Tecla,W
xorlw TRES
btfsc STATUS,Z
goto Pantalla

movf Tecla,W
xorlw CUATRO
btfsc STATUS,Z
goto Pantalla

movf Tecla,W
xorlw CINCO
btfsc STATUS,Z
goto Pantalla

movf Tecla,W
xorlw SEIS
btfsc STATUS,Z
goto Pantalla

movf Tecla,W
xorlw SIETE
btfsc STATUS,Z
goto Pantallamovf Tecla,W
xorlw OCHO
btfsc STATUS,Z
goto Pantalla

movf Tecla,W
xorlw NUEVE
btfsc STATUS,Z
goto Pantalla
goto Invalido

LeerOp
call TEST
call RS232_LeeDato
movwf Tecla
xorlw MAS
btfsc STATUS,Z
goto Pantalla1

movf Tecla,W
xorlw MENOS
btfsc STATUS,Z
goto Pantalla1
goto Invalido

Leer2
call TEST
call RS232_LeeDato
movwf Tecla
xorlw CERObtfsc STATUS,Z
goto Pantalla2

movf Tecla,W
xorlw UNO
btfsc STATUS,Z
goto Pantalla2

movf Tecla,W
xorlw DOS
btfsc STATUS,Z
goto Pantalla2

movf Tecla,W
xorlw TRES
btfsc STATUS,Z
goto Pantalla2

movf Tecla,W
xorlw CUATRO
btfsc STATUS,Z
goto Pantalla2

movf Tecla,W
xorlw CINCO
btfsc STATUS,Z
goto Pantalla2

movf Tecla,W
xorlw SEIS
btfsc STATUS,Zgoto Pantalla2

movf Tecla,W
xorlw SIETE
btfsc STATUS,Z
goto Pantalla2

movf Tecla,W
xorlw OCHO
btfsc STATUS,Z
goto Pantalla2

movf Tecla,W
xorlw NUEVE
btfsc STATUS,Z
goto Pantalla2
goto Invalido

LeerIgual
call TEST
call RS232_LeeDato
movwf Tecla
xorlw IGUAL
btfsc STATUS,Z
goto Pantalla3
goto Invalido

Pantalla
movf Tecla,W
movwf Dato1movlw Caracter
call RS232_Mensaje
movf Tecla,W
call RS232_EnviaDato
goto Fin

Pantalla1
movf Tecla,W
movwf Operando
movf Tecla,W
call RS232_EnviaDato
goto Fin

Pantalla2
movf Tecla,W
movwf Dato2
movf Tecla,W
call RS232_EnviaDato
goto Fin

Pantalla3
movf Tecla,W
call RS232_EnviaDato
goto Operacion

Operacion
movf Operando,W
xorlw MAS
btfsc STATUS,Z...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Control programado mediante el puerto paralelo del pc
  • Es Un Programa De Software, Este Programa Es De Control Maestro De La Computadora Y Permite Interactuar Con...
  • Programa Comunicacion Rs232
  • Programador Pc
  • Programador de pc
  • Cálculo De Espesor Óptimo De Aislamiento Térmico Mediante Un Programa Computacional De Balance Económico.
  • Interconexión a la PC mediante Arduino
  • GUIA Nº 1 CONTROLADORES LÓGICOS PROGRAMABLES “CONEXIÓN Y COMUNICACIÓN PC-PLC”

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS