Saturday, March 16, 2013

Embedded System

An embedded system stands for a microprocessor embedded in a device to control its functions. It's very similar to a computer, in that input data can be processed and output. The major difference is, unlike a computer, an embedded system does not have a human sitting in front of a monitor and keyboard to tell it what to do. An embedded system is likely located inside a microwave, or a robotic machinery, to perform certain, but routine tasks. There are usually a few buttons to operate an embedded system, such as "start", "stop", for example. But other than that, it's mostly an autonomous machine running on its own schedule and going through a same set of instructions repeatedly.

One scheme of running an embedded system is to use service scheduling. Once the power button is on, an initialization routine will load a list of service to be executed based on a pre-determined schedule. Such list is something like this:

1. Clean the floor, every 1 hours, starting 5 mins from now
2. Clean the toilet, every 2 hours, starting 10 mins from now
3. Clean the window, every 3 hours, starting now
...

Basically, the schedule contains information of when to do what and how often.

Once the list is loaded, upon hitting the "start" button, the embedded system will start running this permanent loop:

while (1)
{
      if "someone presses 'stop'"
             goto end;
      run_the_list();
}

end:
      exit();

The permanent loop will make sure the machine will ignore everything else happening in the world, faithfully focuses on the tasks scheduled on the service list, until someone presses the "stop" button, or it runs out of power.




No comments: