📄 osd.lst
字号:
C51 COMPILER V7.00 OSD 03/04/2004 16:28:51 PAGE 1
C51 COMPILER V7.00, COMPILATION OF MODULE OSD
OBJECT MODULE PLACED IN OSD.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE OSD.c BROWSE MODA2 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 "REGISTER.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|0xa0;//0xa0 => Attribute Bytes
21 1 Buf[2]=column;
22 1 Buf[3]=value;
23 1 IICStart;
24 1 for(;i<4;i++) SendIIC(Buf[i]);
25 1 IICStop;
26 1 }
27
28 void SendOSDByte(BYTE row,column,value)
29 {
30 1 BYTE i=0;
31 1 BYTE Buf[4];
32 1
33 1 Buf[0]=OSDSlaveAddress;
34 1 Buf[1]=row|0x80;//0x80 => Address Bytes
35 1 Buf[2]=column;
36 1 Buf[3]=value;
37 1 IICStart;
38 1 for(;i<4;i++) SendIIC(Buf[i]);
39 1 IICStop;
40 1 }
41
42 void OpenWindow(BYTE WinNo,H_Start,H_Stop,V_Start,V_Stop,Color,bit Shadow)
43 { // Range 0~15 0~15 0~31 0~31 0~7 0~1
44 1 SendOSDCode(SetCmdReg,WinNo*3,(H_Start<<4)|H_Stop);//WinNo => Column 0~11
45 1 SendOSDCode(SetCmdReg,WinNo*3+1,(V_Start<<3)|0x04|((BYTE)Shadow) );//0x04 => Enable Window. WEN=1
46 1 SendOSDCode(SetCmdReg,WinNo*3+2,(V_Stop<<3)|(Color&0x07) );
47 1
48 1 }
49
50 void CloseWindow(BYTE WinNo)
51 {
52 1 SendOSDCode(SetCmdReg,WinNo*3+1,0);//Disable Window. WEN=0
53 1 }
54
55 void OSDSwitch(bit status)// 1 => Turn on , 0 => Turn off .
C51 COMPILER V7.00 OSD 03/04/2004 16:28:51 PAGE 2
56 {
57 1 if(status) SendOSDCode(SetCmdReg,Parameter,TurnOn);
58 1 else SendOSDCode(SetCmdReg,Parameter,TurnOff);
59 1 }
60
61 void ClearOSD(void)
62 {
63 1 BYTE i;
64 1
65 1 for(i=0;i<4;i++)
66 1 {
67 2 CloseWindow(i);
68 2 }
69 1
70 1 SendOSDCode(SetCmdReg,Parameter,0x02);
71 1 DelayX1ms(2);
72 1 SendOSDCode(SetCmdReg,Parameter,0x00);
73 1
74 1 OSDSwitch(1);
75 1 //gotoxy(0,0);
76 1 }
77 /*
78 void gotoxy(BYTE x,y)
79 {
80 CursorX=x;
81 CursorY=y;
82 }
83 */
84
85 void ShowWord(BYTE Row,Column,DATA,BGColor,Color,bit DSize,BLINK)
86 { // 0~7 0~7
87 1 BYTE Buf;
88 1 if(BLINK) Buf=0x08;
89 1 else Buf=0x00;
90 1 if(DSize)
91 1 {
92 2 SendOSDByte(Row,Column,DATA);
93 2 SendOSDByte(Row,30,0x03);
94 2 SendOSDCode(Row,Column,(BGColor<<4)|Buf|Color);
95 2 }
96 1 else
97 1 {
98 2 SendOSDByte(Row,Column,DATA);
99 2 SendOSDByte(Row,30,0x00);
100 2 SendOSDCode(Row,Column,(BGColor<<4)|Buf|Color);
101 2 }
102 1
103 1 }
104
105
106 void PrintLine(BYTE *string,row ,attribute)// row = CursorY
107 { // Range 0~14
108 1 BYTE i=0;
109 1
110 1 SendIIC(OSDSlaveAddress);
111 1 // b7 b6 b5 b4 b3 b2 b1 b0
112 1 SendIIC(row|0x80);// Address Byte. Row 1 0 0 x R3 R2 R1 R0
113 1
114 1 do{
115 2 SendIIC(i|0x40);//CursorX or Column N (N = 0 ~ 29). 0x40 => Format (c)
116 2 SendIIC(ASCII_TO_OSD(*string));
117 2 i++;
C51 COMPILER V7.00 OSD 03/04/2004 16:28:51 PAGE 3
118 2 string++;
119 2 }while(*string=='\0');
120 1
121 1 SendIIC(OSDSlaveAddress);
122 1 // b7 b6 b5 b4 b3 b2 b1 b0
123 1 SendIIC(row|0xa0);// Attribute Byte. Row 1 0 1 x R3 R2 R1 R0
124 1
125 1 for( ;i>0;i--)
126 1 {
127 2 SendIIC(i|0x40);//0x40 => Format (c)
128 2 SendIIC(attribute);// b7 b6 b5 b4 b3 b2 b1 b0
129 2 // - BGR BGG BGB BLINK R G B
130 2 }
131 1 }
132
133 void SetOSDRowCtrlReg(BYTE row,CHS_CWS)//
134 {
135 1 SendOSDCode(row|0x80,RowCtrlReg,CHS_CWS);// CHS_CWS => 0x00 CHS=0,CWS=0; 0x01 CHS=0,CWS=1;
136 1 // 0x02 CHS=1,CWS=0; 0x03 CHS=1,CWS=1;
137 1 }
138
139 void SetOSDPosition(BYTE x,y)
140 {
141 1 SendOSDCode(SetCmdReg,VERTD,y);//Column 12
142 1 SendOSDCode(SetCmdReg,HORD,x);//Column 13
143 1 }
144
145 void SetOSDHeight(BYTE height)//Column 14
146 {
147 1 SendOSDCode(SetCmdReg,ChVerHeight,height);
148 1 }
149
150 void InitOSD(void)
151 {
152 1 BYTE i;
153 1
154 1 ClearOSD();
155 1 SetOSDPosition(60,15);// column 13 ;column 12 ;//5.6" SetOSDPosition(60,15)
156 1 SetOSDHeight(0);//Column 14
157 1 SendOSDCode(SetCmdReg,19,0);
158 1 SendOSDCode(SetCmdReg,20,0);
159 1 SendOSDCode(SetCmdReg,21,0);
160 1 SendOSDCode(SetCmdReg,22,0);
161 1
162 1 for(i=0;i<14;i++)
163 1 {
164 2 SetOSDRowCtrlReg(i,0);
165 2 }
166 1
167 1 for(i=0;i<4;i++)
168 1 {
169 2 CloseWindow(i);
170 2 }
171 1 }
172
173 void BAR(void)
174 {
175 1 BYTE Buf_X0,Buf_0X,idx;
176 1 Flag=0;
177 1
178 1 Buf_X0=RegBuf/12;
179 1 Buf_0X=RegBuf%12;
C51 COMPILER V7.00 OSD 03/04/2004 16:28:51 PAGE 4
180 1
181 1 ShowWord(10,0,BAR_Start,BG,BAR_Color,0,0);
182 1 for(idx=1;idx<(Buf_X0+1);idx++)
183 1 {
184 2 ShowWord(10,idx,0x81,BG,BAR_Color,0,0);//0x81 = 1 DIV
185 2 }
186 1
187 1 if(Buf_0X == 3) {ShowWord(10,idx,0x84,BG,BAR_Color,0,0);Flag=1;}
188 1 else if(Buf_0X == 6) {ShowWord(10,idx,0x83,BG,BAR_Color,0,0);Flag=1;}
189 1 else if(Buf_0X == 9) {ShowWord(10,idx,0x82,BG,BAR_Color,0,0);Flag=1;}
190 1
191 1 for(;idx<22;idx++)//0x85 = 0 DIV
192 1 {
193 2 if(Flag) ShowWord(10,idx+1,0x85,BG,BAR_Color,0,0);//Because AAA has added one,idx+2.
194 2 else ShowWord(10,idx,0x85,BG,BAR_Color,0,0);
195 2 Flag=0;
196 2 }
197 1 ShowWord(10,22,BAR_Stop,BG,BAR_Color,0,0);
198 1 }
199
200 void BAR_H(void)
201 {
202 1 BYTE Buf_X0,Buf_0X,idx,Buf;
203 1 Flag=0;
204 1 Buf=RegBuf+1;
205 1 Buf_X0=Buf/4;
206 1 Buf_0X=Buf%4;
207 1
208 1 ShowWord(10,0,BAR_Start,BG,BAR_Color,0,0);
209 1 for(idx=1;idx<(Buf_X0+1);idx++)
210 1 {
211 2 ShowWord(10,idx,0x81,BG,BAR_Color,0,0);//0x81 = 1 DIV
212 2 }
213 1
214 1 if(Buf_0X == 1) {ShowWord(10,idx,0x84,BG,BAR_Color,0,0);Flag=1;}
215 1 else if(Buf_0X == 2) {ShowWord(10,idx,0x83,BG,BAR_Color,0,0);Flag=1;}
216 1 else if(Buf_0X == 3) {ShowWord(10,idx,0x82,BG,BAR_Color,0,0);Flag=1;}
217 1
218 1 for(;idx<9;idx++)//0x85 = 0 DIV
219 1 {
220 2 if(Flag) ShowWord(10,idx+1,0x85,BG,BAR_Color,0,0);//Because AAA has added one,idx+2.
221 2 else ShowWord(10,idx,0x85,BG,BAR_Color,0,0);
222 2 Flag=0;
223 2 }
224 1 ShowWord(10,idx,BAR_Stop,BG,BAR_Color,0,0);
225 1
226 1 for(;idx<22;idx++)//0x85 = 0 DIV
227 1 {
228 2 ShowWord(10,idx+1,0x00,BG,BAR_Color,0,0);
229 2 Flag=0;
230 2 }
231 1 }
232
233 void BAR_V(void)
234 {
235 1 BYTE Buf_X0,Buf_0X,idx,Buf;
236 1 Flag=0;
237 1 Buf=(RegBuf&0x3f)+1;
238 1 Buf_X0=Buf/4;
239 1 Buf_0X=Buf%4;
240 1
241 1 ShowWord(10,0,BAR_Start,BG,BAR_Color,0,0);
C51 COMPILER V7.00 OSD 03/04/2004 16:28:51 PAGE 5
242 1 for(idx=1;idx<(Buf_X0+1);idx++)
243 1 {
244 2 ShowWord(10,idx,0x81,BG,BAR_Color,0,0);//0x81 = 1 DIV
245 2 }
246 1
247 1 if(Buf_0X == 1) {ShowWord(10,idx,0x84,BG,BAR_Color,0,0);Flag=1;}
248 1 else if(Buf_0X == 2) {ShowWord(10,idx,0x83,BG,BAR_Color,0,0);Flag=1;}
249 1 else if(Buf_0X == 3) {ShowWord(10,idx,0x82,BG,BAR_Color,0,0);Flag=1;}
250 1
251 1 for(;idx<17;idx++)//0x85 = 0 DIV
252 1 {
253 2 if(Flag) ShowWord(10,idx+1,0x85,BG,BAR_Color,0,0);//Because AAA has added one,idx+2.
254 2 else ShowWord(10,idx,0x85,BG,BAR_Color,0,0);
255 2 Flag=0;
256 2 }
257 1 ShowWord(10,idx,BAR_Stop,BG,BAR_Color,0,0);
258 1
259 1 for(;idx<22;idx++)//0x85 = 0 DIV
260 1 {
261 2 ShowWord(10,idx+1,0x00,BG,BAR_Color,0,0);
262 2 Flag=0;
263 2 }
264 1 }
265
266 void Show_Number(void)
267 {
268 1 BYTE Buf_X0,Buf_0X,Buf_X00,Buf;
269 1
270 1 Buf=RegBuf;
271 1 Buf_X00=Buf/100;
272 1 Buf_X0=(Buf%100)/10;
273 1 Buf_0X=Buf%10;
274 1 ShowWord(8,19,Buf_X00+1,BG,BAR_Color,0,0);
275 1 ShowWord(8,20,Buf_X0+1,BG,BAR_Color,0,0);
276 1 ShowWord(8,21,Buf_0X+1,BG,BAR_Color,0,0);
277 1 }
278
279 void SaveReg(void)
280 {
281 1 switch(SubBuf)
282 1 {
283 2 case 0x81: VCOM=RegBuf;
284 2 break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -