File: atmega48_disabled_timer.c

package info (click to toggle)
simavr 1.6%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 20,268 kB
  • sloc: ansic: 362,806; makefile: 622; ruby: 70; python: 63
file content (37 lines) | stat: -rw-r--r-- 800 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * avrtest.c
 *
 *  Created on: 1 Dec 2009
 *      Author: jone
 */

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

#include "avr_mcu_section.h"
AVR_MCU(F_CPU, "atmega48");

ISR(TIMER0_COMPA_vect)
{
}

int main(void)
{
	// Set up timer0 - do not start yet
	TCCR0A |= (1 << WGM01);                     // Configure timer 0 for CTC mode
	TIMSK0 |= (1 << OCIE0A);                    // Enable CTC interrupt
	OCR0A   = 0xAA;                             // CTC compare value

	//TCCR0B |= (1 << CS00) | (1 << CS01);        // Start timer: clk/64

	sei();                                      // Enable global interrupts

	// here the interupts are enabled, but the interupt
	// vector should not be called
	sleep_mode();

	// this should not be reached
	cli();
	sleep_mode();
}