• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How to implement an I2C into 8051 using Assembly Language?

Not open for further replies.


New Member
Re: How to implement an I2C into 8051 using Assembly Languag

elaine84 said:
I am currently on my Final Year Project named the Ultra Sonic Range Finder(SRF08). The project required me to capture the height of a human being into the 8051 MicroController and display the height out on a 16X4 LCD screen. Problem is that I was not given an I2C-bus controller and therefore was asked to implement I2C on the 8051 in order to interface with the SRF08.

As my knowledge of Assembly Language is very poor, I need help of getting a program that can implement an I2C into the MicroController. Anyone could help me with this, I will be very grateful.

Thanx alot! Please help me....
You don't need to know assembly if you know the 8051 instruction set, because the 8051 uC's like the atmel's AT89C2051 will only recognize the bytes as if they resembled part of 8051 instructions, one right after the other.

Atmel has some documentation on the 8051 instruction set (in PDF format) as well as several other websites.

As for the LCD, the first thing that should appear in your program are commands which initialize the LCD. Look for the HD47780 instruction set as well. Many character-based LCD's use the HD47780 chip for its operations. If you want to acquaint yourself with programming the LCD, then you should go for a circuit that shows an LCD connected directly to the parallel port. I think Beyondlogic.org has one, along with some code.

Once the LCD is initialized, you then take the output of the ultrasonic range finder and convert it into digital format if it is an analog output. Now you need to somehow convert it into numerical digits that will go on the LCD.

So another thing you need to find is the ASCII table.

Because we cannot think of and do the entire project for users, I can't help you much further until I see that you tried something out.


New Member
I am able to initialise the communication between microcontroller with the LCD Display. The problem is from the I2C receving part... I couldn't find out how to read data from the Ultrasonic Range Finder after I write in the slave address, command register and return ranging in cm. Is it after i send in the slave address for read, it will automatically return me ranging from the first echo high & low byte and so on?
Not open for further replies.

Latest threads

EE World Online Articles