unsigned char|int|long delay_timeout; // select variable type based on maximum timeout value required...
delay_timeout = 0;
while
{
do_rtc_stuff();
// when you need to generate the buzzer delay, set delay_timeout to the appropriate non-zero value...
if(delay is required)
{
delay_timeout = [number of ticks in the required delay];
}
if(delay_timeout)
{
if(--delay_timeout == 0)
{
do_buzzer_stuff(); // this function/code block needs to execute as quickly as possible...
}
}
}