what is an infinite loop?
What is an infinite loop?
Collapse
X
-
Tags: None
-
An infinite loop is a loop whose condition is never satisfied.
Eg.
Bool isRunning = true;
while(isRunning )
{
Console.WriteLi ne("running");
}
this loop will never ends (infinite loop)Comment
-
-
when programming embedded systems infinite loops are used all the time. e.g. when switched on a river level monitoring system goes into an infinite loop checking the water level and reporting regularly.
The following is a fragment of code from a USB device (which can be connected to a PC USB port) based on a Microchip PIC24FJ64GB002 microcontroller
in addition one also tends to have a watchdog timer which if the device gets into lockup state will restart the system.Code:InitializeSystem(); // initialise USB and IO devices while(1) { USBDeviceTasks(); // poll USB interface for activity ProcessIO(); // process any device specific IO }Comment
-
Comment