ZVH64 PT7 as general IO slows down IOC1_7 output compare interrupt frequence

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ZVH64 PT7 as general IO slows down IOC1_7 output compare interrupt frequence

Jump to solution
507 Views
yongguangliu
Contributor I

hi, everyone,

I encountered a confused problem with S9S12ZVH64 recently. PT7 is multiplexing as IOC1_7 and PTT[7]/KWT[7]. 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.

1 Solution
405 Views
yongguangliu
Contributor I

I found it was the hour meter processing slowed down IOC1_7 output compare interrupt frequence. In the processing, in order to store system working time into EEPROM, the global interrupt is disabled and so  IOC1_7 output compare interrupt is affected and becomes at slower frequence. The two source code projects compared are different on dealing with the global interrupt. The hour meter is precisely if the interrupt enables all the time. So it's my fault and the MCU functions normally.

Thank you all for focusing on the issue.

 

View solution in original post

1 Reply
406 Views
yongguangliu
Contributor I

I found it was the hour meter processing slowed down IOC1_7 output compare interrupt frequence. In the processing, in order to store system working time into EEPROM, the global interrupt is disabled and so  IOC1_7 output compare interrupt is affected and becomes at slower frequence. The two source code projects compared are different on dealing with the global interrupt. The hour meter is precisely if the interrupt enables all the time. So it's my fault and the MCU functions normally.

Thank you all for focusing on the issue.