Hi
In magenta bootloader (there are 2 timers connected with this peripherial).
In blue, application.
What looks significant: different clock, 50000000Hz i application, and 195312Hz in bootloader.
** Abstract :
** This component "TimerInt" implements a periodic interrupt.
** When the component and its events are enabled, the "OnInterrupt"
** event is called periodically with the period that you specify.
** TimerInt supports also changing the period in runtime.
** The source of periodic interrupt can be timer compare or reload
** register or timer-overflow interrupt (of free running counter).
** Settings :
** Timer name : ECT_Counter (16-bit)
** Compare name : ECTTC0
** Counter shared : Yes
**
** High speed mode
** Prescaler : divide-by-1
** Clock : 195312 Hz
** Initial period/frequency
** Xtal ticks : 3994
** microseconds : 998
** milliseconds : 1
** seconds (real) : 0.0009984
** Hz : 1002
** kHz : 1
**
** Runtime setting : none
**
** Initialization:
** Timer : Enabled
** Events : Enabled
**
** Timer registers
** Counter : ECT_TCNT [$0044]
** Mode : ECT_TIOS [$0040]
** Run : ECT_TSCR1 [$0046]
** Prescaler : ECT_TSCR2 [$004D]
**
** Compare registers
** Compare : ECT_TC0 [$0050]
**
** Flip-flop registers
** Mode : ECT_TCTL2 [$0049]
setReg8(INT_CFADDR, 0xE0U);
setReg8(INT_CFDATA7, 0x03U); /* 0x77 0xFFEE 3 no ivVectch0 used by PE */
(...)
/* ECT_TSCR1: TEN=0,TSWAI=0,TSFRZ=0,TFFCA=0,PRNT=1,??=0,??=0,??=0 */
setReg8(ECT_TSCR1, 0x08U);
/* ECT_MCCTL: MODMC=1 */
setReg8Bits(ECT_MCCTL, 0x40U);
/* ECT_OCPD: OCPD1=1,OCPD0=1 */
setReg8Bits(ECT_OCPD, 0x03U);
/* ECT_PACTL: CLK1=0,CLK0=0 */
clrReg8Bits(ECT_PACTL, 0x0CU);
/* ECT_OC7M: OC7M1=0,OC7M0=0 */
clrReg8Bits(ECT_OC7M, 0x03U);
/* ECT_TIOS: IOS1=1,IOS0=1 */
setReg8Bits(ECT_TIOS, 0x03U);
/* ECT_TCTL2: OM1=0,OL1=0,OM0=0,OL0=0 */
clrReg8Bits(ECT_TCTL2, 0x0FU);
/* ECT_TTOV: TOV1=0,TOV0=0 */
clrReg8Bits(ECT_TTOV, 0x03U);
/* ECT_TSCR2: TCRE=0 */
clrReg8Bits(ECT_TSCR2, 0x08U);
/* ECT_TFLG1: C7F=1,C6F=1,C5F=1,C4F=1,C3F=1,C2F=1,C1F=1,C0F=1 */
setReg8(ECT_TFLG1, 0xFFU);
/* ECT_TIE: C1I=0,C0I=1 */
clrSetReg8Bits(ECT_TIE, 0x02U, 0x01U);
/* ECT_PTPSR: PTPS7=1,PTPS6=1,PTPS5=1,PTPS4=1,PTPS3=1,PTPS2=1,PTPS1=1,PTPS0=1 */
setReg8(ECT_PTPSR, 0xFFU);
(...)
/* ### TimerInt "timer_1ms_period" init code ... */
/* ECT_TC0: BIT15=0,BIT14=0,BIT13=0,BIT12=0,BIT11=0,BIT10=0,BIT9=0,BIT8=0,BIT7=1,BIT6=1,BIT5=0,BIT4=0,BIT3=0,BIT2=0,BIT1=1,BIT0=1 */
setReg16(ECT_TC0, 0xC3U); /* Store given value to the compare register */
(...)
/* ### Free running 16-bit counter "benchmark_timer" init code ... */
/* ECT_TC1: BIT15=1,BIT14=1,BIT13=1,BIT12=1,BIT11=1,BIT10=0,BIT9=1,BIT8=1,BIT7=1,BIT6=1,BIT5=0,BIT4=0,BIT3=1,BIT2=0,BIT1=0,BIT0=0 */
setReg16(ECT_TC1, 0xFBC8U); /* Store given value to the compare register */
/* Common peripheral initialization - ENABLE */
/* ECT_TSCR1: TEN=1,TSWAI=0,TSFRZ=0,TFFCA=0,PRNT=0,??=0,??=0,??=0 */
setReg8(ECT_TSCR1, 0x80U);
Header from module in applicatation and belowe propably code from cpu.c
------------------------------------------------------------------------------------------------
** Abstract :
** This component "TimerInt" implements a periodic interrupt.
** When the component and its events are enabled, the "OnInterrupt"
** event is called periodically with the period that you specify.
** TimerInt supports also changing the period in runtime.
** The source of periodic interrupt can be timer compare or reload
** register or timer-overflow interrupt (of free running counter).
** Settings :
** Timer name : ECT_Counter (16-bit)
** Compare name : ECTTC0
** Counter shared : No
**
** High speed mode
** Prescaler : divide-by-1
** Clock : 50000000 Hz
** Initial period/frequency
** Xtal ticks : 4000
** microseconds : 1000
** milliseconds : 1
** seconds (real) : 0.001
** Hz : 1000
** kHz : 1
**
** Runtime setting : none
**
** Initialization:
** Timer : Disabled
** Events : Enabled
**
** Timer registers
** Counter : ECT_TCNT [$0044]
** Mode : ECT_TIOS [$0040]
** Run : ECT_TSCR1 [$0046]
** Prescaler : ECT_TSCR2 [$004D]
**
** Compare registers
** Compare : ECT_TC0 [$0050]
**
** Flip-flop registers
** Mode : ECT_TCTL2 [$0049]
** Contents :
setReg8(INT_CFADDR, 0xE0U);
setReg8(INT_CFDATA7, 0x04U); /* 0x77 0x7FEE 4 no ivVectch0 used by PE */
(...)
/* ECT_TSCR1: TEN=0,TSWAI=0,TSFRZ=0,TFFCA=0,PRNT=0,??=0,??=0,??=0 */
setReg8(ECT_TSCR1, 0x00U);
/* ECT_MCCTL: MODMC=1 */
setReg8Bits(ECT_MCCTL, 0x40U);
/* ECT_OCPD: OCPD7=1,OCPD6=1,OCPD5=1,OCPD4=1,OCPD3=1,OCPD2=1,OCPD1=1,OCPD0=1 */
setReg8(ECT_OCPD, 0xFFU);
/* ECT_PACTL: CLK1=0,CLK0=0 */
clrReg8Bits(ECT_PACTL, 0x0CU);
/* ECT_OC7M: OC7M0=0 */
clrReg8Bits(ECT_OC7M, 0x01U);
/* ECT_TIOS: IOS7=1,IOS0=1 */
setReg8Bits(ECT_TIOS, 0x81U);
/* ECT_TCTL2: OM0=0,OL0=0 */
clrReg8Bits(ECT_TCTL2, 0x03U);
/* ECT_TTOV: TOV7=0,TOV0=0 */
clrReg8Bits(ECT_TTOV, 0x81U);
/* ECT_TCTL1: OM7=0,OL7=0 */
clrReg8Bits(ECT_TCTL1, 0xC0U);
/* ECT_TSCR2: TOI=0,TCRE=1,PR2=0,PR1=0,PR0=0 */
clrSetReg8Bits(ECT_TSCR2, 0x87U, 0x08U);
/* ECT_TIE: C0I=0 */
clrReg8Bits(ECT_TIE, 0x01U);
(...)
/* ### TimerInt "TI1_SchedulerTimer" init code ... */
/* ECT_TC0: BIT15=1,BIT14=1,BIT13=0,BIT12=0,BIT11=0,BIT10=0,BIT9=1,BIT8=1,BIT7=0,BIT6=1,BIT5=0,BIT4=1,BIT3=0,BIT2=0,BIT1=0,BIT0=0 */
setReg16(ECT_TC0, 0xC350U); /* Store given value to the compare register */
/* ECT_TC7: BIT15=1,BIT14=1,BIT13=0,BIT12=0,BIT11=0,BIT10=0,BIT9=1,BIT8=1,BIT7=0,BIT6=1,BIT5=0,BIT4=1,BIT3=0,BIT2=0,BIT1=0,BIT0=0 */
setReg16(ECT_TC7, 0xC350U); /* Store given value to the modulo register */