Hallo,
CodeBox Datenblattausschnitt
==============================================
=== ATmega8 - USART-Register UBRRH + UCSRC ===
=== So steht es im Datenblatt von Atmel ===
==============================================
Ausschnitt aus der "Register Summary" ...
+-------------------+-------+-------+-------+------+------+------+-------+-------+-------+-----+
| Address | Name | Bit 7 | Bit 6 |Bit 5 |Bit 4 |Bit 3 | Bit 2 | Bit 1 | Bit 0 |Page |
+-------------------+-------+-------+-------+------+------+------+-------+-------+-------+-----+
| 0x21 (0x41) | WDTCR | – | – | – | WDCE | WDE | WDP2 | WDP1 | WDP0 | 41 |
+-------------------+-------+-------+-------+------+------+------+-------+-------+-------+-----+
| | UBRRH | URSEL | – | – | – | UBRR[11:8] | 155 |
| 0x20(1) (0x40)(1) +-------+-------+-------+------+------+------+-------+-------+-------+-----+
| | UCSRC | URSEL | UMSEL | UPM1 | UPM0 | USBS | UCSZ1 | UCSZ0 | UCPOL | 153 |
+-------------------+-------+-------+-------+------+------+------+-------+-------+-------+-----+
| 0x1F (0x3F) | EEARH | – | – | – | – | – | – | – | EEAR8 | 18 |
+-------------------+-------+-------+-------+------+------+------+-------+-------+-------+-----+
Notes: 1. Refer to the USART description for details on how to access UBRRH and UCSRC.
Ausschnitt aus der "USART Description" ...
==== Accessing UBRRH/UCSRC Registers ====
The UBRRH Register shares the same I/O location as the UCSRC Register. Therefore
some special consideration must be taken when accessing this I/O location.
-- Write Access --
When doing a write access of this I/O location, the high bit of the value written, the
USART Register Select (URSEL) bit, controls which one of the two registers that will be
written. If URSEL is zero during a write operation, the UBRRH value will be updated. If
URSEL is one, the UCSRC setting will be updated.
-- Read Access --
Doing a read access to the UBRRH or the UCSRC Register is a more complex operation.
However, in most applications, it is rarely necessary to read any of these registers.
The read access is controlled by a timed sequence. Reading the I/O location once
returns the UBRRH Register contents. If the register location was read in previous system
clock cycle, reading the register in the current clock cycle will return the UCSRC
contents. Note that the timed sequence for reading the UCSRC is an atomic operation.
Interrupts must therefore be controlled (e.g., by disabling interrupts globally) during the
read operation.
=== Mit PonyProg ausgelesene Fuse-Bits ===
; ========== ATmega8 ==========
;
; * SUT1 und SUT0 (Zustand=11): Start-up Time 65ms nach Reset,
; Einstellung für Quarzoszillator und langsam ansteigende
; Betriebsspannung (Tabelle 5 des Datenblattes)
; * CKSEL3-CKSEL0 (Zustand=1111): Quarzoszillator im Bereich 3-8MHz
; (Tabelle 4 des Datenblattes)
; * CKOPT (Zustand=1): schneller Quarzoszillator (Tabelle 4 des Datenblattes)
; * BODEN (Zustand=0): Brown-out einschalten
; * BODLEVEL (Zustand=1): Brown-out Schwelle auf 2,7V setzen
;
; Unter Beachtung der invertierten Logik der Fuse-Bits sollte man
; also die Fuses so setzen wie im folgenden Bild:
;
; ( )7 ( )6 [ ]BootLock12 [ ]BootLock11 [ ]BootLock02 [ ]BootLock01 [ ]Lock2 [ ]Lock1
;
; [ ]S8535C [ ]WDTON (X)SPIEN [ ]CKOPT [ ]EESAVE [X]BOOTSZ1 [X]BOOTSZ0 [ ]BOOTRST
;
; [ ]BODLEVEL [X]BODEN [ ]SUT1 [ ]SUT0 [ ]CKSEL3 [ ]CKSEL2 [ ]CKSEL1 [ ]CKSEL0
; ______________________
; | |
; | [X] Bit=0 [ ] Bit=1 | ( ) -> Nicht anwaehlbar [ ] -> Anwaehlbar
; | progr. unprogr. |
; |______________________|
;
ich hab mal die wichtigsten Teile aus dem Datenblatt zusammengesucht ...
Im Gegensatz zum ATtiny2313 ...
CodeBox Datenblattausschnitt
==============================================
=== ATtiny2313 - System Clock + Fuse Bits ===
=== So steht es im Datenblatt von Atmel ===
==============================================
== System Clock and Clock Options ==
-- Default Clock Source --
The device is shipped with CKSEL = “0010”, SUT = “10”, and CKDIV8 programmed.
The default clock source setting is the Internal RC Oscillator with longest start-up time
and an initial system clock prescaling of 8. This default setting ensures that all users can
make their desired clock source setting using an In-System or Parallel programmer.
== Fuse Bits ==
Table 69. Fuse Low Byte
+---------------+--------+-------------------+----------------+
| Fuse Low Byte | Bit No | Description | Default Value |
+---------------+--------+-------------------+----------------+
| CKDIV8 | 7 | Divide clock by 8 | 0 (programmed) |
+---------------+--------+-------------------+----------------+
Das sind meine Erkenntnisse aus den Datenblättern. Demnach besitzt der
ATmega8
KEIN CKDIV8-FuseBit. Beim ATtiny2313 ist es jedoch
vorhanden. Auch die Suche im Datenblatt des ATmega8 ergab keinen
Treffer und es gab nirgends im Datenblatt (2 Versionen durchsucht) einen
Hinweis.
Trotzdem sollte man bei "komischem Programmverhalten" an die Existenz des
Bits denken
Edit: Ich hab das Datenblatt des ATmega32(L) auch mal durchsucht. Kein Hinweis
auf ein CKDIV8. Das hätte ich auch spätestens bei meinen Versuchen mit der
USART und dem ATmega32 gemerkt. Den setz ich auch ein. Ich schätze mal,
das Pollin da in der Beschreibung des Bausatzes einiges vermixt hat.
Ich hab auch noch mal die Datenblätter des m8515, m8535, m128 durchsucht. NIX !
Bei den Tinys scheint sie aber wohl bei jedem Prozessor vorhanden zu sein.
Gruß
Dino