FIGnition FUZE Hardware Reference Manual page 29

Table of Contents

Advertisement

For tuneful music we therefore need to use large match_values. It turns out we can create
a useful range of about 2 octaves from match_values of about 64 to 255, and because the
prescalar shifts by 2 octaves at a time, we can obtain a continual musical range of about 8
octaves. The frequency calculations are given in the AVR datasheet as:
The standard concert pitch is A440, which is at 440Hz, so we need to find N and OCRnx to
match that: N.(1+OCR0A) = fclk/fOC0A , which is 20x10
6
/440 = 45,454, which means that
N (the prescalar value) must be about 256 so that OCRnx is <256. If N is 256, then
OCR0A will be 88. Higher pitches are lower values, by successively dividing by 2
(1/12)
.
Similarly, lower pitches are higher values, by successively multiplying by 2
. This gives
(1/12)
the following pitch table:

Advertisement

Table of Contents
loading

Table of Contents