AVR Simulator

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

(Thread drift is my specialty!)

Is there a way of triggering, or pretending to trigger an interrupt in the AVR Simulator so you can step through your interrupt routine and see where you've goofed up?

Thanks

The largest known prime number: 282589933-1

It's easy to stop breaking the 10th commandment! Break the 8th instead. 

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

Hi,

I am certainly no expert but I have simulated the m169 Pin Change Interrupt and the Timer interrupts. To trigger a Timer ISR in my code I just manually tick the appropriate Flag register bit. To trigger a Pin Change ISR I just tick the appropriate PINx bit. I have not had luck using this method with the USART interrupts but that may be me. Of course check the Known Issues section in Studio Help to see if certain Interrupts are supported (I forget but maybe the USART is in the Known Issues section as not being supported at this time).

I don't know if this will help you...I hope so.

Regards,
Steve

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

I only use 3.56. You will need 4.xx users to comment on applicability.

In general, yes. Set a breakpoint, or break at an arbitrary point. Set the applicable bit in the I/O map; in 3.56 there is a little flag denoting it. Your next "step" should take you to the ISR.

When I do that, I usually have a breakpoint set inside the ISR at the first "real" statement (after C register saving, etc.).

This can also be done with UART RX. --BUT-- you need to set the breakpoint in the RX ISR, cause the RX interrupt to fire, and then load UDR with the desired value before letting the ISR continue.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

You can also trigger an interrupt in your software if you want...

Yahoo CodevisionAVR mail group wrote:
From: "David Rodgers"
Date: Thu Jun 17, 2004 2:04 pm
Subject: Re: Triggering an interrupt from main(); is it possible?

> --- In codevisionavr@yahoogroups.com, Patrick Blanchard MD
>
wrote:
> For debugging UART, will this trigger the reciver interrupt with
> the UART? If not, how can the interrupt be triggered in main()
> without having a serial device attached to the port?
>
> UDRn=0x01; // trigger UART recive ISR in main() for debugging.

No, this will not work. Think about it... writing to UDR0 will
cause a serial transmit operation. The only way to trigger a
serial receive event is to send a character to the AVR; you'll
need to attach something to the AVR.

As mentioned, if you want to self-induce an interrupt, you can
trigger one of the external interrupts in software.

// configure INT7+GPIO (I'm assuming you have a Mega128)
// assumes INT7 is presently disabled
PORTE.7 = 0; // turn off INT7 pull-up
EICRB |= 0xc0; // INT7 rising edge
EIFR = 0x80; // clear INT7 flag
EIMSK |= 0x80; // enable INT7

// trigger INT7
PORTE.7 = 1; // enable INT7 pull-up - should generate rising edge

interrupt [EXT_INT7] void EXT_INT7_ISR(void)
{
// dance if you feel like it

// reset port pin
PORTE.7 = 0; // turn off INT7 pull-up
}

David Rodgers

[/code]