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

📄 tvtuner.h

📁 OSD 学习学习.天天向上.STUDY STUDY DAY DAY UP.
💻 H
字号:

#ifndef _TVTUNE_H_
#define _TVTUNE_H_
// MACRO DEFINE
#define  OSD_HYPHEN0  	0x0070
#define  OSD_HYPHEN1  	0x0071
#define  OSD_HYPHEN2  	0x0072
#define  OSD_HYPHEN3  	0x0073

#define TVTUNE_CTRL_WORD1    0x86
#define TVTUNE_CTRL_WORD2    

#define TVTUNE_STATUS_ADDR   0xc1		//MA1 MA0   00

#define WIRELESS_TV_CH0      0x0000
#define WIRELESS_TV_CH1      0x0000
#define WIRELESS_TV_CH2      0x0650
#define WIRELESS_TV_CH3      0x06b0
#define WIRELESS_TV_CH4      0x0710
#define WIRELESS_TV_CH5      0x07b0
#define WIRELESS_TV_CH6      0x0810
#define WIRELESS_TV_CH7      0x0dd0
#define WIRELESS_TV_CH8      0x0e30
#define WIRELESS_TV_CH9      0x0e90
#define WIRELESS_TV_CH10    0x0ef0
#define WIRELESS_TV_CH11    0x0f50
#define WIRELESS_TV_CH12    0x0fb0
#define WIRELESS_TV_CH13    0x1010
#define WIRELESS_TV_CH14    0x2050
#define WIRELESS_TV_CH15    0x20b0
#define WIRELESS_TV_CH16    0x2110
#define WIRELESS_TV_CH17    0x2170
#define WIRELESS_TV_CH18    0x21d0
#define WIRELESS_TV_CH19    0x2230
#define WIRELESS_TV_CH20    0x2290
#define WIRELESS_TV_CH21    0x22f0
#define WIRELESS_TV_CH22    0x2350
#define WIRELESS_TV_CH23    0x23b0
#define WIRELESS_TV_CH24    0x2410
#define WIRELESS_TV_CH25    0x2470
#define WIRELESS_TV_CH26    0x24d0
#define WIRELESS_TV_CH27    0x2530
#define WIRELESS_TV_CH28    0x2590
#define WIRELESS_TV_CH29    0x25f0
#define WIRELESS_TV_CH30    0x2650
#define WIRELESS_TV_CH31    0x26b0
#define WIRELESS_TV_CH32    0x2710
#define WIRELESS_TV_CH33    0x2770
#define WIRELESS_TV_CH34    0x27d0
#define WIRELESS_TV_CH35    0x2830
#define WIRELESS_TV_CH36    0x2890
#define WIRELESS_TV_CH37    0x28f0
#define WIRELESS_TV_CH38    0x2950
#define WIRELESS_TV_CH39    0x29b0       
#define WIRELESS_TV_CH40    0x2a10
#define WIRELESS_TV_CH41    0x2a70
#define WIRELESS_TV_CH42    0x2ad0
#define WIRELESS_TV_CH43    0x2b30
#define WIRELESS_TV_CH44    0x2b90
#define WIRELESS_TV_CH45    0x2bf0
#define WIRELESS_TV_CH46    0x2c50
#define WIRELESS_TV_CH47    0x2cb0
#define WIRELESS_TV_CH48    0x2d10
#define WIRELESS_TV_CH49    0x2d70
#define WIRELESS_TV_CH50    0x2dd0
#define WIRELESS_TV_CH51    0x2e30
#define WIRELESS_TV_CH52    0x2e90
#define WIRELESS_TV_CH53    0x2ef0
#define WIRELESS_TV_CH54    0x2f50
#define WIRELESS_TV_CH55    0x2fb0
#define WIRELESS_TV_CH56    0x3010
#define WIRELESS_TV_CH57    0x3070
#define WIRELESS_TV_CH58    0x30d0
#define WIRELESS_TV_CH59    0x3130
#define WIRELESS_TV_CH60    0x3190
#define WIRELESS_TV_CH61    0x31f0
#define WIRELESS_TV_CH62    0x3250
#define WIRELESS_TV_CH63    0x32b0
#define WIRELESS_TV_CH64    0x3310
#define WIRELESS_TV_CH65    0x3370
#define WIRELESS_TV_CH66    0x33d0
#define WIRELESS_TV_CH67    0x3430
#define WIRELESS_TV_CH68    0x3490
#define WIRELESS_TV_CH69    0x34f0

#define WIRELESS_TV_PAL_CH1      0x0574
#define WIRELESS_TV_PAL_CH2      0x05f4
#define WIRELESS_TV_PAL_CH3      0x067c
#define WIRELESS_TV_PAL_CH4      0x0734
#define WIRELESS_TV_PAL_CH5      0x07b4
#define WIRELESS_TV_PAL_CH6      0x0964
#define WIRELESS_TV_PAL_CH7      0x09e4
#define WIRELESS_TV_PAL_CH8      0x0a64
#define WIRELESS_TV_PAL_CH9    0x0ae4
#define WIRELESS_TV_PAL_CH10    0x0b64
#define WIRELESS_TV_PAL_CH11    0x0be4
#define WIRELESS_TV_PAL_CH12    0x0c64
#define WIRELESS_TV_PAL_CH13    0x0ce4

#define WIRELESS_TV_PAL_CH14    0x0d64
#define WIRELESS_TV_PAL_CH15    0x0de4
#define WIRELESS_TV_PAL_CH16    0x0e64
#define WIRELESS_TV_PAL_CH17    0x0ee4
#define WIRELESS_TV_PAL_CH18    0x0f64
#define WIRELESS_TV_PAL_CH19    0x0fe4
#define WIRELESS_TV_PAL_CH20    0x1064
#define WIRELESS_TV_PAL_CH21    0x10e4
#define WIRELESS_TV_PAL_CH22    0x1164
#define WIRELESS_TV_PAL_CH23    0x11e4
#define WIRELESS_TV_PAL_CH24    0x1264
#define WIRELESS_TV_PAL_CH25    0x12e4
#define WIRELESS_TV_PAL_CH26    0x1364
#define WIRELESS_TV_PAL_CH27    0x13e4
#define WIRELESS_TV_PAL_CH28    0x1464
#define WIRELESS_TV_PAL_CH29    0x14e4
#define WIRELESS_TV_PAL_CH30    0x1564
#define WIRELESS_TV_PAL_CH31    0x15e4
#define WIRELESS_TV_PAL_CH32    0x1664
#define WIRELESS_TV_PAL_CH33    0x16e4
#define WIRELESS_TV_PAL_CH34    0x1764
#define WIRELESS_TV_PAL_CH35    0x17e4
#define WIRELESS_TV_PAL_CH36    0x1864
#define WIRELESS_TV_PAL_CH37    0x18e4
#define WIRELESS_TV_PAL_CH38    0x1964      
#define WIRELESS_TV_PAL_CH39    0x19e4
#define WIRELESS_TV_PAL_CH40    0x1a64
#define WIRELESS_TV_PAL_CH41    0x1ae4
#define WIRELESS_TV_PAL_CH42    0x1b64
#define WIRELESS_TV_PAL_CH43    0x1be4
#define WIRELESS_TV_PAL_CH44    0x1c64
#define WIRELESS_TV_PAL_CH45    0x1ce4
#define WIRELESS_TV_PAL_CH46    0x1d64
#define WIRELESS_TV_PAL_CH47    0x1de4
#define WIRELESS_TV_PAL_CH48    0x1e64
#define WIRELESS_TV_PAL_CH49    0x1ee4

#define WIRELESS_TV_PAL_CH50    0x1f64
#define WIRELESS_TV_PAL_CH51    0x1fd4
#define WIRELESS_TV_PAL_CH52    0x2054
#define WIRELESS_TV_PAL_CH53    0x20d4
#define WIRELESS_TV_PAL_CH54    0x2154
#define WIRELESS_TV_PAL_CH55    0x21d4
#define WIRELESS_TV_PAL_CH56    0x2254
#define WIRELESS_TV_PAL_CH57    0x22d4
#define WIRELESS_TV_PAL_CH58    0x2354
#define WIRELESS_TV_PAL_CH59    0x23d4
#define WIRELESS_TV_PAL_CH60    0x2454
#define WIRELESS_TV_PAL_CH61    0x24d4
#define WIRELESS_TV_PAL_CH62    0x2554
#define WIRELESS_TV_PAL_CH63    0x2854
#define WIRELESS_TV_PAL_CH64    0x28d4
#define WIRELESS_TV_PAL_CH65    0x2954
#define WIRELESS_TV_PAL_CH66    0x29d4
#define WIRELESS_TV_PAL_CH67    0x2a54
#define WIRELESS_TV_PAL_CH68    0x2ad4

#define WIRELESS_TV_PAL_CH69    0x2b54

#define WIRELESS_TV_PAL_CH70    0x2bd4
#define WIRELESS_TV_PAL_CH71    0x2c54
#define WIRELESS_TV_PAL_CH72    0x2cd4
#define WIRELESS_TV_PAL_CH73    0x2d54
#define WIRELESS_TV_PAL_CH74    0x2dd4
#define WIRELESS_TV_PAL_CH75    0x2e54
#define WIRELESS_TV_PAL_CH76    0x2ed4
#define WIRELESS_TV_PAL_CH77    0x2f54
#define WIRELESS_TV_PAL_CH78    0x2fd4
#define WIRELESS_TV_PAL_CH79    0x3054
#define WIRELESS_TV_PAL_CH80    0x30d4
#define WIRELESS_TV_PAL_CH81    0x3154
#define WIRELESS_TV_PAL_CH82    0x31d4
#define WIRELESS_TV_PAL_CH83    0x3254
#define WIRELESS_TV_PAL_CH84    0x32d4
#define WIRELESS_TV_PAL_CH85    0x3354
#define WIRELESS_TV_PAL_CH86    0x33d4
#define WIRELESS_TV_PAL_CH87    0x3454
#define WIRELESS_TV_PAL_CH88    0x34d4
#define WIRELESS_TV_PAL_CH89    0x3554
#define WIRELESS_TV_PAL_CH90    0x35d4
#define WIRELESS_TV_PAL_CH91    0x3654
#define WIRELESS_TV_PAL_CH92    0x36d4
#define WIRELESS_TV_PAL_CH93    0x3754
#define WIRELESS_TV_PAL_CH94    0x37d4
#define WIRELESS_TV_PAL_CH95    0x3854

#define SYS_NTSC

#ifdef  SYS_NTSC
#define  TOTAL_BAND_LENGTH   69
#define  VHF_L_BAND_LENGTH   6
#define  VHF_H_BAND_LENGTH   7
#define  UHF_BAND_LENGTH   	56
#else
#define  TOTAL_BAND_LENGTH   95
#define  VHF_L_BAND_LENGTH   13
#define  VHF_H_BAND_LENGTH   36
#define  UHF_BAND_LENGTH   	46
#endif
//**************************************************************************
#ifdef  SYS_NTSC
code int Wireless_Tv_channel_tbl[69]={WIRELESS_TV_CH1,
WIRELESS_TV_CH2,WIRELESS_TV_CH3,WIRELESS_TV_CH4,WIRELESS_TV_CH5,
WIRELESS_TV_CH6,WIRELESS_TV_CH7,WIRELESS_TV_CH8,WIRELESS_TV_CH9,
WIRELESS_TV_CH10,WIRELESS_TV_CH11,WIRELESS_TV_CH12,WIRELESS_TV_CH13,
WIRELESS_TV_CH14,WIRELESS_TV_CH15,WIRELESS_TV_CH16,WIRELESS_TV_CH17,
WIRELESS_TV_CH18,WIRELESS_TV_CH19,WIRELESS_TV_CH20,WIRELESS_TV_CH21,
WIRELESS_TV_CH22,WIRELESS_TV_CH23,WIRELESS_TV_CH24,WIRELESS_TV_CH25,
WIRELESS_TV_CH26,WIRELESS_TV_CH27,WIRELESS_TV_CH28,WIRELESS_TV_CH29,
WIRELESS_TV_CH30,WIRELESS_TV_CH31,WIRELESS_TV_CH32,WIRELESS_TV_CH33,
WIRELESS_TV_CH34,WIRELESS_TV_CH35,WIRELESS_TV_CH36,WIRELESS_TV_CH37,
WIRELESS_TV_CH38,WIRELESS_TV_CH39,WIRELESS_TV_CH40,WIRELESS_TV_CH41,
WIRELESS_TV_CH42,WIRELESS_TV_CH43,WIRELESS_TV_CH44,WIRELESS_TV_CH45,
WIRELESS_TV_CH46,WIRELESS_TV_CH47,WIRELESS_TV_CH48,WIRELESS_TV_CH49,
WIRELESS_TV_CH50,WIRELESS_TV_CH51,WIRELESS_TV_CH52,WIRELESS_TV_CH53,
WIRELESS_TV_CH54,WIRELESS_TV_CH55,WIRELESS_TV_CH56,WIRELESS_TV_CH57,
WIRELESS_TV_CH58,WIRELESS_TV_CH59,WIRELESS_TV_CH60,WIRELESS_TV_CH61,
WIRELESS_TV_CH62,WIRELESS_TV_CH63,WIRELESS_TV_CH64,WIRELESS_TV_CH65,
WIRELESS_TV_CH66,WIRELESS_TV_CH67,WIRELESS_TV_CH68,WIRELESS_TV_CH69,
};
#else
code int Wireless_Tv_channel_tbl[95]={
WIRELESS_TV_PAL_CH1,WIRELESS_TV_PAL_CH2,WIRELESS_TV_PAL_CH3,WIRELESS_TV_PAL_CH4,
WIRELESS_TV_PAL_CH5,WIRELESS_TV_PAL_CH6,WIRELESS_TV_PAL_CH7,WIRELESS_TV_PAL_CH8,
WIRELESS_TV_PAL_CH9,WIRELESS_TV_PAL_CH10,WIRELESS_TV_PAL_CH11,WIRELESS_TV_PAL_CH12,
WIRELESS_TV_PAL_CH13,WIRELESS_TV_PAL_CH14,WIRELESS_TV_PAL_CH15,WIRELESS_TV_PAL_CH16,
WIRELESS_TV_PAL_CH17,WIRELESS_TV_PAL_CH18,WIRELESS_TV_PAL_CH19,WIRELESS_TV_PAL_CH20,
WIRELESS_TV_PAL_CH21,WIRELESS_TV_PAL_CH22,WIRELESS_TV_PAL_CH23,WIRELESS_TV_PAL_CH24,
WIRELESS_TV_PAL_CH25,WIRELESS_TV_PAL_CH26,WIRELESS_TV_PAL_CH27,WIRELESS_TV_PAL_CH28,
WIRELESS_TV_PAL_CH29,WIRELESS_TV_PAL_CH30,WIRELESS_TV_PAL_CH31,WIRELESS_TV_PAL_CH32,
WIRELESS_TV_PAL_CH33,WIRELESS_TV_PAL_CH34,WIRELESS_TV_PAL_CH35,WIRELESS_TV_PAL_CH36,
WIRELESS_TV_PAL_CH37,WIRELESS_TV_PAL_CH38,WIRELESS_TV_PAL_CH39,WIRELESS_TV_PAL_CH40,
WIRELESS_TV_PAL_CH41,WIRELESS_TV_PAL_CH42,WIRELESS_TV_PAL_CH43,WIRELESS_TV_PAL_CH44,
WIRELESS_TV_PAL_CH45,WIRELESS_TV_PAL_CH46,WIRELESS_TV_PAL_CH47,WIRELESS_TV_PAL_CH48,
WIRELESS_TV_PAL_CH49,WIRELESS_TV_PAL_CH50,WIRELESS_TV_PAL_CH51,WIRELESS_TV_PAL_CH52,
WIRELESS_TV_PAL_CH53,WIRELESS_TV_PAL_CH54,WIRELESS_TV_PAL_CH55,WIRELESS_TV_PAL_CH56,
WIRELESS_TV_PAL_CH57,WIRELESS_TV_PAL_CH58,WIRELESS_TV_PAL_CH59,WIRELESS_TV_PAL_CH60,
WIRELESS_TV_PAL_CH61,WIRELESS_TV_PAL_CH62,WIRELESS_TV_PAL_CH63,WIRELESS_TV_PAL_CH64,
WIRELESS_TV_PAL_CH65,WIRELESS_TV_PAL_CH66,WIRELESS_TV_PAL_CH67,WIRELESS_TV_PAL_CH68,
WIRELESS_TV_PAL_CH69,WIRELESS_TV_PAL_CH70,WIRELESS_TV_PAL_CH71,WIRELESS_TV_PAL_CH72,
WIRELESS_TV_PAL_CH73,WIRELESS_TV_PAL_CH74,WIRELESS_TV_PAL_CH75,WIRELESS_TV_PAL_CH76,
WIRELESS_TV_PAL_CH77,WIRELESS_TV_PAL_CH78,WIRELESS_TV_PAL_CH79,WIRELESS_TV_PAL_CH80,
WIRELESS_TV_PAL_CH81,WIRELESS_TV_PAL_CH82,WIRELESS_TV_PAL_CH83,WIRELESS_TV_PAL_CH84,
WIRELESS_TV_PAL_CH85,WIRELESS_TV_PAL_CH86,WIRELESS_TV_PAL_CH87,WIRELESS_TV_PAL_CH88,
WIRELESS_TV_PAL_CH89,WIRELESS_TV_PAL_CH90,WIRELESS_TV_PAL_CH91,WIRELESS_TV_PAL_CH92,
WIRELESS_TV_PAL_CH93,WIRELESS_TV_PAL_CH94,WIRELESS_TV_PAL_CH95
};
#endif
typedef struct 
{
	unsigned char   num0;
	unsigned char   num1;
	unsigned char  num2;
}CHANNEL_NUM;
union  UNIT
{
	unsigned char *char_num;
	unsigned int     int_num;
};
static data CHANNEL_NUM  Channel_Num={0,0,0};
static unsigned char data cur_ch_num=0;
static unsigned char data total_ch_num=0;
static unsigned char data vhfl_ch_num=0;
static unsigned char data vhfh_ch_num=0;
static unsigned char data uhf_ch_num=0;
static unsigned char val_zero=0;
//***************************************************
//FOR VIDEO SW
sbit		AVSW1	 =P3^4;
sbit		AVSW2	 =P3^5;
sbit		TV_VIDEO_EXIST	 =P1^7;
sbit		U1369_RESET_PIN	 =P0^7;
sbit		POWER_RESUME_KEY_PIN=P1^2;
//***************************************************
code  unsigned char hex2bcd[] = {
    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,	/* 00-09 */
    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,	/* 10-19 */
    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,	/* 20-29 */
    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,	/* 30-39 */
    0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,	/* 40-49 */
    0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,	/* 50-59 */
    0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,	/* 60-69 */
    0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,	/* 70-79 */
    0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,	/* 80-89 */
    0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,	/* 90-99 */
};
//***************************************************************************
//varibles
unsigned char data player_status=  0;//PLAYER_STATUS_DVD;
unsigned char Display_Mode=0;
bit f_osd_displaying=0;
bit f_osd_ch_displaying=0;
static unsigned char current_playing_channel=0xff;
bit f_last_videoinput=1;
//***************************************************************************
//extern varibles
extern bit _fgVfdKeyValid;
extern bit _fgIRKeyValid;
extern code unsigned int num_digit[16];
extern unsigned char data _IR_key;
extern unsigned char _VFD_Key;
unsigned char _IR_Post_Key=0xff;
sbit	POWER_CTRL_PIN =P1^1;
sbit 	PIN_MUTE1=P0^6;
sbit 	PIN_MUTE2=P2^4;
extern bit f_timer_2s;
extern unsigned char timer1_counter;
extern unsigned char f_timer_2s_ch;
extern unsigned char timer1_counter_ch;
extern unsigned char timer1_counter1;
//***************************************************************************
//local  function
void Process_Tv_Osd(void);
void Tv_Process_key(void);
unsigned char  Proc_Digit_Input_Tv_Channel();
void Proc_Key_Digit_Key(unsigned char Key);
void Proc_Key_Tv_Search();
void Proc_Key_Tv_Dvd();
void Proc_Key_Power();
void Proc_Key_Next_Ch();
void Proc_Key_Prev_Ch();
void Proc_Key_Tv_Menu();
void Proc_Key_Display();

void Sub_Display_Searching_bar(unsigned char band_flag,unsigned char searching_num);
void Sub_Display_Searching_num(unsigned char band_flag);
void Sub_Set_Channel();	
void Video_Output_Input_SW();
void Video_Output_TV_SW();
void Video_Output_DVD_SW();
void Proc_Key_Tv_Search_Return();
//**************************************************************************** 
//extern funcion
extern void Write24c02(unsigned char *Wdata,unsigned char RomAddress,unsigned char number) ;
extern void Read24c02(unsigned char *RamAddress,unsigned char RomAddress,unsigned char bytes);
extern void Read_Tv_tune(unsigned char *RamAddress) ;
extern void Write_Tv_tune(unsigned int Wdata,unsigned char freq_flag);

extern void Send_CR_Set(unsigned char video_flag) ;  // 1-> no video
extern void M35055_Display_line(unsigned  char  line_num,unsigned char Flag_content);
extern void M35055_Display_a_char(unsigned int Addr,unsigned int A_char);
extern void Clear_All_Osd();	

extern void Send_Key_To_IR();
extern void Send_IR_Head();
extern void Send_IR_SysCode();
extern void Send_IR_CustomCode();

extern void U1369_Reset();
extern void DelayMs(unsigned int number);
extern void m35055_init();
extern void VFD_init();
extern void Player_Power_On_Off();
#endif


⌨️ 快捷键说明

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