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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/15/05 18:16
Read: times


 
#105296 - PWM software for P89LPC952
Responding to: ???'s previous message
I have generated this code using Code architect from ESA academy.Please can someone tell me how the frequency/pulse width can be changed for the P89LPC952.I am able to get a duty cycle of 50%. For a 18 MHz crystal I am getting a square pulse of 36kHz frequency.How can I vary the freqency of the square wave to 4 kHz? The V(p-p) is 3.3V.

void main()
{

// configure timer 1 T1M2 T1M1 T1M0
TMOD &= 0x0F; // 1 1 0
TMOD |= 0x20; // Timer 1 in mode 6
TAMOD &= 0xEF;
TAMOD |= 0x10;

// timer values
TH1 = 0x80;//0x4C;
TL1 = 0x40;//0x4C;

// T1(P0.7) pin is a push-pull output
P0M1 &= 0x7F;
P0M2 |= 0x80;

// enable toggle output
AUXR1 |= 0x20;

// set timer 1 isr priority to 0
IP0 &= 0xF7;
IP0H &= 0xF7;

// enable timer 1 interrupt
ET1 = 1;

// start timer 1
TR1 = 1;
EA =1;

for(;;)
{

}
}


List of 10 messages in thread
TopicAuthorDate
89lpc952 PWM operation            01/01/70 00:00      
   PWM            01/01/70 00:00      
   932um 933-935UM            01/01/70 00:00      
      program for PWM            01/01/70 00:00      
         why not use the CodeArchitect            01/01/70 00:00      
            PWM software for P89LPC952            01/01/70 00:00      
               why did you choose a derivative without            01/01/70 00:00      
                  PWM P89LPC952            01/01/70 00:00      
                     the only way I see would be            01/01/70 00:00      
                        Hopefully....            01/01/70 00:00      

Back to Subject List