Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/02/02 17:35
Read: times


 
#33581 - PCA interrupt doesn\\\\\\\'t work !
Hi people,

I'm trying to use the capture mode of the PCA on a P89c668 chip and I've wrote the following code here under.

The purpose of the code is to measure a period on the CEX0 pin. I've been inspired from the intel application note 'PCA cookbook'.


My problem is that the interrupt code is never called and that the CCF0 flag is never set when applying an edge on the CEX0 pin.

As the PCA interrupt vector is 0x33, I've assigned the interrupt as number 6 to the Keil compiler by reading the Keil documentation.

Where have I made a mistake ?

FOR ERIK : Erik, you said that to build my 24 bits timer I should use the timer2 overflow flag as input of the PCA. By reading the datasheet, this is timer0 flag which is used as input for PCA and timer0 hasn't external capture mode capability. Am I wrong ?

Thanks
Stephane

U8 u8ISRFlag=0;
U16 u16BeginCapture;
U8 u8PeriodCount = 10;
void TIME_Init (void)
{
	CMOD = 0;
	CCAPM0 = 0x21;
	CCAP0H = 0;
	CCAP0L = 0;
	CH = 0;
	CL = 0;
	EC = 1;
	CR = 1;
}	

void pca_isr (void) interrupt 6 using 1
{
	
	U16 u16EndCapture = 0;
	U16 u16Period = 0;
	CCF0 = 0;
	
	if (u8ISRFlag == 0)
	{
		u16BeginCapture = CCAP0H;
		u16BeginCapture = u16BeginCapture>>8 | CCAP0L;
		u8ISRFlag = 1;
	}
	else
	{
		while (u8PeriodCount !=0)
		{
			u16EndCapture = CCAP0H;
			u16EndCapture = u16EndCapture>>8 | CCAP0L;
			u16Period = u16EndCapture - u16BeginCapture;
		}
		u8ISRFlag = 0;
		u8PeriodCount = 10 ;
                  UART_DisplayValue (u16Period,5,0);
	}
}


List of 24 messages in thread
TopicAuthorDate
PCA interrupt doesn\\\\\\\'t work !            01/01/70 00:00      
RE: PCA interrupt doesn\\\\\\\'t work !            01/01/70 00:00      
RE: PCA interrupt doesn\\\\\\\'t work !            01/01/70 00:00      
RE: PCA interrupt doesn\\\\\\\'t work !            01/01/70 00:00      
RE: PCA interrupt doesn\\\\\\\'t work !            01/01/70 00:00      
RE: PCA interrupt doesn\\\\\\\'t work !            01/01/70 00:00      
RE: PCA interrupt doesn\\\\\\\'t work !            01/01/70 00:00      
RE: PCA interrupt doesn\\\\\\\'t work !            01/01/70 00:00      
RE: PCA interrupt doesn\\\\\\\'t work !            01/01/70 00:00      
RE: PCA interrupt doesn\\\\\\\'t work !            01/01/70 00:00      
RE: PCA interrupt doesn't work !            01/01/70 00:00      
RE: PCA interrupt doesn\\\\\\\'t work !            01/01/70 00:00      
RE: PCA interrupt more            01/01/70 00:00      
RE: PCA interrupt doesn\\\\\\\'t work !            01/01/70 00:00      
RE: PCA interrupt doesn\\\\\\\'t work !            01/01/70 00:00      
RE: PCA interrupt doesn\\\\\\\'t work !            01/01/70 00:00      
RE: PCA interrupt more            01/01/70 00:00      
RE: PCA interrupt more            01/01/70 00:00      
RE: PCA interrupt more            01/01/70 00:00      
RE: PCA interrupt more            01/01/70 00:00      
RE: PCA interrupt doesn\\\\\\\'t work !            01/01/70 00:00      
RE: PCA interrupt could it be            01/01/70 00:00      
RE: PCA interrupt more            01/01/70 00:00      
RE: PCA interrupt doesn\\\\\\\'t work !            01/01/70 00:00      

Back to Subject List