Bascom and AVR, AVR clocks


AVR clocks.
The type of AVR controller I started out with was the AT90S2313-10. The 10 and the end of the type-number means that the controller is guaranteed to work at a clock speed of 10MHz. Most often, AVR controllers can be clocked much faster, but there is no guarantee that everything will >always< work at >all extremes< of power-supply voltages or temperature etc.
A lower clock speed is of course always possible (note that for some AVR types special fuse settings may need to be changed when the type of clock or clock speed is changed) As all AVR controllers are a static CMOS design you may even stop the clock. The controller will stay where it was until the clock starts again. Try using a function generator with rectangular TTL-level output as clock oscillator connected to the XTAL1 pin. Leave the XTAL2 pin unconnected. Vary the function generator frequency and observe the result. Very low clock speeds may sometimes be useful when debugging a design.
A standard TTL-level crystal oscillator module may also be used as clock. As with the function generator, connect the output of the module to XTAL1 and leave XTAL2 unconnected. The XTAL2 output may be used in this case as buffered output to be connected to i.e. another controller's XTAL1 input:



Using the XTAL2 output elsewhere in your design can also be done when using the classic approach of connecting a standard crystal between XTAL1 and XTAL2:

(This picture was taken from the AT90S2313 datasheet)

Use at most one HC buffer as load on the XTAL2 output. This simple trick also allows two controllers to run on one crystal oscillator.

TOC