AnsweredAssumed Answered

I have Problem with the TIM

Question asked by Victor Palacio on Nov 7, 2009
Latest reply on Nov 7, 2009 by Victor Palacio

Hello. Excusme my  bad english, I from Colombia.

I work with HC08JL8, and now I using the 2 TIM, TIM1 and TIM2; my idea is generate frecuency the 4HZ  to 100 HZ  with TIM1, and TIM2 for Pulse width positive, the 50uS to 2000uS; but no working, I need you help, or one idea but answer my problem. Attached part of the code in C.

 

 


void  TIM1_Setup(void){
TIM1_TSC=0x36;
TIM1_TMOD=1000; // Or Frecuency
TIM1_TSC=0x46;
}

void  TIM2_Setup(void){
TIM2_TSC=0x36;
TIM2_TMOD=100; // Or Pulse Width

}


interrupt 6 void TIM1_isr(void){
PTD5 = 1;  // On PTD5
T2SC=0x46;
          T2SC_TOF=0;
          T1SC_TOF=0;}

interrupt 9 void TIM2_isr(void){
PTD5 = 0;  // off PTD5
TIM2_TSC=0x36; /

T2SC_TOF=0;
}

void Main (void){

EnableInterrupts;
TIM1_Setup();
TIM2_Setup();
....
....

// more code

......
......
}

 Thanks for your help.

Ohh, I forgot to mentionthe Crystal is 20MHZ

 

Bye.

 

 

 

Message Edited by marvicdigital on 2009-11-07 03:50 AM

Outcomes