capitano
- 2nd February 2005, 18:15
I write this program for multi interrupt routine but it don't work fine..
help me please....
thank you in advance
DEFINE LOADER_USED 1
DEFINE OSC 20
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50
OPTION_REG=%00000111 ' Pull-up PORTB: Enabled
T1CON=%00100000
CCP1CON=%00000101
T2CON=%00000101 ' Timer 2 is ON - Timer 2 Prescaler 1
CCP2CON=%00001100 ' PWM mode
ADCON0=%00000001 ' A/D converter module is operating
ADCON1=%00000100 ' Confing D D D D A D A A
TRISA = %11101011
TRISB = %11111100
TRISC = %10011100
TRISD = %00000000
TRISE = %00000011
RCSTA = $90 ' Enable USART receive
TXSTA = %00100100 ' Set USART parameters High Speed
SPBRG = 20 ' Set baud rate to 57600
TMR1L=0 ' Reset Timer
TMR1H=0 ' Remember Timer is OFF
pir1.2=0 ' Reset Capture Flag
pir1.0=0
CCP1CON = %00000101
clear
' Interrupt
INTCON = %11100000
PIE1=%00101011
ON INTERRUPT GoTo interr
mainloop:
' Main program
GoTo mainloop
' Interrupt Header
Disable
interr:
'********************************************
'Interrupt PWM
IF PIR1.1=1 Then ' TMR2 to PR2 interrupt flag
PIR1.1=0
' Interrupt routine
endif
'************************************
'Interrupt Velocità
If pir1.2=1 then
pir1.2=0
' Interrupt routine
endif
'************************************
'Interrupt TMR0
If INTCON.2=1 then
' Interrupt routine
INTCON.2=0
endif
'************************************
'Interrupt Network
IF PIR1.5=1 Then
' Interrupt routine
endif
Resume
Enable
the problem is that the interrupt routine are very slow ....
and i have problem tu use te CCP module, the measure are wrong....
there is another via to manage interrupt ???
help me please....
thank you in advance
DEFINE LOADER_USED 1
DEFINE OSC 20
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50
OPTION_REG=%00000111 ' Pull-up PORTB: Enabled
T1CON=%00100000
CCP1CON=%00000101
T2CON=%00000101 ' Timer 2 is ON - Timer 2 Prescaler 1
CCP2CON=%00001100 ' PWM mode
ADCON0=%00000001 ' A/D converter module is operating
ADCON1=%00000100 ' Confing D D D D A D A A
TRISA = %11101011
TRISB = %11111100
TRISC = %10011100
TRISD = %00000000
TRISE = %00000011
RCSTA = $90 ' Enable USART receive
TXSTA = %00100100 ' Set USART parameters High Speed
SPBRG = 20 ' Set baud rate to 57600
TMR1L=0 ' Reset Timer
TMR1H=0 ' Remember Timer is OFF
pir1.2=0 ' Reset Capture Flag
pir1.0=0
CCP1CON = %00000101
clear
' Interrupt
INTCON = %11100000
PIE1=%00101011
ON INTERRUPT GoTo interr
mainloop:
' Main program
GoTo mainloop
' Interrupt Header
Disable
interr:
'********************************************
'Interrupt PWM
IF PIR1.1=1 Then ' TMR2 to PR2 interrupt flag
PIR1.1=0
' Interrupt routine
endif
'************************************
'Interrupt Velocità
If pir1.2=1 then
pir1.2=0
' Interrupt routine
endif
'************************************
'Interrupt TMR0
If INTCON.2=1 then
' Interrupt routine
INTCON.2=0
endif
'************************************
'Interrupt Network
IF PIR1.5=1 Then
' Interrupt routine
endif
Resume
Enable
the problem is that the interrupt routine are very slow ....
and i have problem tu use te CCP module, the measure are wrong....
there is another via to manage interrupt ???