viernes, 11 de abril de 2014

Laboratorio 2 Implementación Secuencia de Led

En este laboratorio se implementa un desarrollo de firmware para encender en secuencia led con el uso de retardos.


Trabajo realizado por:


·
Diego Armando Buitrago
Buitragofuentes@gmail.com

·
Andrey Baquero Acevedo
Andreybaquero@gmail.com

·
Oscar Felipe Yepes

felipeyepes@gmail.com


Montaje del Circuito. 







Componentes a utilizar

  • 8 Led
  • 8 Resistencia de 150 Ohm
  • PIC 16F877A
  • Cristal de 20 MHZ.
  • 2 condensadores de 22 Picos
  • 1 pulsador
  • 1 Resistencia de 1 K


Código implementado. 



list p=16f877a



#include <p16f877a.inc>




radix HEX



cblock 0x20 ;separa espacios para 20 registros
;definir 3 registros para retardo

Delay1 ;retardo 1
Delay2 ;retardo 2
Delay3 ;retardo 3
endc
org 0x00
goto Start

org 0x05

Delay 
movlw 0x03
movwf Delay3
Delayloop
Decfsz Delay1,1
Goto Delayloop
Decfsz  Delay2,1
Goto Delayloop
Decfsz Delay3,1
goto Delayloop


return



Start

bsf STATUS,RP0   ;se pone en 1 el bit 6 del registro status para cambiarnos al banco 1 
bcf STATUS,RP1 ;se pone en 0 el bit 7 del registro status para cambiarnos al banco 1
clrf TRISB 
bcf STATUS,RP0 ;se pone en 0 el bit 6 del registro status para cambiarnos al banco 0
bcf STATUS,RP1 ;se pone en 0 el bit 7  del registro status para cambiarnos al banco 0

Mainloop
bsf PORTB,0
call Delay
bcf TRISB,0
call Delay
bsf PORTB,1
call Delay
bcf PORTB,1
call Delay
bsf PORTB,2
call Delay
bcf PORTB,2
call Delay
bsf PORTB,3
call Delay
bcf PORTB,3
call Delay
bsf PORTB,4
call Delay
bcf PORTB,4
call Delay
bsf PORTB,5
call Delay
bcf PORTB,5
call Delay
bsf PORTB,6
call Delay
bcf PORTB,6
call Delay
bsf PORTB,7
call Delay
bcf PORTB,7
call Delay
bsf PORTB,6
call Delay
bcf PORTB,6
call Delay
bsf PORTB,5
call Delay
bcf PORTB,5
call Delay
bsf PORTB,4
call Delay
bcf PORTB,4
call Delay
bsf PORTB,3
call Delay
bcf PORTB,3
call Delay
bsf PORTB,2
call Delay
bcf PORTB,2
call Delay
bsf PORTB,1
call Delay
bcf PORTB,1
call Delay
  goto Mainloop


end

Resultado.















No hay comentarios.:

Publicar un comentario