Chapter 8: C Pointers and Arrays
Duration = 0;
hen upcounting, clear when downcounting
TCCR1A = (1<<COM1A1);
CR1
OCRA1L = Volume;
char loop;
}
void startTune(char tune)
{
int song = atoi(&tune) - 1;
stopTune();
Tone = 0;
Tempo = 0;
// Send the song title to the PC
sendFString(TEXT_SONG_TBL[song]);
sendChar('\r');
// looks too complicated..
pSong=(int*)pgm_read_word(&Songs[song]);
Sound_Init();
}
void Sound_Init(void)
{
// Set OC1A w
// Phase/Freq-correct PWM, top value = I
TCCR1B = (1<<WGM13);
sbi(TCCR1B, CS10); // start Timer1, prescaler(1)
// Set a initial value in the OCR1A-register
OCRA1H = 0;
// This will adjust the volume on the buzzer, lower value
// =>higher volume
}
void Play_Tune(void)
{
int temp_hi;