Hi,I have try to build a little project to do some PWM mode. But my problem is i want to build PWM so i can turn on the led from dark to bright so it has a gradation, not blinking. I use two timer but i only can program with one mode only like 2,5v,1v, 4,5v,not gradation mode.So,does any body know how to make a gradation voltage using PWM with AT89s51?Can i know an assemly program also? 8O
I ussually programming this AT89s51 using IDE Raissonance so i write this program with assembly code does anyone know how to generate gradation voltage using PWM mode in AT89s51?
Using two timers you can generate PWM in standard 8051 uC. But the problem with this is that the frequency of output signal won't be very high which results in poor fading of LED. I've tried this thing and results were very poor. Also a lot of CPU time is wasted in generating this signal.
Insted try using 89C51RB2 or RC2 or RD2. They have in-built PWM module.
to build PWM i use two timer.Timer 0 for hafwave 1 and timer 1 for next halfwave so if i want to make high output,i can set the Th0 and TL0 at -1000 and TL1 and TH1 i set for 1. It start at port0.0 at ffh.When timer 0 is on,it will high based on the value of Th0 and tl0,then i use CPL so the port 0 is in low and i set the timer 1 on, after timer1 overflow then i use CPL again. But it only generate 1 Voltage only (ex 5 only).How is the program to make fading led?In assembly language?