Here are some of my C routines for 8051. The basic idea is to make code more portable. For example I test my code under M$ Visual studio and, when code is OK, just recompile it using K*eil. (Of course under VC++ low level routines are different but interface is the same.)
Hope this is helpful. Do not forget to set OSC_FREQ in timer.h
Tom
PS. DO NOT forget to download update (the message below this one)