This chapter introduces 8051 C programming. The 8051 C is designed for programming the 8051 microcontroller. It is both an
extension and subset of ANSI C. It is assumed that the readers of this book have basic C programming knowledge. The ANSI C
syntax is given in Appendix A for your reference. The difference in programming with 8051 C compared to ANSI C programming
are all about the microcontroller architecture such as I/O ports, memory, CPU registers, timers and interrupts. Everybody
knows C is the closest to assembly language and is a better choice for large and complex system software, device drivers,
or embedded software. However, it is still platform independent so that ANSI C may not be the best choice for the time critical
or resource critical software project. It is difficult to write projects in machine dependent assembly language because the
programmer must know all the hardware details, and it is difficult to do debugging, testing, and maintenance. The 8051 C is
between the C standard language and “51” family assembly language. It will be much easier for a C programmer to switch to
8051 C because he/she only needs to learn the extensions to the language and to deal with missing parts of the standard library.
Assembly instructions can be embedded into 8051 C programs if it is necessary. Most microcontrollers have a dedicated C compiler
available just like the 8051 C for “8051” family microcontrollers. This chapter will discuss the C extension related hardware
so that you will have a better understanding of the foundation of the 8051 microcontroller before you do coding in 8051 C.