Described earlier for now but be aware that not

This preview shows page 2 - 4 out of 38 pages.

described earlier for now, but be aware that not everyone will agree with ourdefinition.When we say “embedded” therefore, we refer to something implementedwith a microcontroller.Since microcontrollers are constantly getting newfeatures and capabilities, this is a “living” definition.Embedded programs typically differ from other programs in several sig-nificant ways:They’re smaller. While even a tiny application for, say, an applicationfor a popular personal computer operating system might consist ofseveral hundred thousand bytes of program, there are typically only afew tens of kilobytes available for program storage in a microcontrollersystem.They’re simpler. An application for a popular personal computer oper-ating system will typically make extensive use of system libraries andthe levels of hierarchy involved in the application (function calls withinfunction calls) would normally be 10 or more levels deep. This would beuncommon in a microcontroller environment. It wouldn’t be unusualfor the number of levels of hierarcy in a large program to be on the or-der of 50 (including system libraries that it uses), while the maximumnumber of levels in the PIC18F architecture is 32. The complexity ofa program is typically directly related to the number of levels in thecalling hierarchy (as an exponential function of the number of levels),so the complexity of the large program could easily be 218or about262000 times as complex as the largest microcontroller program.
2
They use less memory. The fact that the amount of RAM available in amicrocontroller is limited to at most a few kilobytes while the amountof RAM available in even a small personal computer is on the orderof a few hundred megabytes (and more if virtual memory is taken intoaccount) is also a factor in the different complexities of the programsfor each type of system.We’ll be focusing on the use of the Microchip MCC18 C compiler, whichis fairly typical of the class of C compilers for embedded applications. Weshould note that C is an industry standard. However, there are subtle differ-ences in syntax between all compilers, some of these allowed by the standard(via constructs like the “pragma” interface) and some which are idiosyncraticand would cause other compilers to generate errors instead of code. As theMCC18 compiler manual states, the Microchip C compiler is ANSI compati-ble except where “necessary to accomodate the architecture of the processor”or “to provide greater efficiency.”The differences are primarily due to the Harvard architecture of the mem-ory and to the fact that, in a microcontroller environment bit-oriented accessto memory are much more important than in normal programming. This istrue for two reasons, first because much I/O involves bit-oriented access toregisters required for programming the devices, and second because a sig-nificant part of microcontroller application programming involves Booleanlogic, and a Boolean variable only uses 1 bit; because memory is in such

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture