📄 osd.lst
字号:
C51 COMPILER V7.50 OSD 07/11/2005 15:03:05 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE OSD
OBJECT MODULE PLACED IN OSD.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE OSD.c BROWSE DEBUG OBJECTEXTEND
line level source
1 /***********************************************************************
2 * Project: MTV230+CS7110+UPS017
3 *
-
4 * File: OSD.c (Source)
-
5 *
-
6 * Version: V1.0
-
7 *
-
8 * Created: 2004.11.2
-
9 * Last Change: 2005.7.11
-
10 *
-
11 * Author: Yuan K
-
12 *
13 * Company: MYSON
14 *
-
15 * Compiler: KEIL C51 V7.04
-
16 *
-
17 * Description:
18 *
19 * MTV230(@12MHz)
20 *
21 *Copyright (c) Century Integration Technology, Inc.
22 *All rights reserved.
23 *
24 ***********************************************************************/
25
26 #include "Globe.h"
27
28 BYTE MaxValue,MinValue,WorkValue;
29
30 BYTE data CursorX;
31 BYTE data CursorY;
32
33 BYTE code HexTab[16]={_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,_e,_f};
34
35 enum window
36 {
37 window1=1,
38 window2,
39 window3,
40 window4
41 };
42
43 void Double_W_H(BYTE Attr)
C51 COMPILER V7.50 OSD 07/11/2005 15:03:05 PAGE 2
44 {
45 1 byM230_OSDRA=CursorY|OSD_DISPLAY;
46 1 byM230_OSDCA=30;
47 1 byM230_OSDDT0=Attr;
48 1 }
49
50 void gotoxy(BYTE x, BYTE y)
51 {
52 1 CursorX=x;
53 1 CursorY=y;
54 1 }
55
56 void SetOSDAttribute(BYTE color)
57 {
58 1 byM230_OSDRA=CursorY|OSD_ATTRIBUTE;
59 1 byM230_OSDCA=CursorX;
60 1 byM230_OSDDT0=color;
61 1 }
62
63 void SetOSDDisplay(BYTE font, bit page2)
64 {
65 1 byM230_OSDRA=CursorY|OSD_DISPLAY;
66 1 byM230_OSDCA=CursorX;
67 1
68 1 if(page2) {
69 2 byM230_OSDDT1=font;
70 2 }
71 1 else {
72 2 byM230_OSDDT0=font;
73 2 }
74 1 }
75
76 void PrintChar(BYTE FontCode, BYTE Color, bit Page2)
77 {
78 1 SetOSDDisplay(FontCode,Page2);
79 1 SetOSDAttribute(Color);
80 1
81 1 CursorX++;
82 1
83 1 if(CursorX>29){
84 2 CursorX=0;
85 2 CursorY++;
86 2 }
87 1
88 1 if(CursorY>14){
89 2 CursorY=0;
90 2 }
91 1 }
92
93 void PrintString(BYTE *string, BYTE color)
94 {
95 1 while((*string)!=DataEnd)
96 1 {
97 2 if((*string)==SecondPage)
98 2 {
99 3 string++;
100 3 PrintChar(*string, color, 1);
101 3 }
102 2 else
103 2 {
104 3 PrintChar(*string, color, 0);
105 3 }
C51 COMPILER V7.50 OSD 07/11/2005 15:03:05 PAGE 3
106 2
107 2 string++;
108 2 }
109 1 }
110
111 void PrintDec(BYTE value, BYTE color)
112 {
113 1 BYTE buf[3],temp;
114 1
115 1 buf[2]=value/100;
116 1 temp=value%100;
117 1 buf[1]=temp/10;
118 1 buf[0]=temp%10;
119 1
120 1 if(buf[2]==0x00)
121 1 {
122 2 PrintChar(__,color,0);
123 2 }
124 1 else
125 1 {
126 2 PrintChar(HexTab[buf[2]], color, 0);
127 2 }
128 1 if(buf[2]==0x00)
129 1 {
130 2 if(buf[1]==0x00)
131 2 {
132 3 PrintChar(__,color,0);
133 3 }
134 2 else
135 2 {
136 3 PrintChar(HexTab[buf[1]], color, 0);
137 3 }
138 2 }
139 1 else
140 1 {
141 2 PrintChar(HexTab[buf[1]], color, 0);
142 2 }
143 1
144 1 PrintChar(HexTab[buf[0]], color, 0);
145 1 }
146
147
148 #define GAUGE_DEGREE 3
149 #define GAUGE_LENGTH 25
150 #define MAX_GAUGE (GAUGE_DEGREE*GAUGE_LENGTH)
151
152 void PrintBar(WORD value, BYTE color)
153 {
154 1 BYTE full,i;
155 1
156 1 BYTE code NFULL_CODE[GAUGE_DEGREE]=
157 1 {
158 1 _BAR_EMP,_BAR_2,_BAR_F
159 1 };
160 1
161 1 value=(MAX_GAUGE*value)/(MaxValue-MinValue);
162 1 full=value/GAUGE_DEGREE;
163 1
164 1 if( (value==0) && (full==0) )
165 1 {
166 2 for(i=0;i<GAUGE_LENGTH;i++)
167 2 {
C51 COMPILER V7.50 OSD 07/11/2005 15:03:05 PAGE 4
168 3 PrintChar(_BAR_EMP, color, 0);
169 3 }
170 2 //PrintChar(_BAR_END,color, 0);
171 2 return;
172 2 }
173 1
174 1 for(i=0;i<GAUGE_LENGTH;i++)
175 1 {
176 2 if(i<full)
177 2 {
178 3 PrintChar(_BAR_F,color, 0);
179 3 }
180 2 else if(i==full)
181 2 {
182 3 PrintChar(NFULL_CODE[value%GAUGE_DEGREE],color, 0);
183 3 }
184 2 else
185 2 {
186 3 PrintChar(_BAR_EMP,color, 0);
187 3 }
188 2
189 2 }
190 1 PrintChar(_BAR_END,color, 0);
191 1 }
192
193 void PrintOneBar(BYTE Cstart, BYTE Rstart, BYTE color)
194 {
195 1 BYTE bar_value;
196 1
197 1 bar_value=WorkValue;
198 1 gotoxy(Cstart,Rstart);
199 1 PrintChar(_BAR_S,color,0);
200 1 PrintBar(bar_value, color);
201 1 }
202
203 void InitialOSD(void)
204 {
205 1 BYTE i, j;
206 1
207 1 CloseOSD();
208 1
209 1 byM230_RSPACE=0x00; //row to row spacing is 0 !!!
210 1 // byM230_HORD=30;
211 1 // byM230_VERTD=6;
212 1 byM230_CH=0x00; //character is 18 lines high !!!
213 1 byM230_CHSC=0x00; //shadow color
214 1 byM230_FSSTP=0x00; //self-test pattern
215 1
216 1 byM230_WINSW=0x00; //shadow width of 4 windows are 2 !!!
217 1 byM230_WINSH=0x00; //shadow height of 4 windows are 2 !!!
218 1
219 1 for(i=0;i<4;i++)
220 1 {
221 2 CloseOSDWindow(i);
222 2 }
223 1
224 1 for(i=0;i<=14;i++)
225 1 {
226 2 byM230_OSDRA=i; //initialize every row's CTRL REG: RINT CHS CWS
227 2 byM230_OSDCA=30;
228 2 byM230_OSDDT0=0x00;
229 2 }
C51 COMPILER V7.50 OSD 07/11/2005 15:03:05 PAGE 5
230 1
231 1 for(i=0;i<=14;i++)
232 1 {
233 2 byM230_OSDRA=i|0x40;//initialize every character's attribute MTV230---PAGE21
234 2 for(j=0;j<=29;j++)
235 2 {
236 3 byM230_OSDCA=j;
237 3 byM230_OSDDT0=0x00;
238 3 }
239 2 }
240 1 }
241 void OpenOSD_Border(void)
242 {
243 1 byM230_OSDCON=OSD_ENABLE_B;
244 1 }
245
246 void CloseOSD(void)
247 {
248 1 byM230_OSDCON=WEN_Clr+RAM_Clr;
249 1 //DelayX1ms(1);
250 1 byM230_OSDCON=0x00;
251 1 }
252
253 void CloseOSDWindow(BYTE WinNo)
254 {
255 1 switch(WinNo)
256 1 {
257 2 case window1:
258 2 byM230_W1COL1=0x00;
259 2 break;
260 2
261 2 case window2:
262 2 byM230_W2COL1=0x00;
263 2 break;
264 2
265 2 case window3:
266 2 byM230_W3COL1=0x00;
267 2 break;
268 2
269 2 case window4:
270 2 byM230_W4COL1=0x00;
271 2 break;
272 2
273 2 default:
274 2 break;
275 2 }
276 1 }
277
278
279 /*void SetWindow(BYTE CStart,BYTE CEnd,BYTE RStart,BYTE REnd,BYTE Color,BYTE WinNum)
280 {
281 switch(WinNum)
282 {
283 case window1:
284 byM230_W1ROW=(RStart<<4)|REnd;
285 byM230_W1COL1=((CStart<<3)|WEN_En)&0xfe;
286 byM230_W1COL2=(CEnd<<3)|(Color&0x07);
287 break;
288
289 case window2:
290 byM230_W2ROW=(RStart<<4)|REnd;
291 byM230_W2COL1=((CStart<<3)|WEN_En)&0xfe;
C51 COMPILER V7.50 OSD 07/11/2005 15:03:05 PAGE 6
292 byM230_W2COL2=(CEnd<<3)|(Color&0x07);
293 break;
294
295 case window3:
296 byM230_W3ROW=(RStart<<4)|REnd;
297 byM230_W3COL1=((CStart<<3)|WEN_En)&0xfe;
298 byM230_W3COL2=(CEnd<<3)|(Color&0x07);
299 break;
300
301 case window4:
302 byM230_W4ROW=(RStart<<4)|REnd;
303 byM230_W4COL1=((CStart<<3)|WEN_En)&0xfe;
304 byM230_W4COL2=(CEnd<<3)|(Color&0x07);
305 break;
306
307 default:
308 break;
309 }
310 }*/
311
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 608 ----
CONSTANT SIZE = 19 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 5 8
IDATA SIZE = ---- ----
BIT SIZE = ---- 2
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -