TODOPIC
Bienvenido(a),
Visitante
. Por favor,
ingresa
o
regístrate
. ¿Perdiste tu
email de activación
?
1 Hora
1 Día
1 Semana
1 Mes
Siempre
Ingresar con nombre de usuario, contraseña y duración de la sesión
Este tema
Este sub-foro
Todo el foro
Google
Inicio
Ayuda
Buscar
Ingresar
Registrarse
TODOPIC
»
Microcontroladores PIC
»
Todo en microcontroladores PIC
(Moderadores:
MGLSOFT
,
pocher
,
Suky
) »
Ayuda con las interrupciones externas en PIC16f874A
« anterior
próximo »
Imprimir
Páginas: [
1
]
Ir Abajo
Autor
Tema: Ayuda con las interrupciones externas en PIC16f874A (Leído 1524 veces)
0 Usuarios y 1 Visitante están viendo este tema.
Davalos
PIC10
Mensajes: 3
Ayuda con las interrupciones externas en PIC16f874A
«
en:
17 de Mayo de 2006, 03:05:12 »
Originalmente este codigo viene para el PIC16f877 unicamente le cambie la libreria, en el simulador del VirtualBreadboard lo hace perfectamente pero cuando utilizo otro simulador que es un poco mas confiable que se llama SourceBoost, no hace lo que en realidad deberia. Si alguien conoce alguna rutina para interrupcion semejante a esta por favor contesteme que la necesito urgentemente. De antemano muchas gracias por tomarse la molestia de leer este mensaje.
Lo que quiero hacer es que cuando el pin RB0 este en 5 volts, se despierte el microprocesador y mientras el pin RB0 este en 0 Volts, este se encuentre en modo sleep. Gracias
list p=16F874a
#include <p16F874a.inc>
BANDERA EQU 0x32
DUERME EQU 0x00
ORG .0
GOTO INIT
ORG .4
ManejaInterrupcion
BTFSS PORTB,0
GOTO GoToSleep
;*********************************************************************
; When we wakeup we change the interrupt to look for a falling edge
; to put us back to sleep
;*********************************************************************
WakeUp
;======Begin INTBO Configuration
BCF INTCON, INTF ;Clear Interrupt flag
BSF STATUS,RP0 ;Access bank 1
BCF OPTION_REG,INTEDG ;Falling Edge Detect
BCF STATUS,RP0 ;Restore bank 0
BSF INTCON,INTE ;Enable the INB0 Interrupt
BCF BANDERA,DUERME
GOTO EndInterrupt
;*********************************************************************
; When we go to sleep we change the interrup to look for a rising edge
; to wake us up
;*********************************************************************
GoToSleep
;======Begin INTBO Configuration
BCF INTCON, INTF ;Clear Interrupt flag
BSF STATUS,RP0 ;Access bank 1
BSF OPTION_REG,INTEDG ;Rising Edge Detect
BCF STATUS,RP0 ;Restore bank 0
BSF INTCON,INTE ;Enable the INB0 Interrupt
BSF BANDERA,DUERME
EndInterrupt
RETFIE
INIT
;======Begin PORT Configuration
BSF STATUS, RP0 ;PORT TRIS Registers are on page 1
;======PORT B
MOVLW .255 ;PORTB Configuration Bits
MOVWF TRISB
;======PORT C
MOVLW .255 ;PORTC Configuration Bits
MOVWF TRISC
;======PORT D
MOVLW .0 ;PORTd Configuration Bits
MOVWF TRISD
BCF STATUS, RP0 ;Restore Page0
;======Begin INTBO Configuration
BCF INTCON, INTF ;Clear Interrupt flag
BSF STATUS,RP0 ;Access bank 1
BSF OPTION_REG,INTEDG ;Rising Edge Detect
BCF STATUS,RP0 ;Restore bank 0
BSF INTCON,INTE ;Enable the INB0 Interrupt
BSF INTCON,GIE ;Enable the Interrupts
DURMIENDO
SLEEP
NOP
MAIN
MOVF PORTC,W
MOVWF PORTD
BTFSC BANDERA,DUERME
GOTO DURMIENDO
GOTO MAIN
END
Este codigo lo tome de un ejemplo que viene el Sw VirtualBreadboard
descargalo en
www.virtualbreadboard.com
En línea
Imprimir
Páginas: [
1
]
Ir Arriba
« anterior
próximo »
TODOPIC
»
Microcontroladores PIC
»
Todo en microcontroladores PIC
(Moderadores:
MGLSOFT
,
pocher
,
Suky
) »
Ayuda con las interrupciones externas en PIC16f874A
anything