I'll show how to make a count down timer, and you'll learn from it and adjust your code, so you'll be able to learn
Code:
// 300 seconds
var counter_timer = 300;
void count_down(){
// while we still have to count down:
while(counter_timer > 0){
DEBUG_VAR(counter_timer, 10);
// count down each second:
counter_timer -= time_step / 16;
wait(1);
}
beep();
}