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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/04/07 07:07
Read: times


 
#141476 - How to generate 100 Khz square wave 80C51
Hi,

I want to generate 100 Khz square wave output from the 80c51 using the crystal 11.059 Mhz.

But i am able to generate only 50 khz maximum,

can you correct my code for making 100 Khz

void main(void)
{


TMOD = 0x20;
TH1 = 0xFD;
SCON = 0x50; // for serial communication
EA = 1;
TR1 = 1;


TMOD=0x01;
TL0=0xFD; // TL0 Reload value
TH0=0xFF; // TH0 Reload value 50 Khz
ET0=1;
TR0=1; // Start Timer0
EA=1;


while(1)
{
}


}

void timer0() interrupt 1 // interrupt address is 0x000b
{

TF0 = 0; // reset interrupt flag
P0_1 = ~P0_1; // P3.4 toggle when interrupt.
TL0=0xFD; // TL0 Reload value
TH0=0xFF; // TH0 Reload value 50 Khz


}


Please help me
Thanks

List of 24 messages in thread
TopicAuthorDate
How to generate 100 Khz square wave 80C51            01/01/70 00:00      
   Tips            01/01/70 00:00      
      1 KHz            01/01/70 00:00      
         that's ...            01/01/70 00:00      
         SI Units            01/01/70 00:00      
            1024 = Ki            01/01/70 00:00      
   C interrupt overhead            01/01/70 00:00      
      RE: C interrupt overhead            01/01/70 00:00      
         and listen to the guru! :-)            01/01/70 00:00      
            several reasons            01/01/70 00:00      
               Yet another reason to avoid using HLL's!            01/01/70 00:00      
               Optimizations            01/01/70 00:00      
   Use Timer0 auo reload            01/01/70 00:00      
      using            01/01/70 00:00      
      interrupt vectoring vs. latency            01/01/70 00:00      
         Then the Interupt must be in ASM            01/01/70 00:00      
            do you mean...            01/01/70 00:00      
               No            01/01/70 00:00      
               Compiler generated IRQ vectors            01/01/70 00:00      
                  OOPS we both meant LJMP REALisr            01/01/70 00:00      
                  the original problem...            01/01/70 00:00      
         Interrupt Latency + Vectoring + Service            01/01/70 00:00      
   indufficient info            01/01/70 00:00      
   use MCS52 better option            01/01/70 00:00      

Back to Subject List