Skip to main content
Visitor II
August 12, 2004
Question

ST7 Lite

  • August 12, 2004
  • 14 replies
  • 1860 views
Posted on August 12, 2004 at 14:01

ST7 Lite

    This topic has been closed for replies.

    14 replies

    brian4Author
    Visitor II
    August 10, 2004
    Posted on August 10, 2004 at 11:40

    I am controling PA0 as an output.

    When I toggle this pin and interupt in genertated ei0.

    I am using other interupts in my assembler so

    A. Can I disble these interupts or if not

    B. How do I service them, the manual is not to clear.

    Regards

    Brian
    Visitor II
    August 10, 2004
    Posted on August 10, 2004 at 13:36

    You cannot disable the external Interrupts. For each External Interrupt you have a separate vector mapped to that interrupt to service that interrupt

    [ This message was edited by: Ansh on 10-08-2004 17:18 ]
    brian4Author
    Visitor II
    August 11, 2004
    Posted on August 11, 2004 at 06:22

    How do you service the interrupt, do you have to write to the EICR or is there a better / another way.

    I am confused because the manual says:-

    Clearing an interrupt request is done by:

    – Writing “0� to the corresponding bit in the status

    register (Brian which status register)

    or

    – Access to the status register while the flag is set

    followed by a read or write of an associated register. (Brian again which registers)

    [ This message was edited by: BrianM on 11-08-2004 09:57 ]

    [ This message was edited by: BrianM on 11-08-2004 10:02 ]
    Visitor II
    August 11, 2004
    Posted on August 11, 2004 at 06:30

    Please can you be more specific on which manual you are referring to.

    brian4Author
    Visitor II
    August 11, 2004
    Posted on August 11, 2004 at 06:34

    Page 32 of the ST7LITE0 Manual / Data sheet

    Visitor II
    August 11, 2004
    Posted on August 11, 2004 at 06:45

    Actually it is better if you refer the datasheet of the device which you can find at the following url:

    http://www.stmcu.com/files/mcu/st7lite1.pdf

    Actually you are confused between the peripheral interrupt and the External Interrupt.

    For a peripheral interrupt you have flags and Interrupt enable bit associated with that Interrupt and you have a particular sequence like the one you have mentioned below for clearing the flag.

    Like for example, you have the Input Capture Interrupt of Lite Timer. With this Interrupt you have the ICIE bit by which you can enable this interrupt and you have the ICF flag which shows the status.

    And now when you want to clear this flag a read operation to the LTICR register will clear this flag.

    But for External Interrupts you do not have such flags and interrupt enable bits. If you want to use an I/O as an interrupt. First of all it should be configured as pull-up Interrupt. Through the EICR register you can select the sensitivity of the Interrupt. And when the particular edge/ level occurs on that pin then the execution jumps to the ISR of that Interrupt. Now if you have a set of operations to be performed on the occurrence of a particular interrupt, it is in this ISR you can include that part of the code.

    I hope I have been able to answer you questions. If you still have any questions please do not hesitate to ask.

    Best Regards

    Ansh

    brian4Author
    Visitor II
    August 11, 2004
    Posted on August 11, 2004 at 07:00

    The data sheets states:-

    ''An external interrupt triggered on edge will be

    latched and the interrupt request automatically

    cleared upon entering the interrupt service routine.''

    I am using PA bit 0 as an output and just toggling this pin.

    I am finding that this generates an interrupt and is not cleared.

    If I add the following: -

    .ext0_rt

    ld A,#$AA

    ld EICR,A

    iret

    Then my code works

    I feel I must be missing somthing simple
    Visitor II
    August 11, 2004
    Posted on August 11, 2004 at 08:49

    Once an Interrupt occurs it is not cleared. The request is cleared automatically upon entering the interrupt service routine.

    The Interrupt service routine in your case is as below

    .ext0_rt

    ld A,#$AA

    ld EICR,A

    iret

    Without entering the ISR your interrupt request will not get cleared. You ISR could be

    .ext0_rt

    //any code whatever you want to perform//

    iret.

    You don't have to write to the EICR register to clear the Interrupt request.
    brian4Author
    Visitor II
    August 11, 2004
    Posted on August 11, 2004 at 09:15

    my code does not continue unless I use

    ld A,#$AA

    ld EICR,A

    If I dont use the above my code does not seem to continue

    Visitor II
    August 11, 2004
    Posted on August 11, 2004 at 09:52

    That seems very surprising. Can you attach a sample of your code. Also did you check by including just simple NOP instruction in your ISR, is it working.

    And by what do mean by doesn't seem to continue. Do you mean that it is juts stuck in that ISR.