Well, since you asked, and since you are leaning,
I will give you my version of advice.I don't know how you generated this project and why you are using the headers you are.I am going to advise that you recreate the project as a regular project.
You should not be using the BSP_IPSBAR2 ?registers as you are.You can do that, but since it is unusual, others will not get what you are doing and it is highly non portable.
In real life, no one ever moves the IO base.I would also advise that you start using the Eclipse version of codewarrior for 3 good reasons:
1. The V1 debugger is much much better.
2. Freescale is really not going to support the so called "Classic" versions. Also, you will probably soon get a new computer that will be running a 64 bit os, and then you will have to change versions.
3. If you learn Eclipse, much of what you learn will transfer to Java, Android and other domains.
Now, for the code.You never ever do a bulk delay in an interrupt handler. For one thing, you could be overruning the interrupt, which means that you get another interrupt while you are still in the interrupt handler. Second you are locking out other interrupts and could cause other problems like missed data on a serial port.
I personally never use an edge interrupt to handle a button, because it needs to be debounced and in the end you have to do some sort timing anyway, also since it is a human pressing the button, you have plenty of time to service it. I use the RTC interrupt running a 1ms and require that the button be in the same state for 10-20ms.
Also, I don't see that you are turning off the watchdog timer nor are you servicing it. This will cause the MCU to reset.
So, based on my advice this is how I would write the program. I did not actaully test it on your board, but most of it is from working code. I am taking it on faith that you had the correct IO bits for your led and button.
You really don't need deboucing for this particular example, but at least it is there....
#include <hidef.h> /* for EnableInterrupts macro */#include "derivative.h" /* include peripheral declarations */// Function prototypes.void RTCTickCallback(void);void InitRTCInternalClock(void);void BUTTONHandler(void);#define BUTTON_DEBOUNCE 20void InitRTCInternalClock(void){ // Set RTIE to enable interrupts, select the 1KHz internal oscillator // set the divider to 1 for a 1ms interrupt. RTCSC = 0x18; RTCMOD = 0;}void BUTTONHandler(void){ static byte state = 1; static byte debounce = 0; static byte ledstate = 0; if( ledstate ) PTED |= (1 << 5); else PTED &= ~(1 << 5); // Is the state the same as last time? if((PTCD & (1 << 4)) == state ) { if(debounce == BUTTON_DEBOUNCE + 1) return; ++debounce; if(debounce == BUTTON_DEBOUNCE) { // The state just changed here. ledstate = state; return; } } // State changed last time, so start over debouncing. else { state = PTCD & (1 << 4); debounce = 0; } }interrupt VectorNumber_Vrtc void RTC_InterruptHandler(void);interrupt VectorNumber_Vrtc void RTC_InterruptHandler(void){ BUTTONHandler();RTCSC |= 0x80; // Ack the interrupt}void main(void) { SOPT1 = 0x10; // Disable watch dog. InitRTCInternalClock(); PTEDD |= (1 << 5); // PTE5 made output pin PTCDD &= ~(1 << 4); // PTC4 made as input pin PTCPE &= ~(1 << 4); // PTC4 Turn the pull up on as well EnableInterrupts; for(;;) { } /* loop forever */ /* please make sure that you never leave main */}