Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/14/02 06:31
Read: times


 
#24455 - RE: Philips 80C552 (80C51) Timer Questio
Hi Michael,

use T0 in reload mode with TH0 = -143.

Then in the interrupt count down a byte to divide by 256 and you get 50.08Hz.
Then a second byte count down also and clear the output pin. The phase shift between these bytes was the pwm output:

#pragma cd
#include <reg51.h>

unsigned char low_pwm, high_pwm;

sbit PWMOUT = P1^1;

void set_pwm( unsigned char val )
{
EA = 0;
low_pwm = 0;
high_pwm = val;
EA = 1;
}

void t0_interrupt( void ) interrupt 1
{
if( --low_pwm == 0 )
PWMOUT = 1;
if( --high_pwm == 0 )
PWMOUT = 0;
}


Peter



List of 10 messages in thread
TopicAuthorDate
Philips 80C552 (80C51) Timer Question            01/01/70 00:00      
RE: Philips 80C552 (80C51) Timer Question            01/01/70 00:00      
RE: Philips 80C552 (80C51) Timer Question            01/01/70 00:00      
RE: Philips 80C552 (80C51) Timer Question            01/01/70 00:00      
RE: Philips 80C552 (80C51) Timer Question            01/01/70 00:00      
RE: Philips 80C552 (80C51) Timer Questio            01/01/70 00:00      
RE: Philips 80C552 (80C51) Timer Question            01/01/70 00:00      
RE: Philips 80C552 (80C51) Timer Question            01/01/70 00:00      
RE: Philips 80C552 (80C51) Timer Question            01/01/70 00:00      
RE: Philips 80C552 (80C51) Timer Question            01/01/70 00:00      

Back to Subject List