⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 isr.c

📁 LCD OSD 程序用於8051 開發lcd
💻 C
字号:
#include "types.h"
#include "board.h"
#include "global.h"
#include "power.h"
#include "debug.h"
#include "debugDef.h"

#define ReSyncTick			300//54	// 0.2 Second for resynchorize dubug process 
#if UseINT
#define EnableExt0Interrupt		1
#else
#define EnableExt0Interrupt		0
#endif
#define EnableExt1Interrupt		1
#define EnableTime0Interrupt		1
#define EnableTime1Interrupt		0
#define EnableTime2Interrupt		0
#define EnableSerialPortInterrupt	1


#if EnableExt0Interrupt
void EXT0Interrupt(void) interrupt 0
{ if (!SyncLossState())// && SrcInputType!=Input_Digital)
    { //hw_ClrBlacklit();
      Set_InputTimingChangeFlag();
      SrcFlags|=SyncLoss;
    }
  IE0=0;
}
#endif


#if EnableTime0Interrupt
void Time0Interrupt(void) interrupt 1
{ TH0=ClockPeriod>>8;
  TL0=ClockPeriod&0xFF; // timer 1 counter
  	ms_Counter--;
  	if (ModeDetectCounter)
    		ModeDetectCounter--;

  if (ms_Counter==0) //
    { Second++;
      if (!PowerSavingFlag)
        { if (BlacklitTime<0xFFFFFFFFul)
            BlacklitTime+=1;
      	}

      		if (OsdCounter)
       	 	if (--OsdCounter==0)
          			Set_OsdTimeoutFlag();

      		if (PowerDownCounter)
        		if (--PowerDownCounter==0)
          			Set_ForcePowerSavingFlag();

      		Set_ChangePatternFlag();

//      		Set_ms500Flag();


      		if (Second == 60 && hwPanel_Pin)   //ASW for Burnin mode show time
        	{ // 1 minute
          		Second = 0;
          		G_BurninTimeMin++;
          		if (G_BurninTimeMin == 60)
            		{ // 1 hour
              		G_BurninTimeHour++;
              		G_BurninTimeMin= 0;
            		}
        	}     	 

      		ms_Counter=SystemTick;
    	}

	if ((ms_Counter%500)==0)
		    Set_ms500Flag();

  	if (ReSyncCounter)
    		ReSyncCounter--;

  	TF0=0; // timer 1 flag
}
#endif

#if EnableExt1Interrupt
void EXT1Interrupt(void) interrupt 2
{ IE1=0;

  if (INTFLG&0x40)              //ASW for ISP
    { if (RCBTXBBUF==0x77)
        { IE=0;
          WDT=0;
          ISPSLV=0x7C; // ISP Slave address
          ISPEN=0x93; // Enable MTV312 ISP function
          PCON=0x01; // MCU Idle mode
  	}
    }
}
#endif

#if EnableTime1Interrupt   
void Time1Interrupt(void) interrupt 3
{
}
#endif

#if EnableSerialPortInterrupt
void SerialPortInterrupt(void) interrupt 4    //modify by karl 20050501
{ BYTE sioData;
  if (RI)
    { RI=0;
      sioData=SBUF;
      if (!RxBusyFlag)
        { 
		if (SIORxIndex<5)
            {   if (SIORxIndex==0)
                 ReSyncCounter=ReSyncTick;
                 SIORxBuffer[SIORxIndex++]=sioData;
	         if(SIORxBuffer[0]==0x6e)
		   	CommandLength=5;
		  else
			CommandLength=(SIORxBuffer[0]>>6)+1;
              /* if (SIORxIndex==CommandLength)
              {     Set_RxBusyFlag();
                    ReSyncCounter=ReSyncTick;
              }*/
            }
      	  }
     }
  if (TI)
    TI=0;
}
#endif

#if EnableTime2Interrupt
void Time2Interrupt(void) interrupt 5
{ TF2=0;
}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -