Shop OBEX P1 Docs P2 Docs Learn Events
How to use port B interrupt and RTCC interrupt at the same time? — Parallax Forums

How to use port B interrupt and RTCC interrupt at the same time?

yanss00yanss00 Posts: 5
edited 2006-03-27 15:42 in General Discussion
How to use port B interrupt and RTCC interrupt at the same time?For example, i want a pin of port B to detect a falling edge as to generate a interrupt, at the same time ,I want the RTCC to increse from $00, when the next falling edge comes, the former interrupt ends and a new interrupt generates. Then, I want to·get the·state of RTCC between the two interrupts. What should I do to do this? Is there anything special I should pay great attention to?
Thank you !!
I will be very apperiate if a superior can help me to solve the problem .
My email :yanshaoshi@nudt.edu.cnsmurf.gifsmurf.gif

Comments

  • BongoBongo Posts: 65
    edited 2006-03-27 08:38
    I am not a superior, so I understand if you wish to ignore this post.

    However, there are a few special things that you need to pay attention to. Full details are in the SX-Key manual under the heading of interupts. You need to read these, as I cannot remember specifics for this subject, however from what I do recall SX can only handle one interupt at a time. An interupt will cause a jump to program memory $00. No other interupt will be serviced until after a reti instruction.

    The manual is very good. I only ever found 1 conflict of information, and a few minutes experimentation sorted that. Maybe it has been fixed in later versions.

    I think there mabe some other language options for you, not wishing to cast dispertions on you English, which is obviously far better than my Japanese or French. The Parallax people may be able to direct.

    And now to my English. Is interupt spelt with 1 or 2 r's?

    Bongo
  • PJMontyPJMonty Posts: 983
    edited 2006-03-27 11:34
    Bongo,

    There are two r's in interrupt.

    Yans00,

    Multiple interrupt sources are a real problem on the SX chips. The problem is that if a new interrupt comes in while the SX is already in the interrupt handler, then the new interrupt will be lost. You can read about it in more detail here:

    www.parallax.com/sx/support_faqs.asp#Question%20#6
      Thanks, PeterM
  • BeanBean Posts: 8,129
    edited 2006-03-27 12:10
    Yans00,
    · It sounds like to just want to measure the time between the two PORTB interrupts ?
    · In that case you don't need an RTCC interrupt, unless RTCC will overflow.
    ·
    · Can you provide more details ? Like what would be the mimimum and maximum time between interrupt.
    INTERRUPT
      IF intState = 0 THEN
        RTCC = 0 ' Reset RTCC to zero
      ENDIF
      IF intState = 1 THEN
        intTime = RTCC ' Save RTCC value
        ' Disable further PORTB interrupts
      ENDIF
      INC intState
      ' Clear PORTB interrupt flags
    RETURNINT
     
     
    Start:
      intState = 0
      ' Enable PORTB interrupts
      DO
      LOOP UNTIL intState = 2
      ' intTime now holds value you want
    

    Bean.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module"·available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module"·available from Parallax for only·$49.95 http://www.parallax.com/detail.asp?product_id=30015
    Product web site: www.sxvm.com

    Coming soon... Cheap 4-digit LED display with driver IC·www.hc4led.com

    "Sometimes it is better to remain silent and be thought a fool, than to speak and remove all doubt."
    ·
  • yanss00yanss00 Posts: 5
    edited 2006-03-27 15:42
    Thank you all !!!
    I think I have solved my problems after reading the manual .
    You are all very kind person, thank you once again!!


    "Sometimes it is better to remain silent and be thought a fool, than to speak and remove all doubt."
Sign In or Register to comment.