Posted by gaffarr on 02:18:00 03-02-2003
OK
Let's say I have the following portion of the code in code.c file with bunch of other stuff.
/* Wait for 20 millisecond interrupt */
while (Start_Frame_Flag != True)
{ ; }
What do I do in my driver.c to break out of this while loop? Assuming driver.c has the main in it.
Thanks a bunch for help!
Posted by Neu[Mann] on 03:11:00 03-02-2003
break; ?
Posted by gaffarr on 03:54:00 03-02-2003
well break would not work.
here's what I really need
Boolean Start_Frame_Flag;
x ()
/* let's say I am not allowedto change this code */
{
/* Wait for 20 millisecond interrupt */
while (Start_Frame_Flag != True)
{ ; }
}
void main (void)
{
Start_Frame_Flag = False;
/*call to X */
/*It will loop forever */
/* I need some thing to break this while loop here */
x();
} //end of main()
Posted by Neu[Mann] on 05:49:00 03-02-2003
I assume you are in a DOS environment. You could set the real-time clock to generate an interrupt after a given time. In the code of the interrupt, you set Set_Frame_Flag = True and after the interrupt returns, the loop will break. I really know how to do that but that only a matter of finding the right way to initialize the timer.
If you are not in DOS, then I'm really puzzled on why you need such a construct. Please explain what you are trying to do.
Posted by gaffarr on 04:39:00 03-03-2003
You're right! I could set the real-time clock to generate an interrupt after a given time. In the code of the interrupt, I could set Set_Frame_Flag = True and after the interrupt returns, the loop will break. And yes I am in DOS environment. It would be a big help if you could tell me how to initialize and use the timer.
Posted by jjthebear on 07:57:00 03-24-2003
Generally using the setup you have with the first frame testing is a bad idea. This means that on every frame, your program will have to check to see if the first frame is occuring, which equals lower performance. You cannot afford anything less than perfection.
Why wouldn't break work? I'm yet to find a time it wouldn't, but then again I rarely use while loops, yet alone break them
Posted by dxprog on 08:45:00 03-24-2003
Is one or two flipping clock ticks really going to make a big impact in performance? Give me a break!
[addsig]
Posted by jjthebear on 11:04:00 03-24-2003
Yes.