AnsweredAssumed Answered

Configure Timer as output - s12zvl

Question asked by Alexis Hernandez on Mar 6, 2018
Latest reply on Mar 12, 2018 by Diana Batrlova

Hi, i'm trying to use the timer0-channel3 as output in one of the supported pins PT3 (i just want to be sure that the timing configuration is correct). 
The port configuration seems ok but the maximum frequency that i can get from the output is 100 Hz even though the frequency of the bus is 6.25MHz (measured using the ECLK signal).
It looks like the issue comes from the configuration of the 16 bit counter register, my main question is how to configure the 16 bit comparator in order to achieve an output of 6.25 MHz?


Here is the code snippet:

void TIM_Init(void){
   TIM0TIOS = 0x3F; /*0B0011 1111 - Select all channels as Output Compare*/ 
   TIM0TCTL1 = 0x05; /*0b0000 0101 - Toggle OC5/4 Output Line*/ 
   TIM0TCTL2 = 0x55; /*0b0101 0101 - Toggle OC3/2/1/0 Output Line */ 
   TIM0TIE = 0x08; /*0b0000 0100 - Interrupt Enabled Ch3*/ 
   TIM0TSCR2 = 0x00; /*0b0000 0000 - TimerOverflow@b7:off Prescaler=Clk/1*/
   TIM0OCPD = 0x37; /*0b0011 1011 - Enable OutputCompare Ch3*/ 
   TIM0TC3H = 0xFF;    
   TIM0TC3L = 0xF0;   
   TIM0TSCR1 = 0x80; /*0b1000 1000 - TimerEnabled with Legacy prescaler */
   TIM0CFORC = 0x08; /*0b0000 1000*/