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

📄 mcu.c

📁 NT68521源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
			LED_GrnOn();
		}
	    else{
			OSD_OFF();
			PowerStatus &= ~BIT_7;	//power off
			Write24C16(0xcc,PowerStatus);
			if((flag3 & BIT_0) != 0)
			{
				Write24C16(0xcd,0x00);	//disable burn in mode
				flag3 &= ~BIT_0;
			}
			PowerSaving();
			DIG_Off();
			DIV_PWND();
			LED_RedOn();
			LED_GrnOff();
		}
		break;
	case UpKey:  //UpKey
		if(OSD_Type==1)
		{
			if(PowerStatus == 0x80)
			{
				UnselectIcon();
				if(OSD_Point1 == 0)
				{
					if(++OSD_Point2 > 12)
						OSD_Point2 = 0;
					if(SyncMode == 3)
						if((OSD_Point2 > 1)&&(OSD_Point2 < 6))
							OSD_Point2 = 6;
					if((flag2 & BIT_5) != 0)
						if((OSD_Point2 > 7)&&(OSD_Point2 < 11))
							OSD_Point2 = 11;
				}
				else
				{
					if(++OSD_Point2 > 22)
						OSD_Point2 = 13;
				}
				ShowSubMenu();
			}
			else
			{
				VideoUnSelectIcon();
				if(OSD_Point1 == 0)
				{	if(++OSD_Point2 > 10)
						OSD_Point2 = 0;
				}
				ShowVideoSubMenu();
			}
		}
		else
			ChannelPlus();

		Timer2 = (unsigned short)OSD_Timer * 100;
		KeyBuffer = 0xff;
		break;
	case DownKey:  //DownKey
//*/
		if(OSD_Type==1)
		{
			if(PowerStatus == 0x80)
			{
				UnselectIcon();
				if(OSD_Point1 == 0)
				{
					if(--OSD_Point2 == 0xff)
						OSD_Point2 = 12;
					if(SyncMode == 3)
						if((OSD_Point2 > 1)&&(OSD_Point2 < 6))
							OSD_Point2 = 6;
					if((flag2 & BIT_5) != 0)
						if((OSD_Point2 > 7)&&(OSD_Point2 < 11))
							OSD_Point2 = 7;
				}
				else
				{
					if(--OSD_Point2 <13)
						OSD_Point2 = 22;
				}
				ShowSubMenu();
			}
			else
			{
				VideoUnSelectIcon();
				if(OSD_Point1 == 0)
				{	if(--OSD_Point2 == 0xff)
						OSD_Point2 = 10;
				}
				ShowVideoSubMenu();
			}
		}
		else
			ChannelMinus();
//*/
//		IRCode = 0x0d;
		Timer2 = (unsigned short)OSD_Timer * 100;
		KeyBuffer = 0xff;
		break;
	case MenuKey:		//MENU
		MenuFlag = ~MenuFlag;
		if(MenuFlag)
		{
			if(PowerStatus == 0x80)
				MainMenu();	
			else
				VideoMenu();
		}
		else
			OSD_OFF();
			
		KeyBuffer = 0xff;
		Timer2 = (unsigned short)OSD_Timer * 100;
		break;
	case LeftKey:	//LeftKey
		if(PowerStatus == 0x80)
			ValueDown();
		else
			VideoValueDown();
		Timer2 = (unsigned short)OSD_Timer * 100;
		break;
	case RightKey:	//RightKey
		if(PowerStatus == 0x80)
			ValueUp();
		else
			VideoValueUp();
		Timer2 = (unsigned short)OSD_Timer * 100;
		break;
	case SourceKey:			//Select
		if((DeviceFlag & BIT_0) != 0)
		{		// video version
			if(++PowerStatus > 0x83){
				PowerStatus = 0x80;
			}
			Write24C16(0xcc,PowerStatus);
			SourceSelect();
		}
		KeyBuffer = 0xff;
		break;
	}
}

void LED_RedOn(void)
{
unsigned char port;
	port = PortA;
	port |= RDPA_REG;
	port |= BIT_1;
	PortA = port;
}

void LED_RedOff(void)
{
unsigned char port;
	port = PortA;
	port |= RDPA_REG;
	port &= ~BIT_1;
	PortA = port;
}

void LED_GrnOn(void)
{
unsigned char port;
	port = PortA;
	port |= RDPA_REG;
	port |= BIT_2;
	PortA = port;
}

void LED_GrnOff(void)
{
unsigned char port;
	port = PortA;
	port |= RDPA_REG;
	port &= ~BIT_2;
	PortA = port;
}
/*
void MirrorPanel(bit fz)
{
unsigned char port;
	port = PortD;
	port |= RDPD_REG;
	if(fz)
		port |= BIT_3;
	else
		port &= ~BIT_3;
	PortD = port;
}

void FlipPanel(bit fz)
{
unsigned char port;
	port = PortD;
	port |= RDPD_REG;
	if(fz)
		port |= BIT_4;
	else
		port &= ~BIT_4;
	PortD = port;
}
*/
void VolumeSwitch(unsigned char ss)
{
unsigned char port;
	port = PortA;
	port |= RDPA_REG;
	if(ss==1)
		port |= BIT_0;
	else if(ss==0)
		port &= ~BIT_0;
	PortA = port;
}

void BackLightOn(void)
{
unsigned char port;
	port = PortC;
	port |= RDPC_REG;
	port |= BIT_0;
	PortC = port;
}

void BackLightOff(void)
{
unsigned char port;
	port = PortC;
	port |= RDPC_REG;
	port &= ~BIT_0;
	PortC = port;
	MuteTimer = 0;
}

#if PanelPowerActive == High
void PanelPowerOff(void)
{
unsigned char port;
//+3V3
	port = PortC;
	port |= RDPC_REG;
	port |= BIT_1;
	PortC = port;
	Sleep(5);
//+12V
	port |= BIT_7;
	PortC = port;
}

void PanelPowerOn(void)
{
unsigned char port;
//+12V
	port = PortC;
	port |= RDPC_REG;
	port &= ~BIT_7;
	PortC = port;
//+3V3
	port &= ~BIT_1;
	PortC = port;
}
#else
void PanelPowerOff(void)
{
unsigned char port;
	port = PortC;
	port |= RDPC_REG;
//	port |= BIT_7;
	port |= 0x82;
	PortC = port;
}

void PanelPowerOn(void)
{
unsigned char port;
	port = PortC;
	port |= RDPC_REG;
//	port &= ~BIT_7;
	port &= 0x7d;
	PortC = port;
}
#endif

void ResetOff(void)
{
unsigned char port;
	port = PortC;
	port |= RDPC_REG;
	port |= BIT_4;
	PortC = port;
}

void ResetOn(void)
{
unsigned char port;
	port = PortC;
	port |= RDPC_REG;
	port &= ~BIT_4;
	PortC = port;
}

void AUDIO_MUTE(void)
{
unsigned char port;
	PWM_REG[11] = 0;
	port = PortC;
	port |= RDPC_REG;
	port |= BIT_3;
	PortC = port;
}

void AUDIO_On(void)
{
unsigned char port;
	PWM_REG[11] = Volume * 2 + Volume / 2;
	port = PortC;
	port |= RDPC_REG;
	port &= ~BIT_3;
	PortC = port;
}

void AMP_STBY(void)
{
unsigned char port;
	port = PortC;
	port |= RDPC_REG;
	port |= BIT_5;
	PortC = port;
}

void AMP_On(void)
{
unsigned char port;
	port = PortC;
	port |= RDPC_REG;
	port &= ~BIT_5;
	PortC = port;
}

void DIG_SEL(void)
{
}

void DIG_Off(void)
{
}

void DVI_On(void)
{
}

void DIV_PWND(void)
{
}

void VideoEnable(void)
{
unsigned char port;
	port = PortB;
	port |= RDPB_REG;
	port |= BIT_3;
	PortB = port;
}

void VideoDisable(void)
{
unsigned char port;
	port = PortB;
	port |= RDPB_REG;
	port &= ~BIT_3;
	PortB = port;
}
/*
void IntGroup1(void) interrupt 2 using 3
{
unsigned char intcase,DataBuf;
//	P2 = 0xF0;
	if((INT_SRC & INTIIC0_IRQ) != 0){
		intcase = INTIIC0_FLG;
		if(intcase & INTA){
			DataBuf = IIC0_DATA;
			INTIIC0_FLG = (INTA | INTRX);
			if((DataBuf & 0xFE) == NOVATEK_Addr){
				if(IIC0_CON & SRW){  // Slave Addr || 0x01 ==> Read
					IIC0_DATA = CmdTxBuffer[0];

//					IIC0_DATA = CmdTxBuffer[CmdTxPtr1++];
//					if(CmdTxPtr1 > 63)
//						CmdTxPtr1 = 0;

				}
				else{  // Slave Addr ==> Write
//					CmdPtr1 = 0;
//					CmdPtr2 = 0;
				}
			}
			flag3 |= BIT_6;
		}
		else if(intcase & INTTX){
			INTIIC0_FLG = INTTX;
				IIC0_DATA = CmdTxBuffer[0];

//				IIC0_DATA = CmdTxBuffer[CmdTxPtr1++];
//				if(CmdTxPtr1 > 63)
//					CmdTxPtr1 = 0;

		}
		else if(intcase & INTRX){
			INTIIC0_FLG = INTRX;
			CmdRxBuffer[CmdRxPtr1++] = IIC0_DATA;
			if(CmdRxPtr1 > 63)
				CmdRxPtr1 = 0;
		} 
		else if(intcase & INTNAK){
			INTIIC0_FLG = INTNAK;
		}
		else if(intcase & INTSTOP){
			INTIIC0_FLG = INTSTOP;
			flag3 |= BIT_7;
			flag3 &= ~BIT_6;
		}
	}
	else{
		if((PortA & BIT_7) == 0){
			if(KeyPad2 < 0x02){
				KeyPad2++;
			}
			else if(KeyPad2 == 0x80){
				KeyPad2 = 0x01;
			}
			else if(KeyPad2 > 0x81){
				KeyPad2--;
			}
		}
		else{
			if((KeyPad2 > 0x7f)&&(KeyPad2 < 0x82)){
				KeyPad2++;
			}
			else if(KeyPad2 == 0x00){
				KeyPad2 = 0x81;
			}
			else if(KeyPad2 > 0x01){
				KeyPad2--;
			}
		}
		INTEXT_FLG = INTE0;
	}
}
*/
void CheckDDC2Bi(void)
{
unsigned char cmd;//,i,j;
	if((flag3 & BIT_7) != 0){
		CmdTxBuffer[0] = 0;
		while(CmdRxPtr1 != CmdRxPtr2){
			cmd = CmdRxBuffer[CmdRxPtr2++];
			if(CmdRxPtr2 > 63)
				CmdRxPtr2 = 0;
			CheckCmd(cmd);
		}
		flag3 &= ~BIT_7;
	}
}

void ShowMute(void)
{
code unsigned char MuteString[]={ 2,0x22,0x23 };
	OSD_Type = 6;
	Osd3Init();
	WriteWordIIC_HW(Scaler_Addr,0xcc,ChannelColor);
	WriteXY_StrScaler(1,0,0,MuteString);
	WriteXY_StrScaler(1,2,0,SourceTab[5]);  //clear red icon
	WriteXY_StrScaler(1,8,0,SourceTab[4]);
	OSD_Control |= BIT_0;
	WriteIIC_HW(Scaler_Addr,0x95,OSD_Control);
}

void DirectMute(void)
{
//	if(PowerStatus != 0x80)
//	{
		if((flag3 & BIT_4) == 0)//bit 4 : Mute
		{
			AUDIO_MUTE();
			MuteFlag = 1;
			ShowMute();
			flag3 |= BIT_4;
		}
		else
		{
			if(Volume != 0)
				AUDIO_On();   //CANCEL AUDIO MUTE
			MuteFlag = 0;
			flag3 &= ~BIT_4;
			OSD_OFF();
		}
//	}
}

⌨️ 快捷键说明

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