?? exper.c
字號:
delay_short(2);
return(err);
}
/* Send data to OSD control registers, using format A,
send 1 byte a time */
void SendOSDCmd(uchar row, uchar column,uchar value)
{
uchar buf[4];
buf[0]=0x7a; // Slave address of OSD IC
buf[1]=row|0xa0;
buf[2]=column&0x3f; // Mask upper 2 bits
buf[3]=value;
SendIIC(buf,4);
}
// Open an OSD window with coordinate and color, set OSDWidowStatus[WinNo]=1
// shadow:0 =no, 1= yes
void OpenOSDWindow(uchar WinNo,uchar LeftX,uchar LeftY, uchar RightX, uchar RightY, uchar color,bit shadow)
{
SendOSDCmd(15, WinNo*3, (LeftY<<4) | RightY );
SendOSDCmd(15, WinNo*3+1, (LeftX<<3) | 4 | ( (uchar ) shadow ) );
SendOSDCmd(15, WinNo*3+2, (RightX<<3) | ( color& 0x7) );
// OSDWindowStatus[WinNo]=1;
}
// Close the OSD window of number WinNo, set the OSDWindowStatus[WinNo]=0
void CloseOSDWindow(uchar WinNo)
{
SendOSDCmd(15,WinNo*3+1,0);
// OSDWindowStatus[WinNo]=0;
}
/*
void CloseAllOSDWindow()
{
uchar i;
for(i=0;i<4;i++)
{
CloseOSDWindow(i);
}
}*/
void InitOSD()
{
switch(Freqflag)
{
case 1:
//Initmoudletest31();
InitOSD31();
break;
case 2:
//Initmoudletest47();
InitOSD47();
break;
case 3:
//Initmoudletest63();
InitOSD63();
break;
case 4:
//Initmoudletest95();
InitOSD95();
break;
}
}
void InitOSD63()
{
uchar i;
uchar buf[4];
SendOSDCmd(15,16,0); //Defint the row to row spacing
ClearOSD();
VertPosition=85;
HorrPosition=42;
ChHeight=0x30;
SendOSDCmd(15,12,VertPosition);
SendOSDCmd(15,13,HorrPosition);
SendOSDCmd(15,14,ChHeight);
SendOSDCmd(15,15,HORRAddDec);
SendOSDCmd(15,18,0x4c|VCOAddDec);//0x4c--Select 12*18 font size and accept positive Hsync or
// Vsync input
SendOSDCmd(15,19,0); //Define the color of bordering or shadowing on characters
SendOSDCmd(15,20,0x0); //Define the self-test pattern polarity
SendOSDCmd(15,21,0); //Determine the shadow width of windows
SendOSDCmd(15,22,0); //Determine the shadow height of windows
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 InitOSD31()
{
uchar i;
uchar buf[4];
SendOSDCmd(15,16,0); //Defint the row to row spacing
ClearOSD();
VertPosition=36;
HorrPosition=45;
ChHeight=0x05;
SendOSDCmd(15,12,VertPosition);
SendOSDCmd(15,13,HorrPosition);
SendOSDCmd(15,14,ChHeight);
SendOSDCmd(15,15,HORRAddDec);
SendOSDCmd(15,18,0x4c|VCOAddDec);//0x4c--Select 12*18 font size and accept positive Hsync or
// Vsync input
SendOSDCmd(15,19,0); //Define the color of bordering or shadowing on characters
SendOSDCmd(15,20,0x0); //Define the self-test pattern polarity
SendOSDCmd(15,21,0); //Determine the shadow width of windows
SendOSDCmd(15,22,0); //Determine the shadow height of windows
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 InitOSD47()
{
uchar i;
uchar buf[4];
SendOSDCmd(15,16,0); //Defint the row to row spacing
ClearOSD();
VertPosition=55;
HorrPosition=44;
ChHeight=0x30;
SendOSDCmd(15,12,VertPosition);
SendOSDCmd(15,13,HorrPosition);
SendOSDCmd(15,14,ChHeight);
SendOSDCmd(15,15,HORRAddDec);
SendOSDCmd(15,18,0x4c|VCOAddDec);//0x4c--Select 12*18 font size and accept positive Hsync or
// Vsync input
SendOSDCmd(15,19,0); //Define the color of bordering or shadowing on characters
SendOSDCmd(15,20,0x0); //Define the self-test pattern polarity
SendOSDCmd(15,21,0); //Determine the shadow width of windows
SendOSDCmd(15,22,0); //Determine the shadow height of windows
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 InitOSD95()
{
uchar i;
uchar buf[4];
SendOSDCmd(15,16,0); //Defint the row to row spacing
ClearOSD();
VertPosition=95;
HorrPosition=42;
ChHeight=0x30;
SendOSDCmd(15,12,VertPosition);
SendOSDCmd(15,13,HorrPosition);
SendOSDCmd(15,14,ChHeight);
SendOSDCmd(15,15,HORRAddDec);
SendOSDCmd(15,18,0x4c|VCOAddDec);//0x4c--Select 12*18 font size and accept positive Hsync or
// Vsync input
SendOSDCmd(15,19,0); //Define the color of bordering or shadowing on characters
SendOSDCmd(15,20,0x0); //Define the self-test pattern polarity
SendOSDCmd(15,21,0); //Determine the shadow width of windows
SendOSDCmd(15,22,0); //Determine the shadow height of windows
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);
}
// Turn On/OFF OSD, status==0: off, status==1: on
void TurnOSD(bit status)
{
OSD_C17 &=0x80;
OSD_C17 |= ( ( (uchar ) status ) <<7 ) ;
OSD_C17 |= 0x40;
OSD_C17 |= 0x20;
//OSD_C17 |=0x78;
SendOSDCmd(15,17,OSD_C17);
OSD_status=status;
}
// Clear all RAM data, attribute and close all windows
void ClearOSD()
{
uchar i;
bit j;
for(i=0;i<4;i++)
CloseOSDWindow(i);
j=OSD_status;
SendOSDCmd(15,17,2); //Set RAMCLR
delay(1);
SendOSDCmd(15,17,0);
TurnOSD(j);
gotoxy(0,0);
}
// Set virtual cursor location to ( x,y )
void gotoxy(uchar x, uchar y)
{
CursorX=x; //column
CursorY=y; //row
}
/*
// Put a byte in hex onto OSD screen
void PutHex(uchar da, uchar color)
{
uchar buf[3];
buf[2]=0;
buf[0]=( (da>>4) & 0x0f ) + 0x30;
buf[1]=( da&0x0f ) +0x30;
if( buf[0]>0x39 )
buf[0]+=7;
if( buf[1]>0x39 )
buf[1]+=7;
print(buf,color);
}
*/
void Putuserchar(uchar da, uchar color)
{
if (da<252)
PutChar(da,color);
else
PutPage2Char(da-148,color);
}
// Put a char in hex onto OSD screen
void PutChar(uchar da, uchar color)
{
uchar buf[4];
buf[0]=0x7a;
buf[1]=CursorY|0x80;
buf[2]=CursorX;
buf[3]=da;
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 PutCharVert(uchar da, uchar color)
{
uchar buf[4];
buf[0]=0x7a;
buf[1]=CursorY|0x80;
buf[2]=CursorX;
buf[3]=da;
SendIIC(buf,4);
buf[1]|=0xa0;
buf[3]=color;
SendIIC(buf,4);
CursorY++;
if(CursorY>14)
{
CursorY=0;
CursorX++;
}
if(CursorX>29)
CursorX=0;
}
/*
// Print a string stored in string[], with attribute
void print(uchar *string, uchar attribute)
{
uchar i=0;
uchar buf[4];
buf[0]=0x7a;
while(string[i]!=0)
{
if( string[i] =='\n')
{
CursorX=0;
CursorY++;
if(CursorY>14)
CursorY=14;
}
else
{
buf[1]=CursorY|0x80;
buf[2]=CursorX;
buf[3]=string[i];
SendIIC(buf,4);
buf[1]|=0xa0;
buf[3]=attribute;
SendIIC(buf,4);
CursorX++;
if(CursorX>29)
{
CursorX=0;
CursorY++;
}
if(CursorY>14)
CursorY=0;
}
i++;
}
} */
/*
uchar WaitDDC1Header()
{
uchar i;
int j;
XRAM[HV_INTFLG]=0xfe; //clear Vsync
i=0;
j=0;
while (i<55)
{
while ((XRAM[HV_INTFLG]&01)!=0x01);
XRAM[HV_INTFLG]=0xfe; //clear Vsync
delay(2);
if ((P1&0x20)==0x20) i++;
else i=0;
j++;
if (j>=1250) return (0x77);
}
return (0);
}
int ReadDDC1()
{
uchar i;
int temp;
i=0;
temp=0;
while (i<9)
{
while ((XRAM[HV_INTFLG]&01)!=0x01);
XRAM[HV_INTFLG]=0xfe; //clear Vsync
delay(2);
if ((i==8)&&((P1&0x20)==0x00)) temp|=0x0f00;
if (i<8)
{
temp=(temp<<1)&0xfe;
if ((P1&0x20)==0x20) temp|=0x01;
}
i++;
}
return(temp);
}
*/
void ShowVCOHORR()
{
int i;
ClearOSD();
OpenOSDWindow(2,5,0,21,8,3,0);
gotoxy(6,1);
for(i=0;i<12;i++)
PutChar(statusVCOHORR[i],green);
gotoxy(6,3);
for(i=0;i<14;i++)
PutChar(MainSW1[i],yellow);
gotoxy(6,5);
for(i=0;i<15;i++)
PutChar(MainSW2[i],yellow);
//gotoxy(1,6);
gotoxy(6,7);
for(i=0;i<8;i++)
PutChar(Exit[i],yellow);
gotoxy(11,1);
PrintHex(VCOAddDec,red);
gotoxy(18,1);
PrintDecCode(HORRAddDec,red);
ResetKey();
}
void ShowVertHorr()
{
int i;
ClearOSD();
OpenOSDWindow(2,5,0,22,8,3,0);
gotoxy(6,1);
for(i=0;i<13;i++)
PutChar(statusVHValue[i],green);
gotoxy(6,3);
for(i=0;i<16;i++)
PutChar(SetVertSW1[i],yellow);
gotoxy(6,5);
for(i=0;i<16;i++)
PutChar(SetHorrSW2[i],yellow);
//gotoxy(0,6);
gotoxy(6,7);
for(i=0;i<8;i++)
PutChar(Exit[i],yellow);
gotoxy(11,1);
PrintDecCode(VertPosition,red);
gotoxy(19,1);
PrintDecCode(HorrPosition,red);
}
void PrintHex(uchar da,uchar color) //打出16進制的數據,此處做了修改
{
uchar buf[3];
buf[2]=0;
buf[1]=(da>>4)&0x0f;
if (buf[1]>9) buf[1]=buf[1]-9+0x0a; //048n-06
if(buf[1]==0) buf[1]=0x01;
else buf[1]+=0x01;
PutChar(buf[1],color);
buf[0]=da&0x0f;
if (buf[0]>9) buf[0]=buf[0]-9+0x0a; //048n-06
if(buf[0]==0) buf[0]=0x01;
else buf[0]+=0x01;
PutChar(buf[0],color);
}
void PrintDecCode(uchar da,uchar color)
{
uchar buf[3];
bit CounterFlg0=0;
bit CounterFlg1=0;
if(da<100)
buf[2]=0;
buf[0]=(da%10);//Considering the first space
buf[1]=(da/10);
if(buf[1]>=10)
{
//buf[2]=1;
buf[2]=0x02; //***************
buf[1]=(buf[1]-10);
}
PutChar(buf[2],color);
if(buf[1]==0) buf[1]=0x01;// 048n-06
//buf[1]+=0x30;
else buf[1]+=0x01;
PutChar(buf[1],color);
if(buf[0]==0) buf[0]=0x01;// 048n-06
//buf[1]+=0x30;
else buf[0]+=0x01;
PutChar(buf[0],color);
}
uchar PressKey(void)
{
//uchar i;
uchar KeyPress;
//Key=0;
KeyPress=0;
P1=0xF7;
if((P1 & 0x01) == 0)
KeyPress=sw1;
else if((P1 & 0x02) == 0)
KeyPress=sw2;
else if ((P1 & 0x04) == 0)
KeyPress = sw3;
//DelayNs(1550);
P1=0xef;
if((P1 & 0x01) == 0)
KeyPress=sw4;
else if((P1 & 0x02) == 0)
KeyPress=sw5;
else if((P1 & 0x04) == 0)
KeyPress=sw6;
if(KeyPress==1)
KeySelect1=1;
else if(KeyPress==2)
KeySelect2=1;
else if(KeyPress==3)
KeySelect3=1;
else if(KeyPress==4)
KeySelect4=1;
else if(KeyPress==5)
KeySelect5=1;
else if(KeyPress==6)
KeySelect6=1;
return (KeyPress);
}
void ShowVCOBoard()
{
int i;
gotoxy(6,3);
for(i=0;i<3;i++)
PutChar(VCOValue[i],green);
gotoxy(6,5);
for(i=0;i<12;i++)
Putuserchar(VCOSW1[i],yellow);
gotoxy(6,6);
for(i=0;i<12;i++)
Putuserchar(VCOSW2[i],yellow);
gotoxy(6,7);
for(i=0;i<8;i++)
PutChar(VCOSW6[i],yellow);
}
void ShowHORRBoard()
{
int i;
gotoxy(6,3);
for(i=0;i<4;i++)
PutChar(HORRValue[i],green);
gotoxy(6,5);
for(i=0;i<12;i++)
Putuserchar(HORRSW1[i],yellow);
gotoxy(6,6);
for(i=0;i<12;i++)
Putuserchar(HORRSW2[i],yellow);
gotoxy(6,7);
for(i=0;i<8;i++)
PutChar(HORRSW6[i],yellow);
}
void AdjustVCO()
{
ResetKey();
ClearOSD();
OpenOSDWindow(2,5,2,18,8,3,0);
ShowVCOBoard();
WaitKeyup();//*****************************8
while(KeyLayer3!=0)
{
gotoxy(11,3);
PrintHex(VCOAddDec,red);
if((KeySelect1==1)&&(KeyLayer3==1))
{
delay(50);
VCOAddDec+=1;
if(VCOAddDec==4)
VCOAddDec=0;
SendOSDCmd(15,18,0x4c|VCOAddDec);
ResetKey();
}
if((KeySelect2==1)&&(KeyLayer3==1))
{
delay(50);
VCOAddDec-=1;
//if(VCOAddDec<0)
if(VCOAddDec==0xff)
VCOAddDec=3;
SendOSDCmd(15,18,0x4c|VCOAddDec);
ResetKey();
}
if((KeySelect6==1)&&(KeyLayer3==1))
{
delay(150);
KeyLayer3=0;
KeyLayer2=1;
WaitKeyup();//**************
ClearOSD();
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -