📄 lcd.lst
字号:
178 ========================================================================================================
C51 COMPILER V7.50 LCD 07/13/2010 12:51:59 PAGE 4
179 */
180 void LCDSetArea( INT8U x1, INT8U y1, INT8U x2, INT8U y2 )
181 {
182 1 LCDWR ( LCDCOM, SET_X_ADDR);
183 1 LCDWR ( LCDDAT, x1 + 0);
184 1 LCDWR ( LCDDAT, x2 + 0);
185 1 LCDWR ( LCDCOM, SET_Y_ADDR);
186 1 LCDWR ( LCDDAT, y1 + 0);
187 1 LCDWR ( LCDDAT, y2 + 0);
188 1 LCDWR ( LCDCOM, MEM_WRITE);
189 1 }
190 /*
191 ========================================================================================================
192 Name: LCDDrawDollop
193 Function: Draw a dollop at a special area
194 Input: 1. *dollop : The pointer of a DOLLOP struct
195 Output: None
196 Note: The value of the input structrue must be correct, This function does not check the parameters.
197 Author: LiYong
198 Date : 2008.08.09
199 ========================================================================================================
200 */
201 void LCDDrawDollop( DOLLOP* dollop )
202 {
203 1 INT8U x,y;
204 1
205 1 LCDSetArea(dollop->xs, dollop->ys, dollop->xe, dollop->ye); //Set a area at the screen
206 1 for( x = 0; x < dollop->xe - dollop->xs + 1; x ++ ) //Display rows
207 1 {
208 2 for( y = 0; y < dollop->ye - dollop->ys + 1; y ++ ) //Display columns
209 2 {
210 3 LCDWR( LCDDAT, dollop->Color>>8 );
211 3 LCDWR( LCDDAT, dollop->Color );
212 3 }
213 2 }
214 1 }
215 /*
216 ========================================================================================================
217 Name: LCDDrawPoint( );
218 Function: Draw a point
219 Input: -pPoint, A structure pointer
220 Output: None
221 ========================================================================================================
222 */
223 void LCDDrawPoint( POINT* pPoint )
224 {
225 1 LCDSetArea( pPoint->x, pPoint->y, pPoint->x, pPoint->y );
226 1 LCDWR ( LCDDAT, ( pPoint->Color >> 8 ) & 0xff );
227 1 LCDWR ( LCDDAT, pPoint->Color & 0xff );
228 1 }
229 /*
230 ========================================================================================================
231 Name: LCDDrawHRLine( );
232 Function: Draw a line
233 Input: -pLine, A structure pointer to a line
234 Output: None
235 ========================================================================================================
236 */
237 void LCDDrawHRLine( LINE* pLine )
238 {
239 1 INT8U x0, x1, y0, y1;
240 1 if( pLine->xs != pLine->xe && pLine->ys != pLine->ye ) return;
C51 COMPILER V7.50 LCD 07/13/2010 12:51:59 PAGE 5
241 1 if( pLine->ys > pLine->ye )
242 1 {
243 2 y0 = pLine->ye;
244 2 y1 = pLine->ys;
245 2 }
246 1 else
247 1 {
248 2 y0 = pLine->ys;
249 2 y1 = pLine->ye;
250 2 }
251 1 if( pLine->xs > pLine->xe )
252 1 {
253 2 x0 = pLine->xe;
254 2 x1 = pLine->xs;
255 2 }
256 1 else
257 1 {
258 2 x0 = pLine->xs;
259 2 x1 = pLine->xe;
260 2 }
261 1 LCDSetArea( x0, y0, x1, y1 );
262 1 x0 = x1 - x0;
263 1 if( x0 == 0 ) x0 = y1 - y0;
264 1 for( y0 = 0; y0 < x0; y0 ++ )
265 1 {
266 2 LCDWR( LCDDAT, pLine->Color >> 8 );
267 2 LCDWR( LCDDAT, pLine->Color );
268 2 }
269 1 }
270 /*
271 ========================================================================================================
272 Name: PrintBitBlock
273 Function: Print a special block in the screen.
274 Input: pBitBlock: This is a pointer, It points to a block whitch contains informations of the block,
275 eg. height, width, and so on.
276 Output: None
277 Note: None
278 Author: LiYong
279 Date : 2008.08.09
280 ========================================================================================================
281 */
282 void PrintBitBlock( BitBlock *pBitBlock )
283 {
284 1 INT8U Row, Column;
285 1 INT32U BytesAbs;
286 1 INT8U RowBytes;
287 1
288 1 LCDSetArea( pBitBlock->xs, pBitBlock->ys,
289 1 pBitBlock->xs + pBitBlock->Width - 1, pBitBlock->ys + pBitBlock->Height - 1 );
290 1
291 1 RowBytes = pBitBlock->Width >> 3;
292 1 if( pBitBlock->Width & 0x07 )
293 1 {
294 2 RowBytes ++;
295 2 }
296 1 for( Row = 0; Row < pBitBlock->Height; Row ++ )
297 1 {
298 2 for( Column = 0; Column < pBitBlock->Width; Column ++ )
299 2 {
300 3 BytesAbs = Row * RowBytes + ( Column >> 3 ) ;
301 3 if( *( pBitBlock->pData + BytesAbs ) & ( 1<<( Column & 0x07 )) )
302 3 {
C51 COMPILER V7.50 LCD 07/13/2010 12:51:59 PAGE 6
303 4 LCDWR( LCDDAT, pBitBlock->Color >> 8 );
304 4 LCDWR( LCDDAT, pBitBlock->Color );
305 4 }
306 3 else
307 3 {
308 4 LCDWR( LCDDAT, pBitBlock->BackColor >> 8 );
309 4 LCDWR( LCDDAT, pBitBlock->BackColor );
310 4 }
311 3 }
312 2 }
313 1 }
314 /*
315 ========================================================================================================
316 Name: GUI_Image( )
317 Function: Print a image
318 Input: point to a struct which contains the informations of the image
319 Output: None
320 Note: None
321 Author: LiYong
322 Date : 2008.08.09
323 ========================================================================================================
324 */
325 void GUI_Image( IMAGE *pImage )
326 {
327 1 INT8U x, y;
328 1 INT16U datacount = 0;
329 1 LCDSetArea( pImage->xs, pImage->ys, pImage->xs + pImage->length - 1, pImage->ys + pImage->height - 1 )
-;
330 1
331 1 for( x = 0; x < pImage->length; x ++ )
332 1 {
333 2 for( y = 0; y < pImage->height; y ++ )
334 2 {
335 3 LCDWR( LCDDAT, *( pImage->pData + datacount++ ) );
336 3 LCDWR( LCDDAT, *( pImage->pData + datacount++ ) );
337 3
338 3 }
339 2 }
340 1 }
341 /*
342 ================================================================================
343 -----------------------------------End of file----------------------------------
344 ================================================================================
345 */
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1733 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- 31
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -