PIT interrupts
"sripathy23" <[email protected]>
| Newsgroups | gmane.comp.hardware.motorola.microcontrollers |
|---|---|
| Message-ID | <[email protected]> |
Dear Members
Thanks for helping me about PIT interrupts. I am able to generate the
interrupts. But I think I am unable to got to the address at 0x0500
which is the address for external interrupts.
I am using the pragma for the interrupts. i tried to use the example
for the sci interrupt in pdf AN2109. Instead of SCI i am using a PIT
interrupt.
I have given the code below to generate the interrupt and the handler.
In the code below PIT_Int() is the interrupt handler.I have used a
pragma interrupt on to go to external interrupts. Th ecode in the
pragma section which is commented is the code which is given in sci
interrupt example at AN2109. i tried to run this code but it gave me
an error saying illegal pragma. i think that they have used the
example in the diab compiler whereas i am using a code warrior
compiler. is my code for the interrupt is write. I would really
appreciate if anyone can have a look at this.
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
{
}
}
#pragma interrupt on
#pragma section code_type "IrqSect" ".abs.00000500"
//#pragma interrupt Ext_Isr
//#pragma section IrqSect RX address=0x500
//#pragma use_section "IrqSect" Ext_Isr
//__declspec(section"IrqSect")
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 --------------------~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/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/