Posts

How to generate one second and one minute delay using timer in 8051?

Image
In 8051 using 11.0592MHZ crystal, we can able to generate a maximum delay of 65536x1.08us=0.07 sec only. By using 8051, we cannot able to obtain the delay which is greater than 0.07 sec. So, to obtain the delay greater than 0.07 sec we need to call millisecond or microsecond delay for a certain amount of time. Supposed I want to generate a delay of one second.To obtain this delay, it is necessary to convert one second into a millisecond or microsecond. We know that, 1 second = 1000 msec We can rewrite the 1000 milliseconds as follows: 50msec*20 = 1000msec Now, according to the calculation mentioned above first, we need to generate a delay of 50 msec and then we need to call this delay 20 times. By doing this we can able to obtain a  delay of 1 sec.By calling one second delay  60 times I have generated one minute delay. ----------------------------------------------------------------------------------- I have written a program to blink the LED for one minute.In between ON/OFF in

To display custom characters on the lcd using 8051 micro-controller.

Image
SOFTWARE:   KEIL MICRO VISION 4 SIMULATOR:   PROTEUS 8.0 CIRCUIT DIAGRAM: WORKING: This project is about displaying custom characters on the lcd.Simple meaning of custom character is the character which is not available on the keyboard or which is made by modifying original characters. In the lcd display,to display characters which are already available in the form of ascii value (from 'a' to 'z' or any other characters) we do not need to do anything.By sending the ascii value or sending the character directly to the lcd we can able to display those characters(which are already available) on the lcd. In the lcd display,there is one controller which control all the operations of the lcd.Lcd controller has a memory called  CG-RAM(character generator random access memory)  which is used to create and store the custom character. Size of the CG-RAM is 64 bytes. At a time we can able to display 8 custom characters(for 5*8 matrix) and 4 custom characters(for 5*10 matrix) on th

Digital Thermometer using 8051 and ADC 0808 Interfacing With 8051

Image
SOFTWARE: KEIL MICRO VISION 4 SIMULATOR: PROTEUS 8.0 CIRCUIT DIAGRAM: WORKING: Here,Temperature is taken from LM35 temperature sensor.LM35 converts surrounding temperature into analog voltage(equivalent to temperature).This analog voltage is provided to ADC0808 for digital conversion. After digital conversion,final temperature get displayed on LCD display. LCD(16X2) DISPLAY: RS,RW,EN pins are connected to P2.5 to P2.7 of 8051 respectively. Data pins (D0 to D7) are connected to P3.0 to P3.7 of 8051 respectively. LM35 SENSOR: VCC pin is connected to 5 v supply. VOUT pin is connected to IN0 channel of ADC 0808. On the VOUT pin we get equivalent voltage with respect to the surrounding  temperature. Temperature change is 10 mv/°c. GND pin is connected to GND. ADC 0808: VCC pin is connected to 5 v supply. VREF(+) pin is connected to 2.56V supply. VREF(-) pin is connected to GND. OUT8(LSB) to OUT1(MSB) pins are connected to P1.0(LSB) to P1.7(MSB) respectively.i.e. OUT8 pin is connected to P1.

Triangular Wave Generation Using 8051

Image
SOFTWARE:   KEIL MICRO VISION 4 SIMULATOR:   KEIL MICRO VISION 4 PROGRAM: #include<reg51.h> void delay(int q); // delay function void main() { while(1) { int i=0; for(i=0;i<=255;i++) // increamenting slope { P1=i;                  // value sending to port 1 delay(5); // delay } for(i=255;i>=0;i--) // decrementing slope { P1=i;             // value sending to port 1 delay(5); // delay }  } } void delay(int q) // delay function { int r; while(q>0) { for(r=0;r<q*1275;r++); q--; } } PROGRAM DESCRIPTION: In this project,I have generated the triangular wave on Port 1 of 8051.  For creating incrementing slope of triangular wave,I have send the values from 0 to 255 to Port 1.I have send one value at a time.After sending each value,I have provided some delay to Port 1.Thus I have created incrementing slope of triangular wave. For creating decrementing slope of triangular wave,I have used the same method.Only the difference is the values from 255 to 0

Timer Interfacing With 8051 and Square Wave Generation With 8051

Image
TIMER INTERFACING WITH 8051: Steps to interface the timer in mode 1: 1.Configure the TMOD register. 2.Load the count value in timer register(TH/TL). 3.Start the timer by setting TR bit of respective timer in TCON register. 4.Wait for the overflow flag to set. 5.Stop the timer. 6.Clear the overflow flag. 7.Repeat the process from step 2. Steps to interface the timer in mode 2: Mode 2 is 8 bit auto reload mode.Hence in this mode there is no need to load the value again in timer register(TH). 1.Configure the TMOD register. 2.Load the count value in timer register(TH). 3.Start the timer by setting TR bit of respective timer in TCON register 4.Wait for the overflow flag to set 5.Stop the timer 6.Clear the overflow flag 7.Repeat the process from step 3. How to calculate the value to be loaded in timer register(TH/TL)? 1. We need to calculate the count value. Count=Required time/Processor time Processor time: In micro-controller 8051,crystal frequency is internally divided by 12.Crystal oscil