在反汇编模式下,Atmel Studio 7.0模拟器和中断

时间:2015-12-17 22:17:07

标签: c assembly avr

我正在忙于一个自学项目,使用Atmel Studio软件的AVR模拟器来模拟我的代码(我的物理目标是Atmega328,在Arduino Uno R3板上)。

当我使用«反汇编模式»时,我反复得到了我的错误行为(而在原生C源调试模式下,它没问题)

在正常模拟器(“C”)模式下,一切都在直接进行,中断被调用。

使用“反汇编”模式运行相同的代码时,不再调用中断例程...

我的“sketche”如下(灵感来自我在atmel文档中发现的一些来源,添加了计数器中断):

#include <avr/io.h>
#include <avr/interrupt.h>

ISR(TIMER0_COMPA_vect) {
    static int savePC = 0;

    savePC++;
}

int main (void)
{
    // setMode(PORTC, output)
    DDRC = 0xff;
    // setMode(PORTB, input)
    DDRB = 0x00;
    // timer_freq = clock_freq/8
    TCCR0B = 0x02;
    // enable timer0 COMP_A interrupt mask
    TIMSK0 = 0x02;
    // after 5*8 = 40 cycles
    OCR0A = 0x05;

    // enable interrupts mask
    sei();

    /* Insert application code here, after the board has been initialized. */
    while(1) {
        PORTC = PINB + 1;
    }
}

我也使用这个“刺激”调试脚本(在Atmel数据库中找到基础ASM sketche“C = B + 1”):

// Example stimuli file, feeds any output on PINC back to PINB.
#10
$repeat 10
    PINB = *PINC
    #10
    $break
$endrep

0 个答案:

没有答案
相关问题