AVR Studio 4.13.528
GUI Version 4, 13, 0, 528
AVR Simulator 1, 0, 2, 0
ATTINY2313 208

Möchte eine PWM in Mode 14 erzeugen und als Top IRC1=20000 nehmen.
Obwohl nun nach Datenblatt OCR1A ein 16bit Register ist, kann der Wert
0x05DC nicht geladen werden - es wir im Simulator 0x1DC draus. Was läuft falsch - der Simulator, das Datenblatt oder ich ?(

Ein newbee

#include "avr/io.h"
#include "avr/interrupt.h"

// Timer 1 overflow interrupt service routine
ISR (TIMER1_OVF_vect)
{
PORTB |= 0x08;
}

int main(void)
{

PORTB=0x08;
DDRB=0x08;

// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: 31.250 kHz
// Mode: Fast PWM top=ICR1
// OC1A output: Changed Clear on OCR1A Set on Top; (Toggle)
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer 1 Overflow Interrupt: On
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x82;
TCCR1B=0x1A;
ICR1=0x4E20;
TCNT1=0x00;
OCR1A=0x05DC;
OCR1B=0x03FF; // nicht benutzt

// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x80;

// Global enable interrupts
sei();

while (1)
{
// Place your code here


};
}