debug my C program based on my MIPS

Hi i need some one to help me debug my c program. this is the program for stopwatch with the format of M:SS i have to control my interrupt with switch sw1 and sw2 in pic32 so sw1 enable/disable timer and sw2 reset and it has proirity over sw1. i wrote my ISR in MIPS and i am calling them only in c so my c should be simple but the thing is that i wrote both program but my switches doesnt work so when i comment out my if/else statement in c for switches and run program it run as a timer just fine but when i uncomment switch it doesnt work and it just show 0:00. why ??? can you help me and here is my c:

and just to note the template of this progranm was written i just worked on my while loop at the end thats wehre to look

/*

 * File:   demo.c

 * Author: mrg

 *

 * Created on October 31, 2014, 9:29 AM

 */

// **** Include libraries here ****

// Standard libraries

#include <stdio.h>

#include <stdlib.h>

// Microchip libraries

//#include <xc.h>

#include <plib.h>

#include <p32xxxx.h>

// Oled Libraries

#include “OledDriver.h”

#include “OledChar.h”

#include “OledGrph.h”

// User libraries

// **** Set macros and preprocessor directives ****

#define SYS_FREQ       80000000L

#define F_PB           20000000L

#define UART_BAUD_RATE    115200

#define UART_USED          UART1

// **** Define global, module-level, or external variables here ****

// **** Declare function prototypes ****

// **** Set processor configuration ****

// Configuration Bit settings

// SYSCLK = 80 MHz (8MHz Crystal/ FPLLIDIV * FPLLMUL / FPLLODIV)

// PBCLK = 20 MHz

// Primary Osc w/PLL (XT+,HS+,EC+PLL)

#pragma config FPLLIDIV   = DIV_2     // Set the PLL input divider to 2

#pragma config FPLLMUL    = MUL_20    // Set the PLL multiplier to 20

#pragma config FPLLODIV   = DIV_1     // Don’t modify the PLL output.

#pragma config FNOSC      = PRIPLL    // Set the primary oscillator to internal RC w/ PLL

#pragma config FSOSCEN    = OFF       // Disable the secondary oscillator

#pragma config IESO       = OFF       // Internal/External Switch O

#pragma config POSCMOD    = XT        // Primary Oscillator Configuration

#pragma config OSCIOFNC   = OFF       // Disable clock signal output

#pragma config FPBDIV     = DIV_2     // Set the peripheral clock to 1/8 system clock

#pragma config FCKSM      = CSECMD    // Clock Switching and Monitor Selection

#pragma config WDTPS      = PS1       // Specify the watchdog timer interval (unused)

#pragma config FWDTEN     = OFF       // Disable the watchdog timer

#pragma config ICESEL     = ICS_PGx2  // Allow for debugging with the Uno32

#pragma config PWP        = OFF       // Keep the program flash writeable

#pragma config BWP        = OFF       // Keep the boot flash writeable

#pragma config CP         = OFF       // Disable code protect

// This needs to be uncommented to implement your assembly function

//extern int getDelay();

int main(void)

{

    // Configure the device for maximum performance but do not change the PBDIV

    // Given the options, this function will change the flash wait states, RAM

    // wait state and enable prefetch cache but will not change the PBDIV.

    // The PBDIV value is already set via the pragma FPBDIV option above..

    SYSTEMConfig(SYS_FREQ, SYS_CFG_WAIT_STATES | SYS_CFG_PCACHE);

    // Auto-configure the PIC32 for optimum performance at the specified operating frequency.

    SYSTEMConfigPerformance(SYS_FREQ);

    // osc source, PLL multipler value, PLL postscaler , RC divisor

    OSCConfig(OSC_POSC_PLL, OSC_PLL_MULT_20, OSC_PLL_POST_1, OSC_FRC_POST_1);

    // Configure the PB bus to run at 1/4 the CPU frequency

    OSCSetPBDIV(OSC_PB_DIV_4);

    // Enable multi-vector interrupts

    INTEnableSystemMultiVectoredInt();

    // Set up the UART peripheral so we can send serial data.

    UARTConfigure(UART_USED, UART_ENABLE_PINS_TX_RX_ONLY);

    UARTSetFifoMode(UART_USED, UART_INTERRUPT_ON_TX_NOT_FULL | UART_INTERRUPT_ON_RX_NOT_EMPTY);

    UARTSetLineControl(UART_USED, UART_DATA_SIZE_8_BITS | UART_PARITY_NONE | UART_STOP_BITS_1);

    UARTSetDataRate(UART_USED, F_PB, UART_BAUD_RATE);

    UARTEnable(UART_USED, UART_ENABLE | UART_TX);

    // And configure printf/scanf to use the correct UART.

    if (UART_USED == UART1) {

        __XC_UART = 1;

    }

    extern void T1Setup();

    extern void T1Stop();

    extern void T1Start();

    // Enable LED outputs 0-7 by setting TRISE register

    TRISECLR = 0x00FF;

    // Initialize the PORTE to 0

    PORTECLR = 0x00FF;

    // Set the lowest bit

    PORTESET = 1;

    OledInit();

    OledDisplayOn();

    T1Setup();

    extern volatile int milliseconds;

    // Either write your C program here or call your (new) assembler function

    while(1) {

        // Display the least significant part of the time for debugging

        /******************************************************************************/

        /*I STARTED MY CODE HERE for condition of both switches*******************************************/

      char buffer [100];

        int mins = milliseconds / 600;

        int secs = (milliseconds/10)%60;

        if (PORTD & 0x200) {

            T1Stop();

        }

            else if(PORTD & 0x100) {

            T1Start();

        }

        else {

            T1Stop();

        }

     sprintf(buffer, “%d : %02d”,mins,secs);

        OledSetCursor(0,0);

            OledPutString(buffer);

        /*************************************************************/

        /****trying to print out miliseconds just to check ends here*/

        PORTE = 0x00FF & milliseconds;

    }

}

"Get 15% discount on your first 3 orders with us"
Use the following coupon
"FIRST15"

Order Now