8051 Software Examples

Introduction:

All examples are in assembler. Many people says assembler programming is hard. But every programming is hard. Assembler programming is machine depending. But micros are contain many peripherals. So a C-program on this depends too. On micros C-programmer must often look to the assembler listing to control the implementation and execution time. I have seen a C-programmer which is despair because the compiler want not handle right bank switching for interrupts.
Since I have started with programming my style is very much changed. Today I use a big amount of library functions and a big macro library.
Before you start you must build some rules for your programming. Rules for using resources, parameter passing, calling functions, building interrupt handlers ... More rules bring more restrictions and more reductions of error conditions. Get the right relation of both.
In assembler the rules are good but not fixed. You can break it if you need.

But be aware! If you programming in assembler and the program works not right you can't say the chief, the compiler is wrong or the library or so on. In every case it's your own fault!
Thats the risk and thats your chance. You have full control over all resources, know every bit and byte and can do all what you want.

  1. Simple command interpreter
  2. Mirror Byte
  3. Decimal binary conversion
  4. Scanning Keyboards
  5. Single Master I2C driver routines
  6. Precision Timers
  7. Clock / Calendar