📄 mcu.c
字号:
j=7;
// LED_GrnOff();
}
// LED_RedOff();
// break;
while((Row1()==0)||(Row2()==0)||(Row3()==0))
{
CLRWDT = 0x55;
}
j = 5;
// Sleep(50);
}
}
switch(k)
{
case 4:{
m=1;
break;
}
case 5:{
m=2;
break;
}
case 6:{
m=3;
break;
}
case 7:{
m=4;
break;
}
default:
{
m=0;
h=0;
}
// case 7:m=4;
}
line1h();
line2h();
line3h();
line4h();
if(m==0)
{
return 0;
}
else
{
return (h*10+m);
}
//return(n);
}
void line1l()
{
Byte Port;
Port = PTD_REG;
Port |= RDPD_REG;
Port &= ~PD3;
PTD_REG = Port;
}
void line2l()
{
Byte Port;
Port = PTD_REG;
Port |= RDPD_REG;
Port &= ~PD4;
PTD_REG = Port;
}
void line3l()
{
Byte Port;
Port = PTD_REG;
Port |= RDPD_REG;
Port &= ~PD5;
PTD_REG = Port;
}
void line4l()
{
Byte Port;
Port = PTD_REG;
Port |= RDPD_REG;
Port &= ~PD6;
PTD_REG = Port;
}
void line1h()
{
Byte Port;
Port = PTD_REG;
Port |= RDPD_REG;
Port |= PD3;
PTD_REG = Port;
}
void line2h()
{
Byte Port;
Port = PTD_REG;
Port |= RDPD_REG;
Port |= PD4;
PTD_REG = Port;
}
void line3h()
{
Byte Port;
Port = PTD_REG;
Port |= RDPD_REG;
Port |= PD5;
PTD_REG = Port;
}
void line4h()
{
Byte Port;
Port = PTD_REG;
Port |= RDPD_REG;
Port |= PD6;
PTD_REG = Port;
}
bit Row1()
{
bit m;
Byte Port;
RDPD_REG |=PD0;
Port = PTD_REG;
if((Port & PD0)!=0)
{
m=1;
}
else
{
m=0;
}
return m;
}
bit Row2()
{
bit m;
Byte Port;
RDPD_REG |=PD1;
Port = PTD_REG;
if((Port & PD1)!=0)
{
m=1;
}
else
{
m=0;
}
return m;
}
bit Row3()
{
bit m;
Byte Port;
RDPD_REG |=PD2;
Port = PTD_REG;
if((Port & PD2)!=0)
{
m=1;
}
else
{
m=0;
}
return m;
}
//==========================================
void Sleep(Word T)
{
Word i,j;
for(j=0;j<T;j++)
for(i=0;i<53*(CPU_CLK/20000000);i++)
CLRWDT=0x55;
}
/*==========================================
==========================================*/
void WaitSetup(unsigned short time)
{
LocalTimer = time; /* timeout n ms */
while(LocalTimer != 0){
// CheckModeChange();
}
}
/*==========================================
==========================================*/
bit DetectBacklight()
{
//return I_OBackLightStatus;
return 1;
}
/*==========================================
==========================================*/
void PanelPowerOn(void)
{
//I_OXRSTLow;
I_OLCDSTBLow;
Sleep(10);
//I_OXRSTHigh;
I_OLCDSTBHigh;
//I_OPanelPowerHigh;
}
/*==========================================
==========================================*/
void ResetScaler(void)
{
I_OResetOn;
Sleep(12);
I_OResetOff;
Sleep(50);
WriteIIC563(0x101, 0x20);
Sleep(12);
WriteIIC563(0x101, 0x0f);
}
/*==========================================
==========================================*/
bit DetectIRQ()
{
return !(PTB_REG & PB2);
// return 0;
}
/*==========================================
==========================================*/
void IntGroup1(void) interrupt 2 using 1
{
if(INT_SRC & INT_EXT){
if(INTEXT_FLG & INTE0){
if(FastMuteEnable){
I_OBackLightLow;
if(SyncMode <3){ //add by kevin 92/10/21 if ysnc mode in sep/com/SOG -->COM
// INTEXT_EN = INTE1; // Disable interrupt INT0 enable INT1
FLG_Change_SyncMode=1;
}
}
Abort = 1; //abort autotune
if(ChangeMode<10)
ChangeMode++;
INTEXT_FLG = INTE0;
}
/*
if(INTEXT_FLG & INTE1){
INTEXT_FLG = INTE1;
I_OBackLightLow;
WarmUp(); //reset system
}
*/
}
}
void LED_GrnOff(void)
{
unsigned char port;
port = PTC_REG;
port |= RDPC_REG;
port |= PC1;
PTC_REG = port;
}
void LED_GrnOn(void)
{
unsigned char port;
port = PTC_REG;
port |= RDPC_REG;
port &= ~PC1;
PTC_REG = port;
}
void LED_RedOff(void)
{
unsigned char port;
port = PTC_REG;
port |= RDPC_REG;
port |= PC0;
PTC_REG = port;
}
void LED_RedOn(void)
{
unsigned char port;
port = PTC_REG;
port |= RDPC_REG;
port &= ~PC0;
PTC_REG = port;
}
void PowNavOn()
{
Byte Port;
Port = PTC_REG;
Port |= RDPC_REG;
Port |= PC7;
PTC_REG = Port;
}
void PowNavOff()
{
Byte Port;
Port = PTC_REG;
Port |= RDPC_REG;
Port &= ~PC7;
PTC_REG = Port;
}
void Pow3On()
{
Byte Port;
Port = PTC_REG;
Port |= RDPC_REG;
Port &= ~PC5;
PTC_REG = Port;
}
void Pow3Off()
{
Byte Port;
Port = PTC_REG;
Port |= RDPC_REG;
Port |= PC5;
PTC_REG = Port;
}
void Pow5On()
{
Byte Port;
Port = PTC_REG;
Port |= RDPC_REG;
Port &= ~PC6;
PTC_REG = Port;
}
void Pow5Off()
{
Byte Port;
Port = PTC_REG;
Port |= RDPC_REG;
Port &= ~PC6;
PTC_REG = Port;
}
void Pow9On()
{
Byte Port;
Port = PTC_REG;
Port |= RDPC_REG;
Port &= ~PC3;
PTC_REG = Port;
}
void Pow9Off()
{
Byte Port;
Port = PTC_REG;
Port |= RDPC_REG;
Port |= PC3;
PTC_REG = Port;
}
void Pow5150On()
{
Byte Port;
Port = PTC_REG;
Port |= RDPC_REG;
Port |= PC2;
PTC_REG = Port;
}
void Pow5150Off()
{
Byte Port;
Port = PTC_REG;
Port |= RDPC_REG;
Port &= ~PC2;
PTC_REG = Port;
}
void ResetVideoOn()
{
Byte Port;
Port = PTB_REG;
Port |= RDPB_REG;
Port &= ~PB1;
PTB_REG = Port;
}
void ResetVideoOff()
{
Byte Port;
Port = PTB_REG;
Port |= RDPB_REG;
Port |= PB1;
PTB_REG = Port;
}
void DrivePowOn()
{
Byte Port;
Port = PTA_REG;
Port |= RDPA_REG;
Port |= PA5;
PTA_REG = Port;
}
void DrivePowOff()
{
Byte Port;
Port = PTA_REG;
Port |= RDPA_REG;
Port &= ~PA5;
PTA_REG = Port;
}
void RestScalOn()
{
Byte Port;
Port = PTC_REG;
Port |= RDPC_REG;
Port &= ~PC4;
PTC_REG = Port;
}
void RestScalOff()
{
Byte Port;
Port = PTC_REG;
Port |= RDPC_REG;
Port |= PC4;
PTC_REG = Port;
}
void SetMenu()
{
Byte Port;
Port = PTA_REG;
Port |= RDPA_REG;
Port &= ~PA7;
PTA_REG = Port;
}
void ResetMenu()
{
Byte Port;
Port = PTA_REG;
Port |= RDPA_REG;
Port |= PA7;
PTA_REG = Port;
}
bit NavMcu()
{
bit m;
Byte Port;
RDPB_REG |=0x08;
Port = PTB_REG;
if((Port & PB3)!=0)
{
m=1;
}
else
{
m=0;
}
return m;
}
void BackLightOn(void)
{
Byte Port;
Port = PTE_REG;
Port |= RDPE_REG;
Port |= PE1;
PTE_REG = Port;
}
void BackLightOff(void)
{
Byte Port;
Port = PTE_REG;
Port |= RDPE_REG;
Port &= ~PE1;
PTE_REG = Port;
}
void MuteStby0ff(void)
{
Byte Port;
Port = PTD_REG;
Port |= RDPD_REG;
Port |= PD6;
PTD_REG = Port;
}
void MuteStbyOn(void)
{
Byte Port;
Port = PTD_REG;
Port |= RDPD_REG;
Port &= ~PD6;
PTD_REG = Port;
}
bit KeyInput1(void) // pin31 seek_up
{
bit m;
Byte Port;
RDPD_REG |=0x08;
Port = PTD_REG;
if((Port & PD3)!=0)
{
m=1;
}
else
{
m=0;
}
return m;
}
bit KeyInput2(void) // pin 30 seek_down
{
bit m;
Byte Port;
RDPD_REG |=0x10;
Port = PTD_REG;
if((Port & PD4)!=0)
{
m=1;
}
else
{
m=0;
}
return m;
}
bit KeyInput3(void) //pin 29
{
bit m;
Byte Port;
RDPD_REG |=0x20;
Port = PTD_REG;
if((Port & PD5)!=0)
{
m=1;
}
else
{
m=0;
}
return m;
}
bit StopIn(void)
{
bit m;
Byte Port;
RDPC_REG |=0x08;
Port = PTC_REG;
if((Port & PC3)!=0)
{
m=1;
}
else
{
m=0;
}
return m;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -