PIT interrupts

"sripathy23" <[email protected]>
Newsgroups gmane.comp.hardware.motorola.microcontrollers
Message-ID <[email protected]>
Yes I am able to generate the interrupts. the Pit counter is 
decrementing and it is setting the PS bit to one when the counter 
reaches zero. But the problem is after the PS bit is set it is not 
going to the interrupt routine at 0x0500. In the main program i have 
set
the external interrupt enable using the instruction 
asm(" mtspr EIE, r3");

I am not sure whether the pragma i used for the interrupt is right or 
not. i have given the code for the interrupt and the interrupt 
handler. is this code right . the example code which is in the 
motorola document for sci interrupt is not working in the code 
warrior compiler. so i madified the code . i don't know wheteher its 
right. can u have a look at it and help me out.
thanks in advance for your help.

here is the code for the interrupt

 void PIT_Int()
{
   cout<<"Interrupt handler"<<endl;
if(USIU.PISCR.B.PS == 1)
 {
     pitctra1++;					// Increment 
PIT interrupt counter
     if(pitctra1==100)	
     {
     countera1 = countera1+100;
     MIOS1.MPWMSM2PULR.R = 100;		/* Set Duty Cycle to 25%*/
     MIOS1.MPWMSM2SCR.B.EN = 1;		/* Enable output on PWM2 */
	 USIU.PISCR.B.PS = 1;	    // Negate interrupt request
     flag1=1;	
	 pitctra1 = 0;
     }
     else
     {
     	
     }
 }
else
 {
    	
 }
}



the commented code is the one which is give in the sci example in 
AN2109 pdf document

//#pragma interrupt Ext_Isr
//#pragma section IrqSect RX address=0x500
//#pragma use_section "IrqSect" Ext_Isr


Insted of the above code i am using the one below to generate the 
interrupt. is this code right

#pragma interrupt on 
#pragma section code_type "IrqSect" ".abs.00000500" 

void Ext_Isr()

{

#define LEVEL0 0x40000000
asm (" mtspr EID, r0 "); // Set MSR.RI – now recoverable
if (USIU.SIPEND.R&LEVEL0) // Check if IRQ is level 0
{
PIT_Int(); // Call PIT C interrupt handler
}
else
{
// Just return
}
asm (" mtspr NRI, r0 "); // Clear MSR.RI - now irrecoverable

};
#pragma interrupt off





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/dN_tlB/TM
--------------------------------------------------------------------~-> 

-----------------------------------------------------------
To learn more about Freescale Microcontrollers, please visit
http://www.freescale.com/mcu


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/MPC500/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.