Program For Digital Clock Using 8051
- Assembly Language Code For Digital Clock Using 8051
- Digital Clock Download
- Program For Digital Clock Using 8051 Numbers
Sometimes people find it difficult to read temperature from analog thermometer because of fluctuations. So here we are going to build a simple Digital thermometer using 8051 microcontroller in which LM35 sensor is used for measuring the temperature.
This project will also serve as a proper interfacing of ADC0804 with 8051 and 16*2 LCD with 8051 microcontroller.
Components Required:
- 8051 based Real time clock is a digital clock to display real time using a RTC DS1307, which works on I2C protocol. Real time clock means it runs even after power failure. When power is reconnected, it displays the real time irrespective to the time and duration it was in off state.
- Real Time Clock interfacing with 8051 Sample code for Real Time Clock interfacing with 8051. Following code can be using for 8051 and 8052 ICs like: 89c51, 89c52, 89s51, 89s52, 89c2051.
- In this mini-project, we are going to make a simple Digital Stopwatch by using a Microcontroller from 8051 families. Digital Stopwatch allows you to record the exact number of hours and minutes you worked on a task/activity.
As mentioned already, the primary objective of the first laboratory is to design a digital clock on a 4 LED display using 8-bit 8051 microcontroller. The target system is expected to perform sixty seconds counts, i.e., for example counting from 00:00 to 00:59 in one second interval and repeating the counts one second after it reaches 00:59. This is a simple digital voltmeter circuit diagram using 8051 microcontroller. We can also call it as analog to digital converter. (to demonstrate the program) DC Adapter or Battery; Digital Voltmeter Circuit Design using 8051 Microcontroller. The conversion time of this IC depends on clock source. ADC Features. 0 to 5V analog input. 8051 Microcontroller is a programmable device which is used for controlling purpose. Basically 8051 controller is Mask programmable means it will programmed at the time of manufacturing and will not programmed again, there is a derivative of 8051 microcontroller, 89c51 micro controller which is re-programmable.
- 8051 development board
- ADC0804 board
- 16*2 LCD display
- LM35 sensor
- Potentiometer
- Jumper wires
Circuit Diagram:
Measuring Temperature with LM35 using 8051:
8051 microcontroller is a 8 bit microcontroller which has 128 bytes of on chip RAM , 4K bytes of on chip ROM, two timers, one serial port and four 8bit ports. 8052 microcontroller is an extension of microcontroller. The table below shows the comparison of 8051 family members.
Feature | 8051 | 8052 |
ROM (in bytes) | 4K | 8K |
RAM (bytes) | 128 | 256 |
Timers | 2 | 3 |
I/O pins E.g 162) • Enjoy Replacing models: • Open CustomSteve/CS.txt,replace “Miku” with “yaya” or “Flandre” Customization: • Currently our mod support model files of pmd format,and action files of vmd format. Requirement: • OS at least Windows 7 (not yet support the linux or mac os.) • 64bits JRE(32bits only works with Miku model) How to install: • Download and install • Download and install • Download the mod • Find the location of.minecraft folder • Put CustomSteve***-Beta.jar into.minecraft/mods • Extract CustomSteve***-Resources.zip to the root directory of Minecraft(which is at the same level as.minecraft) • (*** is the version of the mod. How to install mod 3d custom girl mods catalog. • If texture files of tga format are detected in original files, they will be converted into png format. • Only texture files of png or bmp format are supported. | 32 | 32 |
Serial port | 1 | 1 |
Interrupt sources | 6 | 8 |
16x2 LCD:
16*2 LCD is a widely used display for embedded applications. Here is the brief explanation about pins and working of 16*2 LCD display. There are two very important registers inside the LCD. They are data register and command register. Command register is used to send commands such as clear display, cursor at home etc., data register is used to send data which is to be displayed on 16*2 LCD. Below table shows the pin description of 16*2 lcd.
Pin | Symbol | I/O | Description |
1 | Vss | - | Ground |
2 | Vdd | - | +5V power supply |
3 | Vee | - | Power supply to control contrast |
4 | RS | I | RS=0 for command register , RS=1 for data register |
5 | RW | I | R/W=0 for write , R/W=1 for read |
6 | E | I/O | Enable |
7 | D0 | I/O | 8-bit data bus(LSB) |
8 | D1 | I/O | 8-bit data bus |
9 | D2 | I/O | 8-bit data bus |
10 | D3 | I/O | 8-bit data bus |
11 | D4 | I/O | 8-bit data bus |
12 | D5 | I/O | 8-bit data bus |
13 | D6 | I/O | 8-bit data bus |
14 | D7 | I/O | 8-bit data bus(MSB) |
15 | A | - | +5V for backlight |
16 | K | - | Ground |
The below table shows frequently used LCD command codes.
Code(hex) | Description |
01 | Clear display screen |
06 | Increment cursor (right shift) |
0A | Display off , cursor on |
0C | Display on , cursor off |
0F | Display on , cursor blinking |
80 | Force the cursor to beginning of 1st line |
C0 | Force the cursor to beginning of 2nd line |
38 | 2 lines and 5*7 matrix |
ADC0804 IC:
The ADC0804 IC is an 8-bit parallel ADC in the family of the ADC0800 series from National Semiconductor. It works with +5 volts and has a resolution of 8bits. The step size and Vin range varies for different values of Vref/2. The table below shows the relation between Vref/2 and Vin range.
In our case Vref/2 is connected to 1.28 volts, so step size is 10mV. For ADC0804 step size is calculated as (2 * Vref / 2) / 256.
Following formula is used to calculate output voltage:
Where Dout is digital data output in decimal, Vin = analog input voltage and step size (resolution) is the smallest change. Learn more about ADC0804 here, also check interfacing of ADC0808 with 8051.
LM35 Temperature Sensor:
The LM35 is a temperature sensor whose output voltage is linearly proportional to Celsius temperature. The LM35 comes already calibrated hence requires no external calibration. It outputs 10mV for each degree of Celsius temperature.
LM35 sensor produces voltage corresponding to temperature. This voltage is converted to digital (0 to 256) by ADC0804 and it is fed to 8051 microcontroller. 8051 microcontroller converts this digital value into temperature in degree Celsius. Then this temperature is converted into ascii form which is suitable for displaying. This ascii values are fed to 16*2 lcd which displays the temperature on its screen. This process is repeated after specified interval.
Code explanation:
The complete C program for this 8051 Thermometer Project is given at the end of this project. The code is split into small meaningful chunks and explained below.
For 16*2 LCD interfacing with 8051 microcontroller , we have to define pins on which 16*2 lcd is connected to 8051 microcontroller. RS pin of 16*2 lcd is connected to P2.7 , RW pin of 16*2 lcd is connected to P2.6 and E pin of 16*2 lcd is connected to P2.5. Data pins are connected to port 0 of 8051 microcontroller.
Similarly, for ADC0804 interfacing with 8051 microcontroller, we have to define pins on which ADC0804 is connected to 8051 microcontroller. RD pin of ADC0804 is connected to P3.0, WR pin of ADC0804 is connected to P3.1 and INTR pin of ADC0804 is connected to P3.2. Data pins are connected to port 1 of 8051 microcontroller.
Next we have to define some functions which are used in the program. Delay function is used to create specified time delay, cmdwrt function is used to send commands to 16*2 lcd display, datawrt function is used to send data to 16*2 lcd display and convert_display function is used to convert the ADC data into temperature and to display it on 16*2 lcd display.
In below part of the code, we are sending commands to 16*2 lcd. Commands such as clear display, increment cursor, force the cursor to beginning of 1st line are sent to 16*2 lcd display one by one after some specified time delay.
In this part of the code, we are sending data to 16*2 lcd. Data to be displayed on 16*2 lcd display are sent to display one by one after some specified time delay.
In below part of the code , we are sending commands to 16*2 lcd display. The command is copied to port 0 of 8051 microcontroller. RS is made low for command write. RW is made low for write operation. High to low pulse is applied on enable(E) pin to start command write operation.
In this part of the code, we are sending data to 16*2 lcd display. The data is copied to port 0 of 8051 microcontroller. RS is made high for command write . RW is made low for write operation. High to low pulse is applied on enable(E) pin to start data write operation.
In this part of the code, we are converting digital data into temperature and displaying it on 16*2 lcd display.
Also, check other thermometers using LM35 with different microcontrollers:
