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

📄 c_root.c

📁 T103的开发程序 能兼容很多屏 可根据需要修改定义
💻 C
字号:
/*------------------------------------------------------------------------------
C_ROOT.C

Copyright 1995-1996 Keil Software, Inc.
------------------------------------------------------------------------------*/

#include <reg51.h>
#include "Common.h"
#include "Global.h"
#include "ICControl.h"
#include "Initial.h"
#include "System.h"
#include "TWICreg.h"
#include "Timer0.h"
#include "VideoSourceSwitch.h"
#include "VideoDetect.h"
#include "OSD1CSL.h"
#include "OSD2CSL.h"
#include "E_OSDString.H"
#include "Keypad.h"
#include "EventPass.h"
#include "com.h" 
#include "UIDraw.h"
#define  _Myson8957_
#include "Myson8957.h"
/*****************************************************************************
*                  Public Function Prototypes		       		     		 *
*****************************************************************************/

void SysInterruptEnable(void);

static uWORD AutoDetcTime=0;
sbit VIDEO_RESET = P3^6;	//T108 Reset pin by CS8957
sbit CHIP_RESET = P1^3;

void main(void) {
  int i,j;				   // for ISP delay in RESET key press.

  WTST = 10;			   //Myson Program wait state setting.
  P1=0x00;				   // P1 for LOW on OSCilloscope
  for(i=0;i<1000;i++)
    for(j=0;j<1000;j++);
  P1=0xFF;				   // P1 for High on OSCilloscope
  PADMOD2=0x00;
  
	VIDEO_RESET = 0;	   // Reset pin process
	for(i=0;i<1000;i++)	; 
    VIDEO_RESET = 1;	   // T108 and CHIP... reset
	CHIP_RESET = 0;
	for(i=0;i<1000;i++)	; 
    CHIP_RESET = 1;	

	Initial();
	
#ifdef DEBUG_MODE
ShowMsg("Initial Step####\n\0");
#endif	
	
	EepPublic.cSource=0;
	SourceSelect();
	SysInterruptEnable();
	DetectSignalStd();
	Detect_Sig(0);	
	Show_Source();

	font_draw_string("hello world\x0fe", 5, 4);
		
	P1 &= 0xfc;   //LED Green Lite.
	
	while(1)
	{	 
		  
		PoolingINT(); /* polling ir, keypad */
#if 1
		// detect adc key 
		byMTV_ADCINT = 0x00; // Disable INT
		byMTV_ADCSET = 0x01; // clock divider speed
		byMTV_ADCEN1 = 0x80; // ADC Enable b7. 
		byMTV_ADCEN2 = 0x18; // ADC ch3,4 select
		byMTV_ADCINT = 0x80; // ADC Int Enable
		while(!(byMTV_ADCEN1 = 0x01)); // Until ADC ready flag
		font_draw_hex_number((byMTV_ADC3H & 0x0f), 10, 5);
		font_draw_hex_number(byMTV_ADC3L, 12, 5);
		font_draw_hex_number((byMTV_ADC4H & 0x0f), 10, 7);
		font_draw_hex_number(byMTV_ADC4L, 12, 7);
#endif

#ifdef AUTO_DETECT
		AutoDetcTime++; 
		if(AutoDetcTime>=0x4ff)
		{
//			unsigned char adc;

			/* detect input source */
			AutoDetcTime=0x00;
			if (uiaSrcMux1[EepPublic.cSource].SourceRoute==isrcVIDEO)
				DetectSignalStd();
			Detect_Sig(0);
			IC_WritByte(TWIC_P0, 0xE2, 0x11);


			
			//adc = 127;
			//font_draw_dec_number(ADC_Result_H, 5, 6);
			//font_draw_dec_number(ADC_Result_L, 6, 6);
			/*
			if (adc>0 && adc<0x10) m_cCurreKey = REMOTE_KEY_MENU;
			else if (adc > 0x3f)   m_cCurreKey = 0;
			*/
		}
#endif		
	
		if(m_bTimer0Overflow)
		{
			m_bTimer0Overflow=0;
			Timer0Stop();
			OSD2Disable();
			OSD1Disable();
		}		
		if(m_cCurreKey!=0) 
			EventPass();	
			
	}
}
void SysInterruptEnable(void)
{		 
	//IC_WritByte(TWIC_P0, INTMASK_REG, IC_ReadByte(TWIC_P0,INTMASK_REG)&0xF0);
	IC_WritByte(TWIC_P0,INSTS2_REG,0x01);	
	Timer0Reset();
	ET0 = 1; 	// Enable Timer0 interrupt
	TR0 = 0;  
	EX0 = 1;    // Enable Externel Interrup 0
	EA	= 1;	// Enable Interrupt

	byMTV_ADCSET = 0x01; // clock divider speed
	byMTV_ADCEN1 = 0x80; // ADC Enable b7. 
	byMTV_ADCEN2 = 0x18; // ADC ch3,4 select
	byMTV_ADCINT = 0x80; // ADC Int Enable
	while(!(byMTV_ADCEN1 = 0x01)); // Until ADC ready flag

}

void CpuADCISR(void) interrupt 2	
{
	byMTV_ADCINT = 0x00; // Disable INT
#if 0	
	/* print debug message */
	font_draw_dec_number((byMTV_ADC3H & 0x0f), 5, 5);
	font_draw_dec_number(byMTV_ADC3L, 5, 6);
	font_draw_hex_number((byMTV_ADC3H & 0x0f), 10, 5);
	font_draw_hex_number(byMTV_ADC3L, 10, 6);
	font_draw_dec_number((byMTV_ADC4H & 0x0f), 5, 7);
	font_draw_dec_number( byMTV_ADC4L, 5, 8);		
	font_draw_hex_number((byMTV_ADC4H & 0x0f), 10, 7);
	font_draw_hex_number( byMTV_ADC4L, 10, 8);
#endif	
	byMTV_ADCINT = 0x80; // Enable INT
}

⌨️ 快捷键说明

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