Skip to main content
Visitor II
May 13, 2007
Question

input capture in ST72325: help!

  • May 13, 2007
  • 2 replies
  • 601 views
Posted on May 13, 2007 at 17:11

input capture in ST72325: help!

    This topic has been closed for replies.

    2 replies

    Visitor II
    May 13, 2007
    Posted on May 13, 2007 at 14:28

    Hi,

    I use PC3 for comunicate with sensor.

    I send 8 bit(PC3 Output) and I wait the ACK bit. The sensor must set low PC3 pin.

    I have setting PC3 input-floating and I have enable input capture with:

    TempVar=TBCSR; //remove pending int

    TBCR1 = ICIE; //enable interrupt

    After last istruction the interrupt occurred.( :o )

    In my routing I have write:

    if(TBCSR & ICF1) //for reset the interrupt

    but I am locked inside interrupt!

    Where is the error?

    Thanks!

    Visitor II
    May 13, 2007
    Posted on May 13, 2007 at 17:11

    I have foud! :D

    I write the solution for other people.

    Before enable the interrupt I must remove the pending int with 2 istruction:

    tmp0=TBCSR;

    tmp0=TBIC1LR;

    and after enable the int:

    TBCR2= 0x00;

    TBCR1 =ICIE;

    In the interrupt routine I must remove the interrupt in same way:

    #pragma TRAP_PROC

    void timerB_handler(void)

    {

    if(TBCSR & ICF1)

    {

    tmp0= TBIC1LR;

    ....

    Bye bye