timer con pic 16f84 5 segundo hasta 5m
| #1 timer con pic 16f84 5 segundo hasta 5m |
| #2 |
|
mabauti
|
intenta este programa:
http://www.todopic.com.ar/utiles/calcular_retardos.zip |
|||||||||||
|
|
||||||||||||
| #3 mabauti |
|
carlin38
|
gracias pero en realiadad necesito un planito para hacer el circuito si puedes mandarme uno
ya que lo e realizado en uno que tengo y solo me da un segundo el archivo que estoy usando LIST p=16F84 ; PIC16F844 is the target processor #include "P16F84.INC" ; Include header file CBLOCK 0x10 ; Temporary storage state l1,l2 ENDC org 0 ; Start up vector. goto setports ; Go to start up code. org 4 ; Interrupt vector. halt goto halt ; Sit in endless loop and do nothing. setports clrw ; Zero in to W. movwf PORTA ; Ensure PORTA is zero before we enable it. movwf PORTB ; Ensure PORTB is zero before we enable it. bsf STATUS,RP0 ; Select Bank 1 clrw ; Mask for all bits as outputs. movwf TRISB ; Set TRISB register. bcf STATUS,RP0 ; Reselect Bank 0. initialise clrw ; Initial state. movwf state ; Set it. loop call getmask ; Convert state to bitmask. movwf PORTB ; Write it to port. incf state,W ; Increment state in to W. andlw 0x04 ; Wrap it around. movwf state ; Put it back in to memory. call DELAY ; DELAY goto loop1 ; And loop getmask movf state,W ; Get state in to W. addwf PCL,F ; Add offset in W to PCL to calc. goto. retlw 0xfe ; state==0 is Green and Red. ;-------------------------------------------------------------------------------- loop1 call getmask1 ; Convert state to bitmask. movwf PORTB ; Write it to port. incf state,W ; Increment state in to W. andlw 0x04 ; Wrap it around. movwf state ; Put it back in to memory. call DELAY ; DELAY goto loop2 ; And loop getmask1 movf state,W ; Get state in to W. addwf PCL,F ; Add offset in W to PCL to calc. goto. retlw 0xfd ; state==0 is Green and Red. ;-------------------------------------------------------------------------------- loop2 call getmask2 ; Convert state to bitmask. movwf PORTB ; Write it to port. incf state,W ; Increment state in to W. andlw 0x04 ; Wrap it around. movwf state ; Put it back in to memory. call DELAY ; DELAY goto loop3 ; And loop getmask2 movf state,W ; Get state in to W. addwf PCL,F ; Add offset in W to PCL to calc. goto. retlw 0xfb ; state==0 is Green and Red. ;-------------------------------------------------------------------------------- loop3 call getmask3 ; Convert state to bitmask. movwf PORTB ; Write it to port. incf state,W ; Increment state in to W. andlw 0x04 ; Wrap it around. movwf state ; Put it back in to memory. call DELAY ; DELAY goto loop4 ; And loop getmask3 movf state,W ; Get state in to W. addwf PCL,F ; Add offset in W to PCL to calc. goto. retlw 0xf7 ; state==0 is Green and Red. ;-------------------------------------------------------------------------------- loop4 call getmask4 ; Convert state to bitmask. movwf PORTB ; Write it to port. incf state,W ; Increment state in to W. andlw 0x04 ; Wrap it around. movwf state ; Put it back in to memory. call DELAY ; DELAY goto loop5 ; And loop getmask4 movf state,W ; Get state in to W. addwf PCL,F ; Add offset in W to PCL to calc. goto. retlw 0xef ; state==0 is Green and Red. ;-------------------------------------------------------------------------------- loop5 call getmask5 ; Convert state to bitmask. movwf PORTB ; Write it to port. incf state,W ; Increment state in to W. andlw 0x04 ; Wrap it around. movwf state ; Put it back in to memory. call DELAY ; DELAY goto loop6 ; And loop getmask5 movf state,W ; Get state in to W. addwf PCL,F ; Add offset in W to PCL to calc. goto. retlw 0xdf ; state==0 is Green and Red. ;-------------------------------------------------------------------------------- loop6 call getmask6 ; Convert state to bitmask. movwf PORTB ; Write it to port. incf state,W ; Increment state in to W. andlw 0x04 ; Wrap it around. movwf state ; Put it back in to memory. call DELAY ; DELAY goto loop7 ; And loop getmask6 movf state,W ; Get state in to W. addwf PCL,F ; Add offset in W to PCL to calc. goto. retlw 0xbf ; state==0 is Green and Red. ;-------------------------------------------------------------------------------- loop7 call getmask7 ; Convert state to bitmask. movwf PORTB ; Write it to port. incf state,W ; Increment state in to W. andlw 0x04 ; Wrap it around. movwf state ; Put it back in to memory. call DELAY ; DELAY goto loop ; And loop getmask7 movf state,W ; Get state in to W. addwf PCL,F ; Add offset in W to PCL to calc. goto. retlw 0x7f ; state==0 is Green and Red. ; De aqui para abajo este es un tiempo. wait1 movlw 999 movwf l1 w1 call wait2 decfsz l1 goto w1 return wait2 clrf l2 w2 decfsz l2 goto w2 return PORTB EQU 06H VAR1 EQU 0CH ;Variables para VAR2 EQU 0DH ;nuestra rutina de Retardo VAR3 EQU 0EH ;nuestra rutina de Retardo i EQU 0FH ;Variable de los cambios del semaforo ;************************************************************************* DELAY MOVLW 20H ;Rutina de Ratardo MOVWF VAR3 SALTO MOVLW 100H MOVWF VAR2 SALTO2 MOVLW 20H MOVWF VAR1 SALTO1 DECFSZ VAR1,1 GOTO SALTO1 DECFSZ VAR2,1 GOTO SALTO2 DECFSZ VAR3,1 GOTO SALTO RETURN END pero solo es un secuenciador quiero variarles los tiempos otra cosa en el MPLAB se simulan bien pero en el circuito practico no por favor si puedes ayudarme |
|||||||||||
|
|
||||||||||||
| #4 REspuesta |
|
yack
|
Puedes hacerlo con retardos incluyendolos en una libreria dentro de tu programa y para controlarlos puedes hacerlo con un control binario apartando una seccion de entradas. para la simulacion puedes hacerlo con el proteus este funciona muy bien espero te sirva mi ayuda
|
|||||||||||
|
|
||||||||||||
|
| Temas de interés | |
|---|---|
| Cambiar direccion de giro de motor cada segundo... | |
| Oscilador de un segundo | |
| Cronometro con centesimas de segundo | |
| tv enciende al segundo intento | |
| subrutina de retardo de un segundo | |
| Foros de Electronica |
| ||
Cuestiones Elementales de Electrónica ||
Fuentes de alimentacion ||
Circuitos de radio ||
Diseño de circuitos en general || || Sistemas de Audio: Preamplificadores, Ecualizadores || Amplificadores || Reparación || Discusión || || Microcontroladores y sistemas embebidos || Circuitos logicos combinacionales y secuenciales || Interfaces y Programacion || Dudas en general || Sistemas de Video || PC Hardware || Telematica y comunicaciones || Tecnologias moviles || Software Electronico || Robotica, Domotica y Mecatronica || Autotrónica || Automatizacion, Electronica industrial y de Potencia || Documentacion, circuitos y esquemas || Donde Las Ideas Convergen... || Tutoriales y Manuales || Proyectos Prácticos || |
Site Map
© Foros de Electrónica
Comunidad Internacional de Electrónicos
Powered by phpBB © 2001, 2005 phpBB Group
Acerca de || Política de privacidad
Generada en = 0.10647 segundos, Consultas = 13
© Foros de Electrónica
Comunidad Internacional de Electrónicos
Powered by phpBB © 2001, 2005 phpBB Group
Acerca de || Política de privacidad
Generada en = 0.10647 segundos, Consultas = 13

