Society of Robots - Robot Forum
Software => Software => Topic started by: PAT_McUser on April 09, 2010, 03:26:07 PM
-
hi,
i hope you can help me this time.
My idea is to make a beeper several noises.
The noismaking is not the problem, how you can sea in the methods signature I want to define frequency and time.
My problem is how to stop the beeping after the in time defined ms.
I can't find a mistake in my code, but maybe you can help me.
void beep(unsigned int time,unsigned int freq)
{
unsigned int w,m;
float t;
t=((float)1)/((float)freq);
w=(unsigned int)(t*1000);
init_timer5(TIMER_CLK_64);
reset_timer5();
while(TCNT5<time)
{
rprintf(" %d",TCNT5);
PORT_ON(PORTC,0);
delay_ms(w);
PORT_OFF(PORTC,0);
delay_ms(w);
}
}
-
what is the frequency of the your mcu ?
-
Hi,
Check if "TCNT5" is updated at all.
-
what is the frequency of the your mcu ?
I use the axon, so I have 16MHz frequenzy
Hi,
Check if "TCNT5" is updated at all.
TCNT5 should be the counter, so I think it should be updatet (I'll test it, but I think so)