;------------------------------------------------------------

;------------------------------------------------------------

; Código assembler generado por Niple.

; Nombre del Proyecto:

; Autor: Francisco Freire Blanco.

; Fecha: 22/02/2003

; PIC: 16F84

; Velocidad de reloj: 4 Mhz

; Funcion:

;------------------------------------------------------------

 

 

 LIST    P=PIC16F84

 

 

;------------------------------------------------------------

;                  Declaración de Registros

;------------------------------------------------------------

w                     equ  00h

status                equ  0x03

porta                 equ  0x05

portb                 equ  0x06

puertab               equ  0x0c

_np_tiempo            equ  0x0e

_np_tiempo1           equ  0x0f

_np_tiempo2           equ  0x10

_np_tiempo3           equ  0x12

trisa                 equ  0x85

trisb                 equ  0x86

 

 

;------------------------------------------------------------

;                  Declaración de Bits

;------------------------------------------------------------

ra0             equ  0   ;bit 0 del puerto a

ra1             equ  1   ;bit 1 del puerto a

rb1             equ  1   ;bit 1 del puerto b

rb2             equ  2   ;bit 2 delpuerto b

rp0             equ  5   ;registrer banck select bit

 

 

;------------------------------------------------------------

;                        Inicio

;------------------------------------------------------------

 

reset   org 0

   goto paso2

 

 

;------------------------------------------------------------

;                      programa principal

;------------------------------------------------------------

paso2

   movlw b'00011111'      ;configurar el puerto a como xxxeeeee

   bsf status,rp0         ;cambiar a pagina 1

   movwf trisa

   movlw b'00000000'      ;configurar el puerto b como ssssssss

   bsf status,rp0         ;cambiar a pagina 1

   movwf trisb

   ;escribir en el puerto a

   movlw d'0'

   bcf status,rp0         ;cambiar a pagina 0

   movwf porta

paso5

   nop

   btfss porta,ra1

   goto paso7

   ;escribir en el puerto b

   movlw d'0'

   movwf portb

   btfsc porta,ra0

   goto paso10

   goto paso5             ;     cierra el ciclo

paso10

   movlw b'00000011'      ;sal.linea_estrella

   movwf puertab

   ;escribir en el puerto b

   movf puertab,w

   movwf portb

   ;temporizador 7 seg

   movlw .7

   call tiempo_1_255_seg

   ;fin del temporizador 7 seg

   bcf portb,rb1          ;sal.estrella

   ;temporizador 100 mse

   movlw .10

   call tiempo_100_1000_ms

   ;fin del temporizador 100 mse

   bsf portb,rb2          ;sal.triángulo

paso17

   nop

   btfss porta,ra1

   goto paso5             ;     cierra el ciclo

   goto paso17            ;     cierra el ciclo

paso7

   ;escribir en el puerto b

   movlw b'00001000'

   movwf portb

   goto paso5             ;     cierra el ciclo

 

 

;------------------------------------------------------------

;                  Declaración de Subrutinas

;------------------------------------------------------------

 

tiempo_1_255_seg

   movwf _np_tiempo

   goto tiempo_1_255_seg_1

tiempo_1_255_seg_bucle2

   nop

   nop

   nop

   nop

   nop

   nop

   nop

tiempo_1_255_seg_1

   movlw .10

   movwf _np_tiempo1

tiempo_1_255_seg_bucle1

   nop

   nop

   movlw .99

   movwf _np_tiempo2

tiempo_1_255_seg_bucle0

   nop

   nop

   nop

   movlw .200

   movwf _np_tiempo3

tiempo_1_255_seg_bucle

   nop

   nop

   decfsz _np_tiempo3,1

   goto tiempo_1_255_seg_bucle

   nop

   nop

   nop

   decfsz _np_tiempo2,1

   goto tiempo_1_255_seg_bucle0

   nop

   nop

   nop

   decfsz _np_tiempo1,1

   goto tiempo_1_255_seg_bucle1

   decfsz _np_tiempo,1

   goto tiempo_1_255_seg_bucle2

   return

 

 

tiempo_100_1000_ms

   movwf _np_tiempo

   goto tiempo_100_1000_ms_1

tiempo_100_1000_ms_bucle2

   nop

   nop

   nop

   nop

   nop

   nop

   nop

tiempo_100_1000_ms_1

   movlw .22

   movwf _np_tiempo1

tiempo_100_1000_ms_bucle1

   movlw .150

   movwf _np_tiempo2

tiempo_100_1000_ms_bucle

   decfsz _np_tiempo2,1

   goto tiempo_100_1000_ms_bucle

   decfsz _np_tiempo1,1

   goto tiempo_100_1000_ms_bucle1

   nop

   decfsz _np_tiempo,1

   goto tiempo_100_1000_ms_bucle2

   return

 

 

 End