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

📄 exper.c

📁 我使用的是MYSON的MTV412 MCU+MTV048
💻 C
📖 第 1 页 / 共 5 页
字号:
	   //break;
	  }
	}
	SecondMenuFlg=1;
}

void AdjustHORR()
{
        ResetKey();
        ClearOSD();
        OpenOSDWindow(2,5,2,18,8,3,0);
        ShowHORRBoard();
        WaitKeyup();//**********************
	while(KeyLayer3!=0)
	{
	 gotoxy(10,3);
	 PrintDecCode(HORRAddDec,red);
	 if((KeySelect1==1)&&(KeyLayer3==1))
	  {
	   delay(50);
	   HORRAddDec+=1;
	   if(HORRAddDec==128)
	    HORRAddDec=32;
	   SendOSDCmd(15,15,HORRAddDec);
           ResetKey();
	  }
	 if((KeySelect2==1)&&(KeyLayer3==1))
	  {
	   delay(50);
	   HORRAddDec-=1;
	   if(HORRAddDec==31)
	    HORRAddDec=127;
	   SendOSDCmd(15,15,HORRAddDec);
	   ResetKey();
	  }
	 if((KeySelect6==1)&&(KeyLayer3==1))
          {
           delay(150);
           
           KeyLayer3=0;
           KeyLayer2=1;
           //KeyLayer1=0;
           WaitKeyup();//**************
           SecondMenuFlg=1;
           //MainMenuFlg=0;
           ClearOSD();
           }
        }
         SecondMenuFlg=1;
         //MainMenuFlg=0;     
}
void PrintString(uchar *string,uchar Stringlen,uchar color)
{
	uchar i=0,buf[4];
	buf[0]=0x7a;
	for(i=0;i<Stringlen;i++)
	{
	 buf[1]=CursorY|0x80;
   	 buf[2]=CursorX;
   	 buf[3]=string[i];
   	 SendIIC(buf,4);
      
   	 buf[1]|=0xa0;
   	 buf[3]=color; 
   	 SendIIC(buf,4);

   	 CursorX++;
   	 if(CursorX>29)
      	  {
       	   CursorX=0;
       	   CursorY++;
      	  }
 
   	 if(CursorY>14) 
      	  CursorY=0; 
	}
		
}

void AdiustVert()
{
    int i;
	ResetKey();
	 OpenOSDWindow(3,6,1,21,8,cyan,0);
	 gotoxy(6,2);
	 PrintString(statusVHValue,8,green);
	 gotoxy(11,2);
	 PrintDecCode(VertPosition,red);
     gotoxy(7,5);	
	 for(i=0;i<12;i++)
	  Putuserchar(VertPSW1[i],yellow);
	 gotoxy(7,6);	
	 for(i=0;i<12;i++)
	  Putuserchar(VertPSW2[i],yellow);
	 gotoxy(7,7);
	 for(i=0;i<8;i++)
	  PutChar(VertPSW6[i],yellow);
	 WaitKeyup();//*************************8
	while(KeyLayer3!=0)
	{
	 
      if((KeySelect1==1)&&(KeyLayer3==1))
	  {
	   delay(50);
	   VertPosition-=1;
	   SendOSDCmd(15,12,VertPosition);
	   //CloseOSDWindow(3);
	   gotoxy(11,2);
	   PrintDecCode(VertPosition,red);
	   ResetKey();
	  }
	 if((KeySelect2==1)&&(KeyLayer3==1))
	  {
	   delay(50);
	   VertPosition+=1;
	   SendOSDCmd(15,12,VertPosition);
	   //CloseOSDWindow(3);
	   gotoxy(11,2);
	   PrintDecCode(VertPosition,red);
	   ResetKey();
	  }
	 if((KeySelect6==1)&&(KeyLayer3==1))
	  {
	   delay(150);
          
	   KeyLayer3=0;
	   KeyLayer2=1;
	   WaitKeyup();//**************
	   SecondMenuFlg=1;
	   ClearOSD();
	  }
	}
	SecondMenuFlg=1;
}

void AdiustHorr()
{
	int i;
    ResetKey();
	 OpenOSDWindow(3,6,1,21,8,cyan,0);
	 gotoxy(6,2);
	 PrintString(statusHValue,5,green);
	 gotoxy(11,2);
	 PrintDecCode(HorrPosition,red);
     gotoxy(7,5);	
	 for(i=0;i<12;i++)
	  Putuserchar(HorrPSW1[i],yellow);
	 gotoxy(7,6);	
	 for(i=0;i<12;i++)
	  Putuserchar(HorrPSW2[i],yellow);
	 gotoxy(7,7);
	 for(i=0;i<8;i++)
	  PutChar(HorrPSW6[i],yellow);
	 WaitKeyup();//*************************
	while(KeyLayer3!=0)
	{
	 
      if((KeySelect1==1)&&(KeyLayer3==1))
	   {
	    delay(50);
	    HorrPosition+=1;
	    SendOSDCmd(15,13,HorrPosition);
	    //CloseOSDWindow(3);
		gotoxy(11,2);
	    PrintDecCode(HorrPosition,red);
	    ResetKey();
	   }
	  if((KeySelect2==1)&&(KeyLayer3==1))
	   {
	    delay(50);
	    HorrPosition-=1;
	    SendOSDCmd(15,13,HorrPosition);
	    //CloseOSDWindow(3);
		gotoxy(11,2);
	    PrintDecCode(HorrPosition,red);
	    ResetKey();
	   }
	  if((KeySelect6==1)&&(KeyLayer3==1))
	   {
	    delay(150);
	    
        KeyLayer3=0;
	    KeyLayer2=1;
	    WaitKeyup();//**************
	    SecondMenuFlg=1;
	    ClearOSD();
	   }
	}
	SecondMenuFlg=1;
}

void ShowSecondModuleTest()
{
   
	ResetKey();
	ClearOSD();
	ShowVertHorr();
	WaitKeyup();//***********************8
	do
	{
	 if((KeySelect1==1)&&(KeyLayer2==1))
	  {
	   delay(50);
	   ClearOSD();
	   KeyLayer2=0;
	   KeyLayer3=1;
	   ResetKey();
	   AdiustVert();
	  }
	 if((KeySelect2==1)&&(KeyLayer2==1))
	  {
	   delay(50);
	   ClearOSD();
	   KeyLayer2=0;
	   KeyLayer3=1;
	   AdiustHorr();
	  }
	 if((KeySelect6==1)&&(KeyLayer2==1))
	  {
	   delay(200);
           
	   KeyLayer2=0;
	   KeyLayer1=1;
	   WaitKeyup();//**************
	   ClearOSD();
	  }
	 if(SecondMenuFlg==1)
	  {
	   ShowVertHorr();
	   SecondMenuFlg=0;
	  }
	}while(KeyLayer2!=0);
	SecondMenuFlg=0;
	MainMenuFlg=1;
}
void ShowVCOHORRTest()
{
	ResetKey();
	ClearOSD();
	ShowVCOHORR();
	WaitKeyup();//***************************888888
	do
	{
	 if((KeySelect1==1)&&(KeyLayer2==1))
	  {
	   delay(200);
	   KeyLayer2=0;
	   KeyLayer3=1;
	   ResetKey();
       AdjustVCO();
	  }
	 if((KeySelect2==1)&&(KeyLayer2==1))
	  {
	   delay(250);
	   ResetKey();
	   KeyLayer2=0;
	   KeyLayer3=1;
	   //ResetKey();
       AdjustHORR();
	  }
	 if((KeySelect6==1)&&(KeyLayer2==1))
	  {
	   delay(200);    
	   KeyLayer2=0;
	   KeyLayer1=1;
	   WaitKeyup();//**************	   
	   ClearOSD();
	   //break;
	  }
	 if(SecondMenuFlg==1)
	  {
	   ShowVCOHORR();
	   SecondMenuFlg=0;
	  }
	}while(KeyLayer2!=0);
	SecondMenuFlg=0;
	MainMenuFlg=1;
}
void ResetKey()
{
	KeySelect1=0;
	KeySelect2=0;
	KeySelect3=0;
	KeySelect4=0;
	KeySelect5=0;
	KeySelect6=0;
}

void WaitKeyup()//waitting for the key up
{
 ResetKey();
 while(1)
 	{ResetKey();
     delay(30);
     if((KeySelect1==0)&&(KeySelect2==0)&&(KeySelect3==0)&&(KeySelect4==0)&&(KeySelect5==0)&&(KeySelect6==0))
       break;
    }


}
//----------------------------------------------------
void ShowMain()
{
  ClearOSD();
  /*
  switch(Freqflag)
	 {
	  case 1:
	    InitOSD31();
		break;
	  case 2:
	    InitOSD47();
		break;
	  case 3:
	    InitOSD63();
		break;
	  case 4:
	    InitOSD95();
		break;
	 }*/
  InitOSD();
  TurnOSD(1);
  OpenOSDWindow(2,3,1,23,9,blue,0);
  OpenOSDWindow(1,3,2,23,7,cyan,0);
  gotoxy(7,1);
  PrintString(mysonlogo,13,red);
  gotoxy(4,2);
  PrintString(ShowOSDFontall,18,yellow);
  gotoxy(4,3);
  PrintString(Showhorrvcoad,19,yellow);
  gotoxy(4,4);
  PrintString(Showposad,19,yellow);
  gotoxy(4,5);
  PrintString(ShowInISPMode,18,yellow);
  gotoxy(4,6);
  PrintString(Showdemo,14,yellow);
  gotoxy(4,7);
  PrintString(HorrPSW6,8,yellow);
  gotoxy(4,8);
  PrintString(DemoBoard,15,white);
  gotoxy(4,9);
  PrintString(WebSite1,16,white);
  KeyLayer1=1;
}
/*
void Initmoudletest31(void)
{
   VertPosition=0x20;
   HorrPosition=0x0b;
   ChHeight=0x05;
  SendHORR(0x0b,0x20,0x05,0x42,0x28);

  uchar i;
  uchar buf[4];
  SendOSDCmd(15,18,0x42);//important for mtv021
  SendOSDCmd(15,15,0x28);
  delay(50);
  SendOSDCmd(15,19,0x00);
  SendOSDCmd(15,12,0x20);
  SendOSDCmd(15,13,0x0b);
  SendOSDCmd(15,16,0);
  //SendOSDCmd(15,20,0x00);
  SendOSDCmd(15,14,0x05);//this is important

  buf[0]=0x7a;                                    
  buf[2]=30;                                      //  column
  buf[3]=0x10;                    //Select background color bits and no double size of characters 
  for(i=0;i<=14;i++)                               //  row value(0-14
   {                                             //
    buf[1]= ( 0x80 | i );                        //
    SendIIC(buf,4);                              //
   }                                            // Row Attribute
  for(i=0;i<4;i++)
    CloseOSDWindow(i);
}
void Initmoudletest47(void)
{
 VertPosition=0x39;
 HorrPosition=0x09;
 ChHeight=0x05;
 SendHORR(0x09,0x39,0x05,0x42,0x28);
}
void Initmoudletest63(void)
{
 VertPosition=0x55;
 HorrPosition=0x06;
 ChHeight=0x05;
 SendHORR(0x06,0x55,0x05,0x42,0x28);
}
void Initmoudletest95(void)
{
 VertPosition=0x75;
 HorrPosition=0x06;
 ChHeight=0x05;
 SendHORR(0x06,0x75,0x05,0x42,0x28);
}*/
void AnyKeyExit(void)
{
 ResetKey();
 while(1)
 {
  if(KeySelect1==1)
   {
    ResetKey();
    delay(50);
    break;
   }
  if(KeySelect2==1)
   {
    ResetKey();
    delay(50);
    break;
   }
  if(KeySelect3==1)
   {
    ResetKey();
    delay(50);
    break;
   }
  if(KeySelect4==1)
   {
    ResetKey();
    delay(50);
    break;
   }
  if(KeySelect5==1)
   {
    ResetKey();
    delay(50);
    break;
   }
  if(KeySelect6==1)
   {
    ResetKey();
    delay(150);
    break;
   }
 }
 ClearOSD();
 delay(100);
}
void ShowColor(uchar col,uchar stringnum,uchar string[],uchar color)
{
 uint i,j;
 for(j=0;j<2;j++)
 {
  gotoxy(col+j,1);
  for(i=0;i<stringnum;i++)
   {
    PutCharVert(string[i],color);
   }
 }
}
void OSDColorDemo(void)
{
 uint i; 
 
 ClearOSD();
 //InitMoudletest();
 OpenOSDWindow(3,2,0,27,9,green,0);
 OpenOSDWindow(2,15,1,27,8,blue,0);
 OpenOSDWindow(1,2,1,14,8,magent,0);
 gotoxy(8,0);
 PrintString(Title_color,15,white);
 ShowColor(3,5,White,white);
 ShowColor(6,3,Red,red);
 ShowColor(9,5,Green,green);
 ShowColor(12,4,Blue,blue);
 ShowColor(16,5,Black,black);
 ShowColor(19,6,Yellow,yellow);
 ShowColor(22,4,Cyan,cyan);
 ShowColor(25,6,Magent,magent);
 gotoxy(7,9);
 PrintString(Multi_color,17,white);
 OpenOSDWindow(0,2,10,27,14,magent,0);
 //SendOSDCmd(16,3,0x0f);
 gotoxy(8,12);
 for(i=112;i<128;i++)
  {
    //if(i==496)
     //gotoxy(8,13);
    PutPage2Char(i,white);
  }
/*  gotoxy(0,14);
  PrintString(FrameSw1,9,white);
  gotoxy(10,14);
  PrintString(FrameSw2,6,white);
  gotoxy(18,14);
  PrintString(FrameSw4,12,white);*/
 /*
 for(i=112;i<128;i++)
   PutPage2Char(i,white);
 */
 
 KeyControl();//detect the keyprss 

 
}

void OSDSizeDemo()
{
 uint i;
 uchar buf[4]; 
 
 ClearOSD();
 //InitOSD();
 //TurnOSD(1);
 buf[0]=0x7a;
 buf[2]=30;
 for(i=0;i<4;i++)
 {
  buf[3]=i;
  buf[1]=( 0x80 | (i+1));
  SendIIC(buf,4);
 }
 OpenOSDWindow(2,2,0,29,0,green,0);
 OpenOSDWindow(1,2,1,29,5,cyan,0);
 gotoxy(9,0);
 PrintString(Charactersize,14,white);
 gotoxy(9,1);
 for(i=0;i<11;i++)
  PutChar(Normalsize[i],yellow);
 gotoxy(4,2);
 PrintString(Doublewidth,23,0x01);
 gotoxy(9,3);
 for(i=0;i<12;i++)
  PutChar(Doublehight[i],magent);
 gotoxy(4,4);
 PrintString(Doublehw,23,0x04);
 gotoxy(22,4);
 PutChar(comma,0x04); 
/*  gotoxy(0,14);
  PrintString(FrameSw1,9,white);
  gotoxy(10,14);
  PrintString(FrameSw2,6,white);
  gotoxy(18,14);
  PrintString(FrameSw4,12,white);*/

 KeyControl();//detect the keyprss 

 ClearOSD(); 
 buf[0]=0x7a;                                    
 buf[2]=30;                                      //  column
 buf[3]=0x10;                    //Select background color bits and no double size of characters 
  for(i=0;i<=14;i++)                               //  row value(0-14
   {                                             //
    buf[1]= ( 0x80 | i );                        //
    SendIIC(buf,4);                              //
   }               
}
void OSDWinDemo()
{
 int i,j;
 
 ClearOSD();
 //Initmoudletest31();
 ResetKey();
 SendOSDCmd(15,21,0x55);
 SendOSDCmd(15,22,0xaa);

 gotoxy(6,0);
 PrintString(Winsizingp,22,0x07);
 
    for(j=3;j>=0;j--)
    {
     for(i=0;i<8;i++)
      {
       OpenOSDWindow(j,13-i,7-i,21+i,7+i,j+1,1);         //Zoom in
       delay(40);
    //AnyKeyExit();
      }
    }
    delay(80);
    //Initmoudletest31();
    //SendOSDCmd(15,21,0x55);
    //SendOSDCmd(15,22,0xaa);
    for(j=3;j>=0;j--)
    { 
     for(i=0;i<5;i++)
      {
       OpenOSDWindow(j,4-i,0,25-i,14,j+2,1);            //Move Left
       delay(40);
      }
    }
    delay(80);
    for(j=3;j>=0;j--)
    {

⌨️ 快捷键说明

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