I encountered a confused problem with S9S12ZVH64 recently. PT7 is multiplexing as IOC1_7 and PTT/KWT. I use PT7 as a general input IO and use IOC1_7 output compare interrupt simutaneously (For hour meter. Output Compare action will not occur on the channel pin). For my purpose, the configuration code is as follow:
void Timer1_Init (void)
TIM1TSCR1_TEN = 0; //Disable timer1
TIM1TSCR1_TFFCA = 0; //Allows the timer flag clearing to function normally.
TIM1TSCR2_PR = 0x07; //125KHz
TIM1TIOS_IOS7 = 1; // setup T1C0 as output compare
//TIM1OCPD_OCPD7 = 1; //Disables the timer channel port. Output Compare action will not occur on the channel pin.
TIM1OCPD = 0xff; //Disables the timer channel port. Output Compare action will not occur on the channel pin.
TIM1TC7 = 125; // Initial value of counter 7. Interrupt frequence is 1KHz.
TIM1TIE_C7I = 1; // Interrupt enable
TIM1TSCR1_TEN = 1; //enable timer0 as free-running
interrupt VectorNumber_Vtim1ch7 void tim1ch7_comp(void)
//Hour meter processing here.
So, PT7 will be configured as general input IO while IOC1_7 output compare interrupt take effect. In the program, PT7 is read per 10ms. The main problem is that hour meter is slower than not using PT7 as general IO input(Approximately 12 minutes less than normal per 24 hours). When enable TIM1 and PT7 funtions as IOC1_7 by default, the hour meter is precisely. It seems PT7 as general input IO make IOC1_7 interrupt at a lower frequence than 1kHz.
This problem confuses me several days and I don't unstand what relevance there between PT7 as general IO and IOC1_7 output compare interrupt. So anybody unstand or encounter the similar problem?
Thanks in advance for replying.