Shop OBEX P1 Docs P2 Docs Learn Events
New at interrupts. — Parallax Forums

New at interrupts.

ERIC THE GREATERIC THE GREAT Posts: 19
edited 2008-09-03 18:32 in General Discussion
Does anyone know why in the following code only digit3 will display and the other 3 stay blank?

Comments

  • BeanBean Posts: 8,129
    edited 2008-09-03 12:36
    Eric,
    · You need to remove the "GOTO ISR_Exit" lines.
    ·· They are not needed, and they are outside of the IF..ENDIF. So the first one encountered ends the whole interrupt.

    ···If you use an array to hold·the·"LEDNum" and "DIGITx" values, the interrupt would be much simpler.

    ISR_Start:
      INC Counter
      Counter.2 = 0 ' Keep counter in range 0 to 3
    
     
      SEGMENTS = BLANK
      LEDNUM = LED_Values(Counter)
      READ SEG_MAP + Digits(Counter), SEGMENTS
    
     
    ISR_Exit:
      RETURNINT
    
    

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    "A government big enough to give you everything you want, is big enough to take away everything you·have."·· Thomas Jefferson

    "It is our choices, Harry, that show what we truly are, far more than our abilities."·Dumbledore from Harry Potter

    www.iElectronicDesigns.com



    Post Edited (Bean (Hitt Consulting)) : 9/3/2008 12:48:49 PM GMT
  • JonnyMacJonnyMac Posts: 9,215
    edited 2008-09-03 18:03
    Note, too, that the COUNT function will be disrupted by the ISR. What is you maximum pulse rate coming in? I have code you can dump into the ISR to do the counting in the background as it's updating the display. Theoretically, your maximum input frequency can be 1/2 the ISR frequency so with your present ISR setting you could count pulses coming in at up to 500 Hz.

    Post Edited (JonnyMac) : 9/3/2008 6:32:52 PM GMT
  • basicstampedebasicstampede Posts: 214
    edited 2008-09-03 18:15
    Eric, what is the source of interrupt? And how oftten does it occur?

    And I noticed INTERRUPT 1000 What does this statement do?

    (I am trying to learn about interrupt).
  • JonnyMacJonnyMac Posts: 9,215
    edited 2008-09-03 18:32
    INTERRUPT 1000 causes the interrupt to run 1000 times per second -- or every millisecond. There is information on the INTERRUPT settings in the help file. In this case the interrupt is triggered by the RTCC rollover. SX/B simplifies ISR programming by making the correct settings to the OPTION register and reloading the RTCC at the end of the interrupt code.
Sign In or Register to comment.