Pulse Width Modulation is the waveform whose amplitude and phase
remains the constant while the width of the pulse varies. This type of
waveform can be implemented to control circuit like motor, fan, light
bulb intensity etc. You can write the code in embedded C language and
burn the hex file on 8051 microcontroller memory.
This output is analyzed on Keil µvision4 logic analyzer. You can setup
your pin on which output is taken and set the hexadecimal in setup
window of logic analyzer.
Code:
#include "REG52.h" long int i,j,k; void delay(int a) { for(i=0;i<=a;i++) { for(j=0;j<=500;j++); } } void main() { while(1) { for(k=0;k<=10;k++) { P2=0xff; delay(10); P2=0x00; delay(10-k); } for(k=255;k>=0;k--) { P2=0x00; delay(k); P2=0xff; delay(10-k); } } }
Comments
Post a Comment