How to simulate int flag ICF1 ? I try AVRstud VMLAB PROTEUS

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How to simulate int flag ICF1 ? I try AVRstudio VMLAB PROTEUS - no way.

ATmega48 -88 -168 page 137 in DataSheet

Flag dosen't up on timer1 counting over 255 and I cant simulate interrupt. When I change flag manualy interrupt is occur.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Timer setup iar 5.20.2 demo

  //Set timer 1 in "Phase correct mode".  
  TCCR1A = (1 << WGM11); 

  //Set top value of Timer/counter1.
  ICR1 = 0xff;  

  TCCR1B = (1 << WGM13) | (0 << CS11) | (1 << CS10);

  // Enable Timer1 capture event interrupt.
  TIMSK1 |= (1 << ICIE1);

  //Enable interrupts globally and let motor driver take over.
  __enable_interrupt();

and int

#pragma vector=TIMER1_CAPT_vect
__interrupt void Timer1CaptureISR(void)
{
    int_ctr++; 
}
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Any ideas ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If have no big problems with the simulator in AVRstudio (Vers. 4.13 SP1). I know it was working with an older Version too.

The ICF1 is not supposed to come up at an overflow of the timer. Its just if an external signal comes at the ICP pin (=PB0).

There is a small probelm with interrupts priorities though.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you !