About Me (TS Pradeep Kumar)

Working at VIT University and having great interest towards embedded wireless systems and e-learning. This site caters to most of the Indian Engineering/technology students to know about embedded systems, network simulator, e learning tools/techniques, etc. If you are a student or a learner, you can always request a title or post..

Subscribe by Email

Enter your email address:

Delivered by FeedBurner

Square Wave Generation using Delay in 8051

To create a square wave generation using Delay.
let us say we want to construct a 1khz square waveform
the processor instruction cycle of 8051 is 1.085microseconds
so for 1khz (1milli seconds =1/1khz), is 1ms/1.085microseconds = 921.6 (this value is set to the for loop)
#include <reg51.h>
void delay()
{
for(i=0;i<922;i++)
}
void main()
{
P0=0xff;
delay();
P0=0×00;
delay();
}

Continue reading Square Wave Generation using Delay in 8051

  • Share/Bookmark

To find the processor instruction cycle of 8051

 
To find processor instruction cycle (Machine cycle) of 8051 microcontroller
Clock frequency of 8051 is 11.059MHz.
12 machine cycle makes 1 clock cycle
so,
12 * machine cycle = 11.059MHz.
Machine cycle = 11.059Mhz/12 = 921583 Hz.
Instruction cycle = 1/921583 = 1.085 microseconds

Continue reading To find the processor instruction cycle of 8051

  • Share/Bookmark

8051 Program to handle the Ports

 
Tool used: Keil Compiler for 8051
Microcontroller used: Intel 8051AH (with 32 I/O Pins, Two timers/counters, 5 interrupts with 2 priority levels)
//Program to handle ports of 8051
#include <reg51.h>
void main()
{
P0=0×50;
P1=0×10;
P0=P1+P0;
}
The Port0 holds the data of 50H and Port1 holds 10H, both added together and result is in Port0 as 0×60;

Continue reading 8051 Program to handle the Ports

  • Share/Bookmark

Serial Communication using UART

#include reg51.h>void main(){TMOD = 0×20;TH1=-3;SCON = 0×50;TR1 = 1;while(1){SBUF = ‘ABCD’;while(TI=1){TI=0;}}}

Continue reading Serial Communication using UART

  • Share/Bookmark

Square Wave Generation using Delay

Delay CalculationCrystal frequency = 11.059MHz.1 machine cycle = 1 / (11.059/12) = 1.085μ sFor 1second delay1.085μ s * 921660 = 1 sec (approx)
#include main(){int i,j;P0=0xff;for(i=0;i

Continue reading Square Wave Generation using Delay

  • Share/Bookmark

Sine Wave Generation

#include reg51.h>at 0×2000 xdata char sinetable[13];at 0×80 sfr sineout;char dacout;char i;void timer_isr(void) interrupt 1{TF0=0;dacout = sinetable[i++];TH0= 0xff;TL0=0xfb;TR0=1;if(i>13){dacout = sinetable[0];i=1;}}void main(){sinetable [0] = 128; //0sinetable [1] =192; //30sinetable [2] =238; //60sinetable [3] =255; //90sinetable [4] =238;sinetable [5] =192;sinetable [6] =128;sinetable [7] =64;sinetable [8] =17;sinetable [9] =0;sinetable [10] =17;sinetable [11] =64;sinetable [12] =128;i=0;IE=0×82;TMOD=0×01;TCON = 0×01;TH0 = 0xff;TL0 [...]

Continue reading Sine Wave Generation

  • Share/Bookmark