This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Intterupt not working...

Hi,

I'm using a timer and external interrupt to detect the pulse, i can set the timer to run for 5 secs and loop back. But the program cannot vector to the external interrupt. This is my interrupt configurations and routine.

;********************************************
;-----------INTERRUPTS CONFIGURATIONS--------
;********************************************
MOV IE,#8CH
MOV SWCINT,#000H
MOV EIE1,#000H
MOV EIE2,#000H
MOV EIP1,#000H
MOV EIP2,#000H
MOV IP,#08H

;****************************
;-Timer 1 Overflow Interrupt-
;****************************
T1_INT:    CLR TF1        ; Clear overflow flag
          MOV TH1,#0D0H
          MOV TL1,#0A0H
          RETI

;**********************
;-External Interrupt 1-
;**********************
EX_INT:    INC 40H         ; Increment 40H
          RETI

Does the input to the external interrupt need to be digital? Any advice would be nice... Thanks in advance.

Parents
  • My oscillator can only reach a minimum of 2MHz. In this case, the timer will overflow before the pulse come in. And if i take the time between 2 pulse, it will not be accurate. I could not find a 12KHz crystal which can give me 1ms ticks. I can only find 32.768KHz crystal which gives me 0.36ms ticks. Therefore, the program will run very slow and refreshes very slow.

    I just thought of a method using 2MHz...
    Can i just run the timer when the 1st pulse comes in and let it overflow? Everytime it overflow, i increment a variable until it reaches the 2nd pulse. Than i multiply the variable with 0.39sec(Time to overflow) to give me the time. Than i 1/T = F...
    Than F * 60 = BPM...
    Just asking whether isit advisable to use the method.

Reply
  • My oscillator can only reach a minimum of 2MHz. In this case, the timer will overflow before the pulse come in. And if i take the time between 2 pulse, it will not be accurate. I could not find a 12KHz crystal which can give me 1ms ticks. I can only find 32.768KHz crystal which gives me 0.36ms ticks. Therefore, the program will run very slow and refreshes very slow.

    I just thought of a method using 2MHz...
    Can i just run the timer when the 1st pulse comes in and let it overflow? Everytime it overflow, i increment a variable until it reaches the 2nd pulse. Than i multiply the variable with 0.39sec(Time to overflow) to give me the time. Than i 1/T = F...
    Than F * 60 = BPM...
    Just asking whether isit advisable to use the method.

Children