ATmega8 (961722), страница 6
Текст из файла (страница 6)
The optimal value of the capacitors depends on the crystal or resonatorin use, the amount of stray capacitance, and the electromagnetic noise of the environment. Some initial guidelines for choosing capacitors for use with crystals are given inTable 4. For ceramic resonators, the capacitor values given by the manufacturer shouldbe used.Figure 11.
Crystal Oscillator ConnectionsC2C1XTAL2XTAL1GNDThe Oscillator can operate in three different modes, each optimized for a specific frequency range. The operating mode is selected by the fuses CKSEL3..1 as shown inTable 4.Table 4. Crystal Oscillator Operating ModesCKOPTCKSEL3..1FrequencyRange(MHz)Recommended Range for CapacitorsC1 and C2 for Use with Crystals (pF)1101(1)0.4 - 0.9–11100.9 - 3.012 - 2211113.0 - 8.012 - 220101, 110, 1111.0 ≤12 - 22Note:1. This option should not be used with crystals, only with ceramic resonators.The CKSEL0 Fuse together with the SUT1..0 Fuses select the start-up times as shownin Table 5.252486O–AVR–10/04Table 5. Start-up Times for the Crystal Oscillator Clock SelectionCKSEL0SUT1..0Start-up Timefrom Power-downand Power-save000258 CK(1)4.1 msCeramic resonator, fastrising power001258 CK(1)65 msCeramic resonator, slowlyrising power0101K CK(2)–Ceramic resonator, BODenabled0111K CK(2)4.1 msCeramic resonator, fastrising power1001K CK(2)65 msCeramic resonator, slowlyrising power10116K CK–Crystal Oscillator, BODenabled11016K CK4.1 msCrystal Oscillator, fastrising power11116K CK65 msCrystal Oscillator, slowlyrising powerNotes:Low-frequency CrystalOscillatorAdditional Delayfrom Reset(VCC = 5.0V)Recommended Usage1.
These options should only be used when not operating close to the maximum frequency of the device, and only if frequency stability at start-up is not important for theapplication. These options are not suitable for crystals.2. These options are intended for use with ceramic resonators and will ensure frequency stability at start-up. They can also be used with crystals when not operatingclose to the maximum frequency of the device, and if frequency stability at start-up isnot important for the application.To use a 32.768 kHz watch crystal as the clock source for the device, the Low-frequency Crystal Oscillator must be selected by setting the CKSEL Fuses to “1001”. Thecrystal should be connected as shown in Figure 11.
By programming the CKOPT Fuse,the user can enable internal capacitors on XTAL1 and XTAL2, thereby removing theneed for external capacitors. The internal capacitors have a nominal value of 36 pF.When this Oscillator is selected, start-up times are determined by the SUT Fuses asshown in Table 6.Table 6. Start-up Times for the Low-frequency Crystal Oscillator Clock SelectionSUT1..0Start-up Time fromPower-down andPower-saveAdditional Delayfrom Reset(VCC = 5.0V)001K CK(1)4.1 msFast rising power or BOD enabled01(1)1K CK65 msSlowly rising power1032K CK65 msStable frequency at start-up11Note:26Recommended UsageReserved1. These options should only be used if frequency stability at start-up is not importantfor the application.ATmega8(L)2486O–AVR–10/04ATmega8(L)External RC OscillatorFor timing insensitive applications, the external RC configuration shown in Figure 12can be used.
The frequency is roughly estimated by the equation f = 1/(3RC). C shouldbe at least 22 pF. By programming the CKOPT Fuse, the user can enable an internal 36pF capacitor between XTAL1 and GND, thereby removing the need for an externalcapacitor.Figure 12. External RC ConfigurationVCCRNCXTAL2XTAL1CGNDThe Oscillator can operate in four different modes, each optimized for a specific frequency range. The operating mode is selected by the fuses CKSEL3..0 as shown inTable 7.Table 7. External RC Oscillator Operating ModesCKSEL3..0Frequency Range (MHz)01010.1 - 0.901100.9 - 3.001113.0 - 8.010008.0 - 12.0When this Oscillator is selected, start-up times are determined by the SUT Fuses asshown in Table 8.Table 8.
Start-up Times for the External RC Oscillator Clock SelectionSUT1..0Start-up Time fromPower-down andPower-saveAdditional Delayfrom Reset(VCC = 5.0V)0018 CK–0118 CK4.1 msFast rising power1018 CK65 msSlowly rising power11(1)4.1 msFast rising power or BOD enabledNote:6 CKRecommended UsageBOD enabled1.
This option should not be used when operating close to the maximum frequency ofthe device.272486O–AVR–10/04Calibrated Internal RCOscillatorThe calibrated internal RC Oscillator provides a fixed 1.0, 2.0, 4.0, or 8.0 MHz clock. Allfrequencies are nominal values at 5V and 25°C. This clock may be selected as the system clock by programming the CKSEL Fuses as shown in Table 9. If selected, it willoperate with no external components. The CKOPT Fuse should always be unprogrammed when using this clock option. During reset, hardware loads the 1 MHzcalibration byte into the OSCCAL Register and thereby automatically calibrates the RCOscillator.
At 5V, 25°C and 1.0 MHz Oscillator frequency selected, this calibration givesa frequency within ± 3% of the nominal frequency. Using run-time calibration methodsas described in application notes available at www.atmel.com/avr it is possible toachieve ± 1% accuracy at any given VCC and Temperature. When this Oscillator is usedas the chip clock, the Watchdog Oscillator will still be used for the Watchdog Timer andfor the Reset Time-out.
For more information on the pre-programmed calibration value,see the section “Calibration Byte” on page 222.Table 9. Internal Calibrated RC Oscillator Operating ModesNote:CKSEL3..0Nominal Frequency (MHz)0001(1)1.000102.000114.001008.01. The device is shipped with this option selected.When this Oscillator is selected, start-up times are determined by the SUT Fuses asshown in Table 10. PB6 (XTAL1/TOSC1) and PB7(XTAL2/TOSC2) can be used aseither general I/O pins or Timer Oscillator pins..Table 10.
Start-up Times for the Internal Calibrated RC Oscillator Clock SelectionSUT1..0Start-up Time fromPower-down andPower-saveAdditional Delayfrom Reset(VCC = 5.0V)006 CK–016 CK4.1 msFast rising power6 CK65 msSlowly rising power(1)1011Note:28Recommended UsageBOD enabledReserved1. The device is shipped with this option selected.ATmega8(L)2486O–AVR–10/04ATmega8(L)Oscillator Calibration Register– OSCCALBitRead/Write76543210CAL7CAL6CAL5CAL4CAL3CAL2CAL1CAL0R/WR/WR/WR/WR/WR/WR/WR/WInitial ValueOSCCALDevice Specific Calibration Value• Bits 7..0 – CAL7..0: Oscillator Calibration ValueWriting the calibration byte to this address will trim the Internal Oscillator to remove process variations from the Oscillator frequency. During Reset, the 1 MHz calibration valuewhich is located in the signature row High byte (address 0x00) is automatically loadedinto the OSCCAL Register.
If the internal RC is used at other frequencies, the calibrationvalues must be loaded manually. This can be done by first reading the signature row bya programmer, and then store the calibration values in the Flash or EEPROM. Then thevalue can be read by software and loaded into the OSCCAL Register. When OSCCAL iszero, the lowest available frequency is chosen. Writing non-zero values to this registerwill increase the frequency of the Internal Oscillator. Writing 0xFF to the register givesthe highest available frequency. The calibrated Oscillator is used to time EEPROM andFlash access. If EEPROM or Flash is written, do not calibrate to more than 10% abovethe nominal frequency.
Otherwise, the EEPROM or Flash write may fail. Note that theOscillator is intended for calibration to 1.0, 2.0, 4.0, or 8.0 MHz. Tuning to other values isnot guaranteed, as indicated in Table 11.Table 11. Internal RC Oscillator Frequency RangeOSCCAL ValueMin Frequency in Percentage ofNominal Frequency (%)Max Frequency in Percentage ofNominal Frequency (%)0x00501000x7F751500xFF100200292486O–AVR–10/04External ClockTo drive the device from an external clock source, XTAL1 should be driven as shown inFigure 13.
To run the device on an external clock, the CKSEL Fuses must be programmed to “0000”. By programming the CKOPT Fuse, the user can enable an internal36 pF capacitor between XTAL1 and GND.Figure 13. External Clock Drive ConfigurationEXTERNALCLOCKSIGNALWhen this clock source is selected, start-up times are determined by the SUT Fuses asshown in Table 12.Table 12. Start-up Times for the External Clock SelectionSUT1..0Start-up Time fromPower-down andPower-saveAdditional Delayfrom Reset(VCC = 5.0V)006 CK–016 CK4.1 msFast rising power106 CK65 msSlowly rising power11Recommended UsageBOD enabledReservedWhen applying an external clock, it is required to avoid sudden changes in the appliedclock frequency to ensure stable operation of the MCU.