Semaforo

Páginas: 3 (533 palabras) Publicado: 18 de febrero de 2013
list p=16F84A ; list directive to define processor
#include ; processor specific variable definitions

__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC

;*****VARIABLE DEFINITIONS
w EQU 0 ; w=guardar en w
f EQU 1 ; f=guardar en el registro
estado EQU 0x03

cblock 0x0C
PDel0
PDel1
PDel2
repeat
repeaux
endc;**********************************************************************
ORG 0x000 ; processor reset vector
goto main ; go to beginning of program
ORG 0x04;**Vector de interrupción

main bsf STATUS,RP0
movlw 0x1F
movwf PORTA ;PA entradas
movlw 0x00
movwf PORTB ;PB salida
bcf STATUS,RP0

clrwdt;***************************************************************************
clrf PORTB ;Borra el puerto

swi0 btfsc PORTA,0
goto swi1
goto tempo0

swi1 btfsc PORTA,1
goto swi2
goto tempo1


swi2btfsc PORTA,2
goto swi3
goto tempo2

swi3 btfsc PORTA,3
goto tempo4
goto tempo3

tempo4 movlw 0x05
movwf repeat
goto intreci

tempo0 movlw 0x01
movwf repeat
goto intrecitempo1 movlw 0x02
movwf repeat
goto intreci

tempo2 movlw 0x03
movwf repeat
goto intreci

tempo3 movlw 0x04
movwf repeat;*************************************************************

intreci bcf PORTB,5 ;Apaga el rojo2
bsf PORTB,0 ;Enciende el rojo1
bsf PORTB,3 ;Enciende el verde2
call PDelay
call PDelay
call PDelay
call PDelay

bcf PORTB,3 ;Apagael verde2

bsf PORTB,4 ;Enciende el Amarillo2
call DEMORA

bcf PORTB,4 ;Apaga el Amarillo2
call DEMORA

bsf PORTB,4 ;Enciende el Amarillo2
call DEMORA

bcf PORTB,4;Apaga el Amarillo2
call DEMORA

bsf PORTB,4 ;Enciende el Amarillo2
call DEMORA

bcf PORTB,4 ;Apaga el Amarillo2
call DEMORA


bcf PORTB,0 ;Apaga el rojo 1
bsf...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Los Semaforos
  • semaforo
  • Semaforo
  • semaforo
  • SEMAFORO
  • Semáforo
  • Semaforo
  • Semáforos

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS