Bear1985 发表于 2010-3-6 22:45:56

78K0怎么进不了中断函数,求教大侠

源代码:
#pragma SFR
#pragma interrupt INTTM000 fn_inttm000
#pragma NOP
#pragma EI
/*initialize fCPU and fPRS */
int counter;
void fn_inttm000();
void SystemClock_init(void)
{
        unsigned char unCnt200us;
        WDTE=0xAC;
        PCC=0x00;         /*cpu clock select main system clock(fCPU=fXP)*/
        RCM=0x02;         /*internal low-speed osillator stopped*/
        /*exam the reset source*/
        if(!(RESF & 0x01))
        {
                LVIS=0x00;
                LVION=1;
                for(unCnt200us=0;unCnt200us<9;unCnt200us++)
                {
                        NOP();
                }
                while(LVIF) {NOP();}
                LVIMD=1;
        }
        MCM=0x00;         /*main system clock and perpheral hardware
                               clock use internal high-speed osillator clock
                                                       fXP=fRH=8MHz;fPRS=fRH=8MHz*/
        OSCCTL=0b00000000;      /*X1、X2 use as I/O port */
        /*OSTS=0b00000001;*/      /*main system clock stabilization time 204.8us*/
}

/* Initialise the TM000 clock*/
void TM000_init(void)
{
        /*initiallise SFR*/
        CRC00=0x00;       /*CR000 used as compare register*/
        TOC00=0x00;       /*set output control register*/
        PRM00=0x02;       /*select count clock 31.25KHz*/
        CR000=3125-1;         /*set interval time 1s*/
        TMC00=0x0c;       /*start count operation*/
       
        /*initiallise interrupt*/
        IF0H=0x00;
        TMMK000=0;            /*open the INTTM000 interrupt*/
        return;
}
__interrupt void fn_inttm000()
{
        /* Interrupt Service Routine code goes here */
       
/*        if(P4 & 0xff)
                P4 = 0xfe;
        else
                P4 = 0xff;       
        return;
*/
        if(++counter==250)
        {
                counter=0;
                P4^=0b00000001;
        }
        return;
}


void main()
{
        SystemClock_init();
        TM000_init();
        EI();
        P4=0;
        PM4=0b11111100;
        while(1)
        {
                NOP();
                NOP();
        }
}

Bear1985 发表于 2010-3-6 22:48:43

回复【楼主位】Bear1985
-----------------------------------------------------------------------

是uPD78F0525

Bear1985 发表于 2010-3-9 10:33:22

回复【1楼】Bear1985
-----------------------------------------------------------------------

已解决,程序没问题,编译器有问题,换了一个,就OK了

yyslbh 发表于 2010-3-29 16:27:39

请问你主要是什么问题?怎么会编译器的问题呢?
页: [1]
查看完整版本: 78K0怎么进不了中断函数,求教大侠