timer_wait function may be solved TY :)
Posted: Sat Jun 28, 2008 1:34 pm
Hiya 
I cant seem to get this function to work, even with the default code in the function, I gathered you pass an int in which is the number of ticks you want to wait so 18 ticks = 1sec APPROX so 54 ticks = 3 secs, so I wanted to make it wait for 3 secs and have tried every which way but will just post brans function and my call to the function originally since that should be the easiest to fix. I have tried it so many ways that Im thinking just maybe it interrupts before the 3 seonds are up which is why it is never getting out the loop? Would really appreciate if someone could explain why this code isnt working
Ive even done it different many ways and get the same result where it never gets out the loop , have also did the same
in the wait function and the iff never fires which is strange because I have done it so in theory it should be the same values getting tested, any help with this would be greatly appreciated, btw its vmware im using but I still think its more to do with something Im not considering. lol have been at this for hours
I cant seem to get this function to work, even with the default code in the function, I gathered you pass an int in which is the number of ticks you want to wait so 18 ticks = 1sec APPROX so 54 ticks = 3 secs, so I wanted to make it wait for 3 secs and have tried every which way but will just post brans function and my call to the function originally since that should be the easiest to fix. I have tried it so many ways that Im thinking just maybe it interrupts before the 3 seonds are up which is why it is never getting out the loop? Would really appreciate if someone could explain why this code isnt working
Code: Select all
void timer_handler(struct regs *r)
{
/* Increment our 'tick count' */
timer_ticks++;
/* Every 18 clocks (approximately 1 second), we will
* display a message on the screen */
if (timer_ticks % 18 == 0)
{
puts("One second has passed\n");
}
timer_wait(54); //should be 3 secs
puts("after call\n");
}
void timer_wait(int ticks)
{
unsigned long eticks;
//ticks to wait is 54 which should be 3 secs
eticks = timer_ticks + ticks;
while(timer_ticks < eticks );
}
Code: Select all
if (timer_ticks % 18 == 0)
{
puts("One second has passed\n");
}