Email: Password: Remember Me | Create Account (Free)
8052 Code Library
Submit code to code library
1 24-bit HEX to 6 decade Decimal conversIt convertes 24-bit binary to decimal(BCD) in short time
1 4 decade 7 Segment display interface4 decade 7 Segment display interface,This code is not tested
1 ADC0808 InterfaingADC0808 Interfaing with 89C51
12 LED Type running light12 LED Type running light with AT89C52 MCU
128x64 Graphic LCD using KS0108BThis code can be used to check out basic functions of a 128x64 graphic LCD KS0108B from Samsung.
12BIT ADC MCP3202 ,3204,3208 DRIVER12BIT SERIAL ADC MCP3202 ,3204,3208 DRIVER for AT89c52
16 bit to 5 decade digits conversionWith performance analysis. New, double faster
16 BYTES CYCLIC BUFFER FOR SERIAL PORTThis code implements a 16 bytes cyclic buffer for 8051 serial port(20H to 30H). Memory pointers are stored in registers R0 and R1.Buffer size can be varied according to your requirement and size of RAM
16*2 LCD display based Pulse CounterLCD(16 x 2) display based pulse counter. It counts pulses as 00:00.Two keys (1).Start/Stop (2).Reset.
16-bit Square Root in asmFind out the square root of the 16-bit number
32x32bit mult. , 64bit resultWith permission, Author: James Rogers mul32bit subroutine written by James Rogers - -
4bit code for 16x2 and 16x4 (HD44780 comThis is another code from me, but now its 4-bit code and the pin discription is written in file ... so have fun and share knowledge.
4function Calculatorfour function calculator with four 7seg and 4x4 keyboard.It can handle numerical(2digit numbers) operations using + - * /
4x4 matrix key scanThis code was actually designed to be made as a seperate module using at89c2051 so that it keeps scanning the keypad and alert the main controller when a key is pressed.
6 Channel Audio.asmAbino Labz 6 Channel Audio with 16x2 LCD,PT2322,PT2323,RC05 remote,EEPROM Memory for nonvolatile storage and Encoder for controlling
8-, 16- & 32-bit integer maths routinesA selection of 8-, 16- and 32-bit integer maths routines. Included are 8- and 16-bit addition with limiters, useful in digital signal processing or control applications.
8-bit LCD8 bit LCD routines with check busy flag before sending data, command to LCD
8-bit Palindrome detection programThis is a program to find out whether given byte is palindrome or not. For this the program uses the bit reversing approach.
8-Bit, 16x2 LCD Code for HD44780This code is for LCD in 8-bit mode and i have connected my AT89C2051 (with some pull-ups), Pin Description ...P1 DB,P3.7 E,P3.5 RS,P3.4 RW.
8-channel annuaciatorAnnuanciator scan input channels ,if any channel activeded it will give audio visual indication at output port,if we press ACCEPT switch activeted channel freezs,controller continua to scan channels....nice code.
8255 Interfacing 80518255 interfacing with 8051, includes schematic and C code. any quaries visit
89c2051 based caller idDisplay the Phone number
A digital code Lock programA digital Code Lock which takes a 4 digit password from the user using 4*4 keypad and compares it with already stored password to open the door. or glow an LED
ADC & LCD interfaceADC 0809 & LCD interface with 89C51.
ADC 16-bit AcquisitionProgram for Data Acquisition using ADC with 16 channel. This can be used with any 8-16 bit ADC.
Adding 3 bitAdding 3 bit value (1A0734 + 051B25) in EDSIM51
Animation in LCDthis code will help you to understand how to produce animation inthe alpha numeric lcd diaplay, here is the aniomation to sink the char . can be easily modified for other effects
ArcFour (RC4)Samuel LjungkvistARC4 is a secure and very fast 8-bit stream cipher/psuedo-random number generator, with a 2^1700 interval
ASM code to test DS12887 RTCTest a DS1287, DS12887, DS12B87, DS12C87, or equivalent RTC, and display time to PC terminal @ 9600 baud.
AT89C2051 Microcontroller Alarm Clock ScAT89C2051 Microcontroller Alarm Clock Schematic and Display with LCD
Autobaud DetectionA 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.
avr proggrameravr proggrammer
Basic 52 PlusGary MuhonenBasic "Plus" for the 8052. Extended version of the original Basic-52 that was placed into the public domain by Intel.
BCD 16-bit ConversionRoutine for 16-bit hex to BCD conversion. Accepts a 16-bit binary number in R1,R2 and returns 5 digit BCD in R7,R6,R5,R4,R3(upto 64K)
BCD 16-bit Conversion16-bit hex to BCD conversion. Very well documented.
BCD 24-bit ConversionRoutines for convert 24-bit binary to 4-byte BCD (three algorithms - Gorner and LUTs)
BCD 8-bit conversionShort function which converts a single 8-bit value into two BCD digits and another function which does the reverse.
BINARY FSK DEMODULATIONbaud rate 1200 space signal 1200 mark signal 2400
BINARY FSK MODULATIONbaud rate 1200 space signale 1200 mark signal 2400
Buttons with debounceDave FletcherDetects state changes and performs debounce for push buttons.
Byte to ASCIIConverts 1 byte in accumulator to two ASCII characters representing the 2 hex digits.
Byte to ASCII conversionThis routine transforms byte in A to two ASCII symbols in B,A.
calculatorcalculator with 4 7-seg & simple timer with 4*4 keyboard
Convert 0-5V A/D in B:A to BCDConvert 0-5 volt 12 bit A/D value in B:A to volts \"0.000\" to \"5.000\" in BCD
counting the rotory encoder with direccounting the rotory encoder with direction by finding out the the state of A pulse in the falling time of the B pulse if A is high Say forward if A is low reverse (depends on the system
CRC 16-bitJohn WrenA CCITT-16 CRC calculator. The source contains both the calculated (smaller but slower) version, and the table driven (faster but larger) version.
CRC 8-bitJohn WrenA CCITT-8 CRC calculator. The source contains both the calculated (smaller but slower) version, and the table driven (faster but larger) version.
CRC-16Simple cod for CRC_16 calculation
CRC16 fastCCITT CRC16 table and algo - fast and dirty
Day-Of-Week calculationDay-Of-Week calculation routine, together with a test
Decimal to binaryConverts a 5-digit decimal number to a 3-byte binary value. Includes example code showing how to use the routine.
Decrement DPTRDecrements the value of DPTR as if it were a DEC DPTR instruction.
Decrement DPTR3 Versions of a DEC DPTR code
DES De/encryptionKiwi ChenDES encryption/decryption used in IC smart cards. Software hasn't been validated and lacks in-line documentation.
Digital Clock DiagramDigital Clock Diagram, for further comunication please dial +91 9830213946 or mail us
Digital IC Tester for 74 seriesThe chip tester verifies the functionality and timing of a variety of 7400 series integrated circuits.
Driver HT9200A DTMF Encoder and AT89S52Driver HT9200A DTMF Encoder and AT89S52 FOR ANY DTMF ENCODE DECODER S.D. DWIVEDI 09415171555 INDIRA NAGAR BANDA U.P.
DT-4000ZC serial data decoderConvert Digitek multimeter raw 7-segment display data to text
Extended opcodesVery usefull macros that acts like extended opcodes like: Jump if equal, jump if greater, jump if greater or equal...
Filter by convolutionLow-pass signal filtering by convolution
Floating Point '51Floating point library for the 8052.
Frequency counterA frequency counter. Determines the frequency of the input on a given I/O line.
FULL DUPLEX SERIAL COMMUNICATIONThis program outputs different messages from 8051 serial port on pressing the push buttons attached to P1. Also this displays the numeric data from the PC\\\'s keyboard on a 7-segment attached to P0
GSM subroutines for 8051The code contains SRTs for serial communication [transmit and receive], LCD display, GSM communication for the 8051. A sample application to track vehicles using GSM network is included. Also available at
Hex/Dec Convertor w/ LCDrogram has a hex to decimal conversion routine, a decimal to ASCII converter, and a 4x40 LCD driver.
hex2bin 2 digits hex(8bit) to binaryRoutine convertion from two digit hex to binary (MSB on B, LSB on Acc), the compementary of bin2hex (not included)
HM 55 Digital compass interfacingHM 55 Digital compass interfacing
HMI InterfaceThis is a document to explain the HMI Interface between a DSP and 8051 IC
I2C24C32/64 interface with 8051 using KEIL C51
I2C EEPROM 24Cxx support for SBC monitor24C08 read/write/dump menu for SBCMon using its I2C subroutines
I2C library for keil IDE, written in C.I2C library for keil IDE, written in C. with features of Bus fault, bus busy and slave not responding features. for more info visit
I2C library for single-master multi-slavProvide APIs for I2C communication or generally known as TWI (two wire interface), this library is a light weight (99bytes approx.) and you can costly hardware with this simple code. Problems? visit
I2C routineI2C routine with dynamical addressing for 24Cxx chips
I2C Routines for 8051Routines for simple access to the I2C-Bus
I2C with LCD displayI2C with LCD() display using ADuC812 board and EA T123A-I2C display
IIC routinesThis code is for 24cxxx serial eeproms.But it can easily extend to other i2c devices
Illusion of Moving message display usingMC 89c51RD2 is interfaced with a 16*2 LCD to display message.TOPVIEW simulator is used to view the output
Intel .hex to binary and IAPDo an IAP for T89c51rd2 and AT89c51rd2/ed2 of a line in format intel .hex to flash
Interactive Voice Response SystemAllows the user to know the student’s attendance and marks quickly through the telephone line . Visit for more details
Interface Nokia3310 LCD with AT89C51Interfacing Nokia3310 LCD with AT89C51 using SPI.
Interfacing seven segment with 8051Circuit diagram at
Interrupt-based key read w/ debounceA state-based interrupt routine that can be used to read and debounce keypresses on up to 8 keys.
Kermitsend/receive files using the Kermit file transfer protocol
Keyboard RoutinesAT-style keyboard scancode to ascii conversion and detection of all kinds of keys. It sends commands to the keyboard too, so you can toggle the leds, reset, etc.
LCD (44780) RoutinesJohn WrenA 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.
LCD 4bit modethe code was written for an At89c51 clocked with a 11.0592Mhz crystal, if you are using a greater clock speed insert 8 to 10 nop\\\\\\\'s between RS and ENABLE operations
lcd and keypad assembely routinesa program for scanning keypad and all lcd routines.
LCD interface in 8bit mode16x2 lcd interface, the initialisation can be altered to suite specific requirements, just follow the comments and the data sheets
LCD routines with printfRoutines to drive an LCD in 4 bit mode, with an very useful, printf like, printing routine that writes numbers on the stack on the display
LMX2326 Frequency SynthesizerThe Code Programs National Semiconductor LMX2326 Frequency Synthesizer and has been written in AT89C2051 assembly and frequent comments have been added which makes it easy to understand
Math RoutinesW G MarshallA 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.
Misc. FunctionsJohn WrenLots of useful functions (Add/subtract DPTR, BCD/Ascii conversion, etc.)
Modbus Slave code -8052Modbus slave device using AT89C52
MultiplicacionMultiplicacion sin signo de 24 x 24 bits(R0,R1,R2) *(R3,R4,R5), 48 bits de resultado(R0,R1,R2,R3,R4,R5)
P.E. Time countP.E. Time count
Port extender using 8574This is the simple and very useful method for increasing the port lines.try this one.the code is given in 8051 assembley language
Program for square root of 8-bit numberThis is the program to find out the square root of the 8-bit number by traditional shift & subtract algorithm.The number is logically extended to 16-bit number & is stored in r0 & r1.The final answer is stored in r2.The 8-bit number will have 4-bit answe
ps2 keyboard interfaceThe essense of this code is to simply receive the serial stream of data from a PS2-type keyboard. No processing of the data is done besides assembling the bytes and stuffing into a ring buffer.
pwm signal generator as much you want easy ways to generate pwm signal at your all mcs51 PORT (4 x 8 bit pwm signal)
RC-5 Remote decoding for 8051 MCURC-5 Remote decoding for 8051 MCU running at 11.0592MHz along with an addon sample program for usage. If you have any doubts please contact
Read PWM from CMPS03 Compass SensorThis program will read an angle from CMPS03 Compass Sensor. The angle will be stored in 16-bits hexadecimal and 3-characters ASCII format.
Remote System Control VIA GSM SIM300 ModRemote System Control VIA GSM SIM300 Module and View result with VB software By S.D. Dwivedi Mob:09415171555
RS232 InterfacingRS232 Interfasing sample proram Using interrupt and polling
rs232 to rs485 schematiccircuit for rs232 to rs485
RTC access codeAccess RTC chip DS1302 with MCS51
SBCMON Clock Example SBC Clock Assembly Source
SBCMON Clock Example SBC Clock Assembly Hex
SBCMON Keypad SBC Keypad Example
SBCMON Keypad SBC Keypad Example Hex File
SBCMON LCD Echo SBC LCD Echo Example Source
SBCMON LCD Echo SBC LCD Echo Example Hex
SBCMON PS/2 Example SBC PS/2 Example Assembly
SBCMON PS/2 Example SBC PS/2 Example Hex
SBCMON PS/2 Keyboard Example SBC PS/2 Keyboard Example Assembly
SBCMON PS/2 Keyboard Example SBC PS/2 Keyboard Example Hex
SBCMON PS/2 Mouse Example SBC PS/2 Mouse Example Assembly
SBCMON PS/2 Mouse Example SBC PS/2 Mouse Example Hex
SBCMON Software Clock Example SBC Software Clock Assembly Source
SBCMON Software Clock Example SBC Software Clock Example Hex File
SBCMON v13 SBC Monitor Program Source Code
SBCMON v13 SBC Monitor Program Hex File
scanning code for rolling led matrix disthis is the prog use for rolling led matrix board of 48 coloums and 8 rows , you can edit the msg as you like give in prog . hope you will ejoy for any prob mail me
Scans a 4x4 keypad and returns pressed KThis code scans a 4x4 Passive Matrix keypad and returns the corresponding User Input character with debounce mechanism
Serial comms with SCC2692 DUARTsimple code to add to SBCMon for testing serial I/O with SCC2692 DUART (no flow control)
Serial CommunicationSerial Communication with RS232.
Servo ControllerCode for controlling up to eight servos from an 8051 (11.0592 Mhz)
Simple Home /office Automation System asSimple Home /office Automation System asm code anyone can contect for circuit for project mail mob-09415171555
Simulate multiple DPTRsAllows a program to operate as if it had multiple DPTRs, even on a standard 8051 that has only a single DPTR.
SkipJack encrypt/decryptSkipjack block cipher and its inverse implementation, smaller vs. faster versions
Subroutines for 20x4 LCDThis code contains all the subroutines required for initializing, Displaying, Clearing Display, Positioning cursor at required place & Displayinga store Menu for Code Memory with proper formatting
T6963-based GLCD demoT6963-based GLCD demo, Metalink assembler
TEA decryptionImplementation of inverse of the original TEA cipher by Wheeler and Needham in asm51.
TEA encryptionOriginal TEA cipher by Needham&Wheeler in asm51 - a really tiny encryption routine
this program scans the 4*4 keypad to detThe speciality of the program is that it takes into the account the debouncing problem of the keypad button so that the program can work accurately.
to find the no of times the number is inIn a given Array it will find out that how many times the number is appered in the array and it will also check its parity (either even parity or odd parity)
transfer-receiver routine255 byte wide transfer-receiver module for UART
wireless using TLP and RLP ModulesWireless using TLP and RLP Modules and 89C2051
XTEA decryptionInverse of modified TEA cipher by Needham&Wheeler in asm51
XTEA encryptionModified TEA cipher (also TEAN) by Needham&Wheeler in asm51
CODE - 'C'
small c program for led blinking c- program for led blinking .
The ICL7135 ADC with 8X51Driving the 20000 counts ICL7135 ADC
7 segment ASCII fontsDefinition of (subset of) ASCII fonts for 7 segment display, for strings like HELLO!, Error, donE, StArt, PLAY, YES, no, CAnCEL.
8051 OLIMEX LCD driver in CLCD program implementing 4-bit and 8-bit operation modes. Compiler is SDCC and controller is P89C668HBA
8051/52 MIDI ExamplesTwo source codes for testing midi communication
8052, 8051 RTOSA simple RTOS for 8051 with scheduler, semaphore and mutex. Optimized for the 8051 microcontroller and keil C51 compiler. Fine tuned for minimizing xdata access. Available also on
805X routines (pwm, timer0, keypad, etc)It has code to use the serial port, timer 0, alpha numeric LCD, 16 key matrix keypad (including schematics), a simple command interpreter shell, SHA1 hash, stepper motor control and software pwm generator. Easy to use API, has examples.
93C46B interface with any 8051This small piece of code is all you need for interfacing to a 93C46B EEPROM Chip. Full description of the code is given inside the file. Note: It is compiled using keil. however the code is general you will need only to change sbit, CY and #include
Absolute Encoder PositionerHow 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
AT24C512(I2C EEPROM) interfacing with P8EEPROM Byte_write, Page_write, byte_read, current_read and page_read operations are implemented. The i2c functions are demonstrated using BIT BANGING.
Blink LED function from assembly _1Example of using assembly language from 'C'. Main routine to blink and LED at four different rates. To be used with Blink_func.a51 and Delay_func.a51 uses indirect memory to pass values to assembly language routine
Blink LED function from assembly _2An assembly language function to blink an LED; to be used with Main.c
Blink LED function from assembly _3An aasembly language function to delay for 5 seconds to be used with Main.c
C code and Proteus Design for LCD Driverthis folder contains Keil project c code and proteus simulation project
C code for controling DS1307 RTCC code for controling DS1307 RTC written using SDCC complier
C code for RTC Ds1307 with AT89C51C code for RTC Ds1307 with AT89C51 result HPT Rs232
connect lcd in 4 bit modeconnect lcd ( 8*1 untill 20*4 ) with 7 bit to your mcu
Digit Temperature meterOne wire read and write digit temperature meter. Range from -55~+125C +/-0.5C
displays the temperature (taken CTN) ondisplays the temperature (taken CTN) on a display 2 lines. special characters are generated (é, à, è, etc. .. French language). the pattern is in zip.for Aduc8xx
Dot Matrix Display scrolling with AT89C5Dot Matrix Display scrolling with AT89C52 using Keil C Compiler
DS1302cntact me if any doubt via
DS1307 RTC C codeDS1307 RTC C code
General purpose routines for I2C busGeneral purpose routines for I2C bus written using SDCC compiler
Graphic LCD ( T6963 controller - T6963CGraphic LCD ( 240X128 ) with AVR ( ATMEGA32 ) 240*128
Graphic LCD with 8051128 * 64 Graphic LCD win AT89C52 and higher
Graphic LCD with AVR128 * 64 Graphic LCD win ATMEGA32 and other
Key Pad with D-MUX for 8052 controllerkey pad for microcontroller with minimum pins(open in rar file)
LCD 44780 clock with DS12887Complete code in C for a LCD clock using the HD44780 display and DS12887 real time clock chip in non-mux mode with Intel Timing. Hardware : Silabs 80c51F020 development kit.
LCD 44780 clock with PCF8583.The code is for a full fledged clock using the P89C51RD2 driving the I2C bus in a bit banged mode. The LCD and I2C routines are made modular. Download the zip file and extract to a folder. Developed on Keil UV3 IDE
LCD files for 2 linesContains Initializing files, Moves cursor to right or left, select a segment on the LCD
LCD GraphicalLCD Graphical with 8052 or higher
Macros for Video Terminal controlMacros to control color, cursor position and other attributes of a video terminal emulator like hyperterminal ( VT100 / ANSI)
miladi to shamsi ( Just For Iranian )miladi date to shamsi and shamsi to miladi ( C code ) for use in microcontroller's
PCF8563[I2C - RTC] and 25AA020A[SPI- EEPThe samples are written for P89v664 controller and on SDCC. I2C subroutines are implemented by bit banging and SPI communication is established with SPI controller. Read the README.TXT before starting.
Polled Hardware I2C routinesRoutines for master mode i2c for reading and writing to i2c eeproms and ADC.
RC5 DecoderA simple RC5 decoder written in 'C'. Written to emulate a SAA3049.
Real Time Clock DS1302 interfacing withThis circuit displays time, day, date, month and year on LCD display. You can set time and date with only 2 buttons. The code has calander function as well, so that you have to only adjust date, month & year. It will calculate day itself & will display it
RTC with ADUC8xx ( 832)display Time -->rs232 , to set TIme --> push int0
serial eeprom AT24CXX with 8051/52this C file contains all the functions required to communicate between 8051/52 and AT24CXX, the comments makes the usage of the function very clear. The program was tested successfuly for AT89S52 and AT24C08
Serial I/O RoutinesRing buffered, interrupt-driven UART driver, written in Keil 'C'.
Small Flash File System for DataflashThe file system implements a floating fat to prevent excessive wear of any aria. Each fat or file page is indexed and has a reference to its previous and next page if such a page exits. The fat contains the file name, first page address, first byte offset
SMBUS libraryLibrary which implements most of the SMBUS states for the Cygnal F300 and F330 CPU
8 bits cmos8 bits cmos micro controller
IdeaIdea-6 LEDs off only 3 Pins
PDF for simple fm receiverPDF for simple fm receiver
74ls373 lath testing diagram74ls373 lath testing diagram
89S51/52 ISP programmer using avr91089S51/52 ISP programmer using ATMEL's avr910 avrprog.exe and serial port
Freeram libraryVHDL library for ram,dualport ram,syncronous and asyncronous FIFO functions
hardware implementation of rc4 PSBR genhardware implementation of rc4 PSBR gen
ISP Programmer for 89S51/52 EZDL4ISP Programmer for 89S51/52 for use with EZDL4.exe windows application using Serial or USB port.
MCS-51 in debug moderun every instruction in every external interrupt clock
Modbus slave-8052Explanation & Theory for Modbus.asm file
Mods for T51 8051 compatable controllerNew multiply divide + dual port ram
Point Finder RobotsPoint Finder Robots
Quad DecoderHardware quadrature decoder with digital filtered inputs suitable for implementation in a small CPLD.
simple 64x64 8 colour vga controllerAltera FPGA based VGA controller.
Switch debouncerHardware switch debouncer with tristateable outputs
89S5X ISP PROGRAMMERAT89S51/2/3/8252 ISP Programmer with LPT
bmp2asmBitmap convert to Assembly for used Graphics LCD
Convert text sms------>PDU SMSConvert text sms------>PDU SMS
EaseMicro51Complete package for AT89S51/52 of Another Text Editor ver 1.7, MetaLink Cross-Assembler 1.2h, and AEC ISP Programmer in one floppy disk only. No need to install, just unzip and run EASE51.BAT.
perl code and test bench for fractionalperl code and testbench to generate fractional clock dividers
Timer & Baud Rate calculator for 8051Calculate values to load in THx & TLx for a specific Baud Rate/Delay for a particular crystal frequency.
8051 ISP ProgrammerSimple ISP programmer that only needs a simple cable connecting the PCs LPT port to the board. It can program Intel HEX files. Tested only with AT89S51 and AT89S52. With source code, but program messages in Brazilian Portuguese, easy to understand/transla
89C450 ISP using PythonPython code to download a intel format file to a 89C450 via a serial link and very few hardware (check manual of 89C450). Tested on Linux and XP. Use as "python filename".
Linux terminal for NMIY-0031 series 8051The NMI 8051 development boards use a monitor program that expects the user terminal to wait for it to echo a character before it sends the next one. Most terminals don't do this so I wrote this tcl/tk terminal script which does.
Simple interface to Kanda SBCTcl/Tk app to program Philips 8052 chips using ISP
tcl/tk ISP application for 89V51RX2This ISP programmer connects via serial port to the 89V51 chip that i have on my ibot board ( robotics control board ) supports 8051 phillips chips like P89V51RD2FN.

If you have code, hardware, or 8052-related applications that you believe would be of interest to other 8052 developers and you'd like to share it please submit it here. You will receive full credit for the code you submit and will be able to update or delete it at any time.