8051常用源程序下载


ROUTINE

DESCRIPTION

Floating Point Routines Floating point library for the 8052.
Byte to ASCII Routine Converts 1 byte in accumulator to two ASCII characters representing the 2 HEX digits.
Decimal to binary conversion Converts a 5-digit decimal number to a 3-byte binary value. Includes example code showing how to use the routine.
Key reader w/ debounce A state-based interrupt routine that can be used to read and debounce keypresses on up to 8 keys.
Absolute Encoder Positioner How to connect and drive absolute position encoder with SSI serial interface. The encoder has been made by Siemens (6FX2001-5FS12). Archive contains: 1) schematic, 2) source in C and Assembler
Hex/Decimal Convertor w/ LCD Program has a hex to decimal conversion routine, a decimal to ASCII converter, and a 4x40 LCD driver.
Frequency Counter A frequency counter. Determines the frequency of the input on a given I/O line.
RC5 Decoder A simple RC5 decoder written in 'C'. Written to emulate a SAA3049.
16-bit ADC Data Acquisition Program for Data Acquisition using ADC with 16 channel. This can be used with any 8-16 bit ADC.
Binary to BCD Conversion Routine for 16 bit Hex to BCD conversion.Accepts a 16 bit binary number in R1,R2 and returns 4 BCD ch. in R7( MS byte) and R4(LS byte)
16-bit Binary to BCD Conversion 16-bit Hex to BCD conversion. Very well documented.
Serial I/O Routines Ring buffered, interrupt-driven UART driver, written in Keil 'C'.
Math routines A collection of math routines including 8-bit, 16-bit, 32-bit signed and unsigned addition, subtraction, multiplication, and division. Very nice code library with heavy in-line documentation! Been looking for multi-byte divide? Here it is.
DES De/encryption DES encryption/decryption used in IC smart cards. Software hasn't been validated and lacks in-line documentation.
Multiple DPTRs Allows a program to operate as if it had multiple DPTRs, even on a standard 8051 that has only a single DPTR.
BUTTONS Detects state changes and performs debounce for push buttons.
DEC_DPTR Performs the opposite of INC DPTR; it decrements DPTR by 1.
BCD_BYTE Short function which converts a single 8-bit value into two BCD digits, and another function which does the reverse.
LCD DISPLAY A number of functions which initialize a standard Hitachi HD44100/HD44780 LCD display and allows a program to write commands and/or straight text to the display.
CRC-8 CALCULATIONS A CCITT-8 CRC calculator. The source contains both the calculated (smaller but slower) version, and the table driven (faster but larger) version.
CRC-16 CALCULATIONS A CCITT-16 CRC calculator. The source contains both the calculated (smaller but slower) version, and the table driven (faster but larger) version.
AUTOBAUD DETECTION A routine that will autobaud on the serial port. It will handle 150 to 19200 baud, and 38400 can be added easily by modifying the table.
AUTOBAUD DETECTION A routine that will autobaud on the serial port. It will handle 150 to 19200 baud, and 38400 can be added easily by modifying the table.
VARIOUS UTILITY FUNCTIONS UTIL_ADCAD - Add Acc to DPTR, sets CY
UTIL_ADCBAD - Add B/A to DPTR, sets CY
UTIL_SUBBAD - Subtracts Acc from DPTR, sets CY
UTIL_SUBBBAD - Subtracts B/A from DTPR, sets CY
UTIL_INC16 - Increments 16 bit location in IRAM
UTIL_UCOMPARE16 - Compares DPTR to 16 bit IRAM value
UTIL_UCMPDPTRBA - Compares DPTR to B/A
UTIL_SHIFT4L - Shfts a 16 bit IRAM value 4 bits left
UTIL_LDDPTRC - Load DPTR from (DPTR) ROM
UTIL_LDDPTRD - Load DPTR from (DPTR) XRAM
UTIL_STDPTRD - Store R6/7 to (DPTR) XRAM
UTIL_DPTRR01 - Exchange R0/1 <-> DPTR
UTIL_DPTRR67 - Exchange R6/7 <-> DPTR
UTIL_DPTR2C - 2s complelment DPTR
UTIL_DPTRDEC - DPTR = DPTR - 1, sets CY
UTIL_DPTRASR1 - Arithmetic shift right DPTR
UTIL_DPTRSHR1 - Shift DPTR right
UTIL_DPTRROL4 - Rotate DPTR left 4
UTIL_DPTRSHL4 - Shift DPTR left
UTIL_R3R7RL4 - Shift R3/4/5/6/7 4 bits left
UTIL_DPTRX10 - DPTR = DPTR * 10
UTIL_DPTRX100 - DPTR = DPTR * 100
UTIL_DPTRX1000 - DPTR = DPTR * 1000
UTIL_CALLFUNC - Call function DPTR points to
UTIL_TOLOWER - Convert Acc to lowercase
UTIL_TOUPPER - Convert Acc to uppercase
UTIL_HEXTOBIN - Convert ACSII hex to binary
UTIL_DECTOBIN - Convert ASCII decimal to binary
UTIL_BCDTOBIN - Convert BCD to binary
UTIL_ASC36TOBIN - Convert base 36 value to binary
UTIL_BINTOASC - Convert binary to ASCII
UTIL_BINTOASC36 - Convert binary to ASCII base 36
UTIL_BINTOBCD - Convert 8 bit binary to BCD
UTIL_BINTOBCD12 - Convert 12 bit binary to BCD
UTIL_BINTODEC - Convert DPTR to signed string
UTIL_BINTOUDEC - Convert DPTR to unsigned string
UTIL_VALDCDG - Validate Acc for ASCII decimal
UTIL_VALHXDG - Validate Acc for ASCII hex
UTIL_VALALPHA - Validate Acc for A..Z, a..z, 0..9
UTIL_VALALPHAZ - Validate string for A..Z, a..z, 0..9
UTIL_CNTDG - Count ASCII decimal in string
UTIL_UDIV - Unsigned divide
UTIL_UMOD - Unsigned mod
UTIL_DIV - Signed divide
UTIL_MOD - Signed mod
UTIL_COPYXTOI - Copy XRAM to IRAM, length
UTIL_COPYITOX - Copy IRAM to XRAM, length
UTIL_COPYCTODL - Copy ROM to XRAM, length
UTIL_COPYCTODZ - Copy ROM to XRAM, string
UTIL_COPYDTODL - Copy XRAM to XRAM, length
UTIL_COPYDTODZ - Copy XRAM to XRAM, string
UTIL_PUT_ETX - Replace 0x00 with ETX in string
UTIL_FIND_ETX - Locate ETX in string
UTIL_TRIM - Remove trailing spaces
UTIL_STRLEN - Return length of string