Fragen zu Frequenz in AVR uController (avrdude)

OP #4486388
Lesenswert?

Ich probiere mich gerade an einem Interrupt-Timer, allerdings hänge ich 
bei der genauen Berechnung der Zeit fest. Dabei ist das größte Problem 
eigentlich, dass ich nicht weiß mit welcher Frequenz der interne 
Oszillator vom Atmega16 läuft.

Im Gegensatz zu dem Beispiel aus dem Wiki 
(https://www.mikrocontroller.net/articles/AVR_Fuses#AVRDUDE) zeigt 
avrdude nämlich keine Oszillator Frequenz:
1
avrdude -p m16 -c avrisp2 -P usb -n -v
2

3
avrdude: Version 6.2, compiled on Dec 16 2015 at 07:10:46
4
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
5
         Copyright (c) 2007-2014 Joerg Wunsch
6

7
         System wide configuration file is "/usr/local/Cellar/avrdude/6.2/etc/avrdude.conf"
8
         User configuration file is "/Users/bodokaiser/.avrduderc"
9
         User configuration file does not exist or is not a regular file, skipping
10

11
         Using Port                    : usb
12
         Using Programmer              : avrisp2
13
avrdude: usbdev_open(): Found AVRISP mkII, serno: 000200220428
14
         AVR Part                      : ATmega16
15
         Chip Erase delay              : 9000 us
16
         PAGEL                         : PD7
17
         BS2                           : PA0
18
         RESET disposition             : dedicated
19
         RETRY pulse                   : SCK
20
         serial program mode           : yes
21
         parallel program mode         : yes
22
         Timeout                       : 200
23
         StabDelay                     : 100
24
         CmdexeDelay                   : 25
25
         SyncLoops                     : 32
26
         ByteDelay                     : 0
27
         PollIndex                     : 3
28
         PollValue                     : 0x53
29
         Memory Detail                 :
30

31
                                  Block Poll               Page                       Polled
32
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
33
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
34
           eeprom         4    10   128    0 no        512    4      0  9000  9000 0xff 0xff
35
           flash         33     6   128    0 yes     16384  128    128  4500  4500 0xff 0xff
36
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
37
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
38
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
39
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
40
           calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00
41

42
         Programmer Type : STK500V2
43
         Description     : Atmel AVR ISP mkII
44
         Programmer Model: AVRISP mkII
45
         Hardware Version: 1
46
         Firmware Version Master : 1.23
47
         Vtarget         : 2.4 V
48
         SCK period      : 8.00 us
49

50
avrdude: AVR device initialized and ready to accept instructions
51

52
Reading | ################################################## | 100% 0.00s
53

54
avrdude: Device signature = 0x1e9403 (probably m16)
55
avrdude: safemode: hfuse reads as 99
56

57
avrdude: safemode: hfuse reads as 99
58
avrdude: safemode: Fuses OK (E:FF, H:99, L:E1)
59

60
avrdude done.  Thank you.

Mein aktuelles Programm sieht so aus:
1
#include <avr/io.h>
2
#include <avr/interrupt.h>
3

4
volatile int count = 0;
5

6
int main(void) {
7
    DDRA = (1 << PA0);
8
    DDRB = (1 << PB0);
9
    DDRD = (1 << PD0);
10

11
    PORTA &= (1 << PA0);
12
    PORTB |= (1 << PB0);
13
    PORTD ^= (1 << PD0);
14

15
    TIMSK = (1 << TOIE0);
16
    TCCR0 = (1 << CS02) | (1 << CS00);
17
    TCNT0 = 0x00;
18

19
    sei();
20

21
    for (;;) {
22
        if (count < 10) {
23
            PORTD ^= (1 << PD0);
24
        }
25
    };
26

27
    return 0;
28
}
29

30
ISR (TIMER0_OVF_vect) {
31
    count++;
32
}

Dabei schaltet sich die LED nach ca. 3s aus. Daraus die Frequenz 
herzuleiten führt irgendwie auch nicht ganz zum richtigen Ergebnis 
(glaub ich, Prescaler p, Counts c, Frequenz f, Zeit t):

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren