cancel
Showing results for 
Search instead for 
Did you mean: 

input capture in ST72325: help!

marcosarti29
Associate II
Posted on May 13, 2007 at 17:11

input capture in ST72325: help!

2 REPLIES 2
marcosarti29
Associate II
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!

marcosarti29
Associate II
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