📄 osd01.lst
字号:
C51 COMPILER V7.00 OSD01 07/31/2003 17:07:22 PAGE 1
C51 COMPILER V7.00, COMPILATION OF MODULE OSD01
OBJECT MODULE PLACED IN OSD01.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE OSD01.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 //===================================================================================
2 //
3 // OSD.C
4 // Author: Duran Liu
5 // Date: 06\12\03
6 // Version: 1.0
7 // Copyright: AUO
8 //===================================================================================
9
10 #define USE_GLOBAL
11 #include "include.h"
12 //#include "Data.h"
13
14 void SendOSDCode(BYTE row,column,value)
15 {
16 1 BYTE i=0;
17 1 BYTE Buf[4];
18 1
19 1 Buf[0]=OSDSlaveAddress;
20 1 Buf[1]=row;
21 1 Buf[2]=column;
22 1 Buf[3]=value;
23 1 IICOSDStart;
24 1 for(;i<4;i++) SendOSD_IIC(Buf[i]);
25 1 IICOSDStop;
26 1
27 1 }
28
29 void OpenWindow(BYTE WinNo,H_Start,H_Stop,V_Start,V_Stop,Color,bit Shadow)
30 { // Range 0~15 0~15 0~31 0~31 0~7 0~1
31 1 SendOSDCode(SetCmdReg,WinNo*3,(H_Start<<4)|H_Stop);//WinNo => Column 0~11
32 1 SendOSDCode(SetCmdReg,WinNo*3+1,(V_Start<<3)|0x04|((BYTE)Shadow) );//0x04 => Enable Window. WEN=1
33 1 SendOSDCode(SetCmdReg,WinNo*3+2,(V_Stop<<3)|(Color&0x07) );
34 1 }
35
36 void CloseWindow(BYTE WinNo)
37 {
38 1 SendOSDCode(SetCmdReg,WinNo*3+1,0);//Disable Window. WEN=0
39 1 }
40
41 void OSDSwitch(bit status)// 1 => Turn on , 0 => Turn off .
42 {
43 1 if(status) SendOSDCode(SetCmdReg,Parameter,TurnOn);
44 1 else SendOSDCode(SetCmdReg,Parameter,TurnOff);
45 1 }
46
47 void ClearOSD(void)
48 {
49 1 BYTE i;
50 1 for(i=0;i<4;i++)
51 1 {
52 2 CloseWindow(i);
53 2 }
54 1 SendOSDCode(SetCmdReg,Parameter,0x02);
55 1 DelayX1ms(2);
C51 COMPILER V7.00 OSD01 07/31/2003 17:07:22 PAGE 2
56 1 SendOSDCode(SetCmdReg,Parameter,0x00);
57 1
58 1 OSDSwitch(1);
59 1 gotoxy(0,0);
60 1 }
61
62 void gotoxy(BYTE x,y)
63 {
64 1 CursorX=x;
65 1 CursorY=y;
66 1 }
67
68 void PrintLine(BYTE *string,row ,attribute)// row = CursorY
69 { // Range 0~14
70 1 BYTE i=0;
71 1
72 1 SendOSD_IIC(OSDSlaveAddress);
73 1 // b7 b6 b5 b4 b3 b2 b1 b0
74 1 SendOSD_IIC(row|0x80);// Address Byte. Row 1 0 0 x R3 R2 R1 R0
75 1
76 1 do{
77 2 SendOSD_IIC(i|0x40);//CursorX or Column N (N = 0 ~ 29). 0x40 => Format (c)
78 2 SendOSD_IIC(ASCII_TO_OSD(*string));
79 2 i++;
80 2 string++;
81 2 }while(*string=='\0');
82 1
83 1 SendOSD_IIC(OSDSlaveAddress);
84 1 // b7 b6 b5 b4 b3 b2 b1 b0
85 1 SendOSD_IIC(row|0xa0);// Attribute Byte. Row 1 0 1 x R3 R2 R1 R0
86 1
87 1 for( ;i>0;i--)
88 1 {
89 2 SendOSD_IIC(i|0x40);//0x40 => Format (c)
90 2 SendOSD_IIC(attribute);// b7 b6 b5 b4 b3 b2 b1 b0
91 2 // - BGR BGG BGB BLINK R G B
92 2 }
93 1 }
94
95 void SetOSDRowCtrlReg(BYTE row,CHS_CWS)
96 {
97 1 SendOSDCode(row|0x80,RowCtrlReg,CHS_CWS);// CHS_CWS => 0x00 CHS=0,CWS=0; 0x01 CHS=0,CWS=1;
98 1 // 0x02 CHS=1,CWS=0; 0x03 CHS=1,CWS=1;
99 1 }
100
101 void SetOSDPosition(BYTE x,y)
102 {
103 1 SendOSDCode(SetCmdReg,VERTD,y);//Column 12
104 1 SendOSDCode(SetCmdReg,HORD,x);//Column 13
105 1 }
106
107 void SetOSDHeight(BYTE height)//Column 14
108 {
109 1 SendOSDCode(SetCmdReg,ChVerHeight,height);
110 1 }
111
112 void SetOSDRowSpace(BYTE rowspace)//Column 16
113 {
114 1 SendOSDCode(SetCmdReg,RSPACE,rowspace);
115 1 }
116
117
C51 COMPILER V7.00 OSD01 07/31/2003 17:07:22 PAGE 3
118
119 void InitOSD(void)
120 {
121 1 BYTE i;
122 1
123 1 ClearOSD();
124 1 SetOSDPosition(10,10);
125 1 SetOSDHeight(18);
126 1 SendOSDCode(SetCmdReg,18,0);
127 1 SendOSDCode(SetCmdReg,19,0);
128 1 SendOSDCode(SetCmdReg,20,0);
129 1 SendOSDCode(SetCmdReg,21,0);
130 1 SendOSDCode(SetCmdReg,22,0);
131 1
132 1 for(i=0;i<14;i++)
133 1 {
134 2 SetOSDRowCtrlReg(i,0);
135 2 }
136 1
137 1 for(i=0;i<4;i++)
138 1 {
139 2 CloseWindow(i);
140 2 }
141 1 }
142
143 char ASCII_TO_OSD(char Data)
144 {
145 1 switch(Data)
146 1 {
147 2 case '0':
148 2 return(0x01);
149 2 break;
150 2 case '1':
151 2 return(0x02);
152 2 break;
153 2 case '2':
154 2 return(0x03);
155 2 break;
156 2 case '3':
157 2 return(0x04);
158 2 break;
159 2 case '4':
160 2 return(0x05);
161 2 break;
162 2 case '5':
163 2 return(0x06);
164 2 break;
165 2 case '6':
166 2 return(0x07);
167 2 break;
168 2 case '7':
169 2 return(0x08);
170 2 break;
171 2 case '8':
172 2 return(0x09);
173 2 break;
174 2 case '9':
175 2 return(0x0A);
176 2 break;
177 2 case 'A':
178 2 return(0x0B);
179 2 break;
C51 COMPILER V7.00 OSD01 07/31/2003 17:07:22 PAGE 4
180 2 case 'B':
181 2 return(0x0C);
182 2 break;
183 2 case 'C':
184 2 return(0x0D);
185 2 break;
186 2 case 'D':
187 2 return(0x0E);
188 2 break;
189 2 case 'E':
190 2 return(0x0F);
191 2 break;
192 2 case 'F':
193 2 return(0x10);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -