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

📄 int.c

📁 一个LCD TV的源程序, 用的是realtek的IC
💻 C
字号:
/*******************************************************************************
  INT.C
  Copyright (c) Himax, Inc. All rights reserved.
*******************************************************************************/
#include "intrins.h"
#include "MCU_IO.h"
#include "COMMON.H"
#include "Key.H"
#include "MAIN.H"
#include "i2c_control.h"
#include "HX8824.h"
#include "OSD.h"
#include "rs232.h"
#include "MATH.h"

/*==============================================================================
  User Define
==============================================================================*/
/*
typedef struct IRCODE
{
  unsigned char ready;
  unsigned char index;
  unsigned int h_period;
  unsigned int l_period;
  unsigned char command;
};
*/
struct IRCODE Remote_Code;
/*==============================================================================
  Function: Timer0 interrupt operation
==============================================================================*/
void Int0 (void) interrupt 0
{

  static unsigned long RCode;
  unsigned long command_a, command_b;

  if(Remote_Code.index == 0)
  {
    Remote_Code.index = 1;
    TR1 = ET1 = 1;    // start timer1, enable timer1 interrupt
  }
  else
  {
    if(Remote_Code.index == 1)
    {
      if((abs(Remote_Code.l_period - 90) < 3) && (abs(Remote_Code.h_period - 45) < 3))   //check single click header 9msL 4.5msH
        Remote_Code.index = 2;
      else
      {
        if((abs(Remote_Code.l_period - 90) < 3) && (abs(Remote_Code.h_period - 22) < 3)) //check repeat header 9msL 2.2msH
        {
          Remote_Code.ready = 1;
        }
        Remote_Code.index = 0;
      }
    }
    else//capture data (1==>0.56msL+1.69msH) (0==>0.56msL+0.56msH)
    {
      RCode >>= 1;
      if((abs(Remote_Code.l_period - 6) < 3) && (abs(Remote_Code.h_period - 17) < 3))
        RCode |= 0x80000000;
      if(++Remote_Code.index == 34)
      {
        TR1 = ET1 = 0;
        if(((RCode % 0x00010000) == REMOTE_SYS1) || ((RCode % 0x00010000) == REMOTE_SYS2))
        {
          command_a = RCode / 0x00010000;
          command_b = command_a / 0x100;
          command_a = command_a % 0x100;
          if((command_a + command_b) == 0xff)
          {
            Remote_Code.command = command_a;
            Remote_Code.ready = 1;
            if(Remote_Code.command == 0)//Fake Code 00
              Remote_Code.command = 0xff;
          }
        }
        Remote_Code.index = 0;
      }
    }
  }
  Remote_Code.h_period=Remote_Code.l_period = 0;
}
/* ================================================================
    Name    : Timer0
    Purpose : Timer0 interrupt operation
    Passed  : None
    Notes   : None
   ================================================================ */

void Timer0(void) interrupt 1
{

  //---For OSD Timer and Power Saving Timer---//
  if(Osd_Status==1)
  {
    Counter++;
    //Puts_UART("counter = ");HexTobyStr(Counter);Puts_UART(byStr);Puts_UART("\r\n");
  }

  if(Counter==10)
  {
    Second++;
    Counter=0;
    if(Second==OSD_Time)
    {
      bosdtimeout=1; // time out, OSD disappear
      Second=0;
    }
  }

// 2002 01 09 phase test
  //---For Keyboard---//
  KeyTimerCounter++;
  if(bkey_fast)
  {
    if(KeyTimerCounter > 10)            //200
      bkeypress = KeyTimerCounter = 0;
  }
  else
  {
    if(KeyTimerCounter > 160)           //1600
      bkeypress = KeyTimerCounter = 0;
  }
}

/* ================================================================
    Name    : INT1
    Purpose :
    Passed  : None
    Notes   : None
   ================================================================ */
/*
void INT1(void) interrupt 2
{
// remove to EXCEP.C
}
*/

/* ================================================================
    Name    : Serial
    Purpose :
    Passed  : None
    Notes   : None
   ================================================================ */
/*
void Serial(void) interrupt 4
{
}
*/
/* ================================================================
    Name    : T0_int
    Purpose :
    Passed  : None
    Notes   : None
   ================================================================ */
/*
void T0_int() interrupt 1
{
    TH0 = (8192 - 5000)/32;
    TL0 = (8192 - 5000)%32;
    if(--timer_cnt == 0)
    {
        timer_cnt = 100;
        LEDR = ~LEDR;
    }
}
*/
/*==============================================================================
  Function: Timer1 interrupt operation
==============================================================================*/
void Timer1(void) interrupt 3
{

  static unsigned char FreeKeyCounter;

  if(RX_ON)
    Remote_Code.h_period++;
  else
    Remote_Code.l_period++;

  if(Remote_Code.h_period > 1080)
  {//no key pressed
    Remote_Code.index = 0;
    Remote_Code.command = REMOTE_NULL;
    Remote_Code.ready = 1;
    if(++FreeKeyCounter == 2)//no key pressed for 3 cycle
      TR1 = ET1 = 0;
  }
  else
  {
    FreeKeyCounter = 0;
  }
}

⌨️ 快捷键说明

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