⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lcd_twi.html

📁 基于RC500射频卡读写模块的程序设计
💻 HTML
字号:
<!doctype html public "-//w3c//dtd html 4.01 transitional//en"> <html><head> <meta name="generator" content="langdoc 1.0.1"> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title> library for liquid crystal display mode 4-bit through twi interface </title> </head> <body> <table border="1" width="100%" cellpadding="6"> <tr> <td align=center valign=middle bgcolor=blue> <h1> <font color="#ffffff"> library for liquid crystal display mode 4-bit through twi interface </font> </h1> </td> </tr> </table><p align=right> <i> copyright (c) 2003 atmel</i> </p><h2> library usage </h2><h3> package description </h3><h4> overview </h4>this driver controls the lcd and gives api to write (clear)the lcd lines.<p><h4> configuration </h4><pre>the driver is configured with the following parameters:<p>1/ enable_splash_screen (optional)add functions for splash-screen (first startup of program).scrolling, ...* lcd_wr_str          (uchar uc_line,uchar *psz);* lcd_scrolling_line  (uchar uc_line, uchar * pt_string, uchar uc_direction);* lcd_scrolling_inc   (uchar uc_line);* lcd_scrolling_dec   (uchar uc_line);<p>2/ enable_old_lcd_funcadd others function, if stdio library is not available.* lcd_wr_byte_dec        (uchar uc_line, uchar uc_byte, uchar uc_offset);* lcd_wr_byte_hex     (uchar uc_line, uchar uc_byte, uchar uc_offset);* lcd_hex_to_ascii    (uchar uc_data);</pre><p><h3> package summary </h3><h4> constants </h4><pre></pre><h4> global variables </h4><pre></pre><h4> macros </h4><pre></pre><h4> functions </h4><pre><a href="#lcd_clrscr">lcd_clrscr</a> <a href="#lcd_cmd4_wr">lcd_cmd4_wr</a> <a href="#lcd_cmd_wr">lcd_cmd_wr</a> <a href="#lcd_ddram_addr">lcd_ddram_addr</a> <a href="#lcd_gotoxy">lcd_gotoxy</a> <a href="#lcd_hex_to_ascii">lcd_hex_to_ascii</a> <a href="#lcd_init">lcd_init</a> <a href="#lcd_putchar">lcd_putchar</a> <a href="#lcd_scrolling_dec">lcd_scrolling_dec</a> <a href="#lcd_scrolling_inc">lcd_scrolling_inc</a> <a href="#lcd_scrolling_line">lcd_scrolling_line</a> <a href="#lcd_splash">lcd_splash</a> <a href="#lcd_wr_byte_dec">lcd_wr_byte_dec</a> <a href="#lcd_wr_byte_hex">lcd_wr_byte_hex</a> <a href="#lcd_wr_str">lcd_wr_str</a> </pre><h3> files list </h3><ul><li><b><a name="lcd_twi.c"></a> lcd_twi.c</b><br></li><li><b><a name="lcd_twi.h"></a> lcd_twi.h</b><br></li><ul>this file contains lcd driver prototype functions and delarations.</ul></ul><h3> included files </h3><ul><li><b>config.h </b><br></li><li><b>file_board_h </b><br></li><li><b><a href="#lcd_twi.h">lcd_twi.h</a> </b><br></li><li><b>lib_mcu/twi/twi_lib.h </b><br></li><li><b>modules/timer_soft/timer_soft.h </b><br></li><li><b>string.h </b><br></li></ul><h2> constant macros </h2><h2> global variables </h2><h2> function macros </h2><h2> functions </h2><a name="lcd_clrscr"></a><h3> lcd_clrscr </h3><table border="0"  width="100 %"  bgcolor="#d6e8ff"  cellpadding="6"><tr> <td valign=middle><pre>void <a href="#lcd_clrscr">lcd_clrscr</a>  ( void )  </pre></td></table><p>this function clears the entire display.this function uses a controller command.<p><table border="0"  width="100 %"  bgcolor="#ffd0d0"  cellpadding="6"><tr> <td valign=middle><pre>return:   none</pre></td></table><hr><a name="lcd_cmd4_wr"></a><h3> lcd_cmd4_wr </h3><table border="0"  width="100 %"  bgcolor="#d6e8ff"  cellpadding="6"><tr> <td valign=middle><pre>void <a href="#lcd_cmd4_wr">lcd_cmd4_wr</a> ( uchar uc_value )  </pre></td></table><p>send a data value on 4 bits with 1 commands twi (4 bits mode)only the lsb part is sent.<p><table border="0"  width="100 %"  bgcolor="#ffd0d0"  cellpadding="6"><tr> <td valign=middle><pre>*para1:   uchar uc_valuereturn:   none</pre></td></table><hr><a name="lcd_cmd_wr"></a><h3> lcd_cmd_wr </h3><table border="0"  width="100 %"  bgcolor="#d6e8ff"  cellpadding="6"><tr> <td valign=middle><pre>void <a href="#lcd_cmd_wr">lcd_cmd_wr</a> ( uchar value )  </pre></td></table><p>send a data value on 8 bits with 2 commands twi (4 bits mode)<p><table border="0"  width="100 %"  bgcolor="#ffd0d0"  cellpadding="6"><tr> <td valign=middle><pre>*para1:   uchar uc_valuereturn:   none</pre></td></table><hr><a name="lcd_ddram_addr"></a><h3> lcd_ddram_addr </h3><p>this function returns the ddram address correspondingto the define line number.<p><table border="0"  width="100 %"  bgcolor="#ffd0d0"  cellpadding="6"><tr> <td valign=middle><pre>uc_line: line number on the lcd return:  uc_address: ddram address</pre></td></table><hr><a name="lcd_gotoxy"></a><h3> lcd_gotoxy </h3><table border="0"  width="100 %"  bgcolor="#d6e8ff"  cellpadding="6"><tr> <td valign=middle><pre>void <a href="#lcd_gotoxy">lcd_gotoxy</a>  ( byte x ,  byte y )  </pre></td></table><p>absolute move of virtual cursor: the next lcd_putchar will place thecharacter at position x,y.<p><table border="0"  width="100 %"  bgcolor="#ffd0d0"  cellpadding="6"><tr> <td valign=middle><pre>x: horizontal move 1..x, left to righty: vertical move 1..y, top to bottomreturn: none</pre></td></table><h4> example </h4><pre>lcd_gotoxy(0,0); // goto home <=> lcd_gotoxy(1,1)</pre><h4> note </h4><p>x=0 => beginning of line<hr><a name="lcd_hex_to_ascii"></a><h3> lcd_hex_to_ascii </h3><table border="0"  width="100 %"  bgcolor="#d6e8ff"  cellpadding="6"><tr> <td valign=middle><pre>uchar <a href="#lcd_hex_to_ascii">lcd_hex_to_ascii</a> ( uchar uc_data )  </pre></td></table><p>this function converts a value (0-f) in ascii byte<p><table border="0"  width="100 %"  bgcolor="#ffd0d0"  cellpadding="6"><tr> <td valign=middle><pre>uc_data:  data to convertreturn:   result in ascii</pre></td></table><hr><a name="lcd_init"></a><h3> lcd_init </h3><table border="0"  width="100 %"  bgcolor="#d6e8ff"  cellpadding="6"><tr> <td valign=middle><pre>bit <a href="#lcd_init">lcd_init</a> ( void )  </pre></td></table><p>init the lcd 4 bits interface (see algo p46 in hitachi datasheet)<p><table border="0"  width="100 %"  bgcolor="#ffd0d0"  cellpadding="6"><tr> <td valign=middle><pre>return:   none</pre></td></table><hr><a name="lcd_putchar"></a><h3> lcd_putchar </h3><table border="0"  width="100 %"  bgcolor="#d6e8ff"  cellpadding="6"><tr> <td valign=middle><pre>void <a href="#lcd_putchar">lcd_putchar</a> ( uchar uc_wr_byte )  </pre></td></table><p>write a byte on the display<p><table border="0"  width="100 %"  bgcolor="#ffd0d0"  cellpadding="6"><tr> <td valign=middle><pre>uc_wr_byte:   byte to write on displayreturn:   none</pre></td></table><hr><a name="lcd_scrolling_dec"></a><h3> lcd_scrolling_dec </h3><table border="0"  width="100 %"  bgcolor="#d6e8ff"  cellpadding="6"><tr> <td valign=middle><pre>void  <a href="#lcd_scrolling_dec">lcd_scrolling_dec</a> ( uchar uc_line )  </pre></td></table><p>this function shifts all the line of a character on the left.the first character replaces the last one.this function doesn't use the shift controller command.the controller manages the dispaly as 2 lines of 40 characters.<p><table border="0"  width="100 %"  bgcolor="#ffd0d0"  cellpadding="6"><tr> <td valign=middle><pre>uc_line: line numberreturn:   none</pre></td></table><h4> note </h4><p>the buffer uc_buffer_scroll[] must contain the stringto display. the lcd_scrolling_line() function fills the buffer.<hr><a name="lcd_scrolling_inc"></a><h3> lcd_scrolling_inc </h3><table border="0"  width="100 %"  bgcolor="#d6e8ff"  cellpadding="6"><tr> <td valign=middle><pre>void  <a href="#lcd_scrolling_inc">lcd_scrolling_inc</a> ( uchar uc_line )  </pre></td></table><p>this function shifts all the line of a character on the right.the last character replaces the first one.this function doesn't use the shift controller command.the controller manages the dispaly as 2 lines of 40 characters.<p><table border="0"  width="100 %"  bgcolor="#ffd0d0"  cellpadding="6"><tr> <td valign=middle><pre>uc_line: return:   none</pre></td></table><h4> note </h4><p>the buffer uc_buffer_scroll[] must contain the stringto display. the lcd_scrolling_line() function fills the buffer.<hr><a name="lcd_scrolling_line"></a><h3> lcd_scrolling_line </h3><table border="0"  width="100 %"  bgcolor="#d6e8ff"  cellpadding="6"><tr> <td valign=middle><pre>void <a href="#lcd_scrolling_line">lcd_scrolling_line</a> ( uchar uc_line ,  uchar  *  pt_string ,  uchar uc_direction )  </pre></td></table><p>this function clears the line, diplays a string, and shiftstep by step.<p><table border="0"  width="100 %"  bgcolor="#ffd0d0"  cellpadding="6"><tr> <td valign=middle><pre>uc_line: line numberpt_string: string to display and shiftuc_direction: select a right shift (lcd_scroll_inc)ora left one lcd_scroll_inc.return:   none</pre></td></table><h4> note </h4><p>the number of shifts corresponds to the length of the line.<hr><a name="lcd_splash"></a><h3> lcd_splash </h3><table border="0"  width="100 %"  bgcolor="#d6e8ff"  cellpadding="6"><tr> <td valign=middle><pre>bit <a href="#lcd_splash">lcd_splash</a>  ( void )  </pre></td></table><p>display the lcd splash screen<p><table border="0"  width="100 %"  bgcolor="#ffd0d0"  cellpadding="6"><tr> <td valign=middle><pre>return: true if terminated</pre></td></table><h4> example </h4><pre>while (!lcd_splash());</pre><hr><a name="lcd_wr_byte_dec"></a><h3> lcd_wr_byte_dec </h3><table border="0"  width="100 %"  bgcolor="#d6e8ff"  cellpadding="6"><tr> <td valign=middle><pre>void <a href="#lcd_wr_byte_dec">lcd_wr_byte_dec</a> ( uchar uc_line ,  uchar uc_byte ,  uchar uc_offset )  </pre></td></table><p>send a byte on the display in hexa (2 characters).no line cleared<p><table border="0"  width="100 %"  bgcolor="#ffd0d0"  cellpadding="6"><tr> <td valign=middle><pre>uc_line: line number on the display (1, 2, 3 or 4)uc_data: data to write (1 byte => 3 ascii) 0-255return:   none</pre></td></table><hr><a name="lcd_wr_byte_hex"></a><h3> lcd_wr_byte_hex </h3><table border="0"  width="100 %"  bgcolor="#d6e8ff"  cellpadding="6"><tr> <td valign=middle><pre>void <a href="#lcd_wr_byte_hex">lcd_wr_byte_hex</a> ( uchar uc_line ,  uchar uc_byte ,  uchar uc_offset )  </pre></td></table><p>send a byte on the display in hexa (2 characters).no line clear<p><table border="0"  width="100 %"  bgcolor="#ffd0d0"  cellpadding="6"><tr> <td valign=middle><pre>uc_line: line number on the display (1, 2, 3 or 4)uc_data: data to write (1 byte => 2 ascii) 00-ffreturn:   none</pre></td></table><hr><a name="lcd_wr_str"></a><h3> lcd_wr_str </h3><table border="0"  width="100 %"  bgcolor="#d6e8ff"  cellpadding="6"><tr> <td valign=middle><pre>void <a href="#lcd_wr_str">lcd_wr_str</a> ( uchar uc_line , uchar  * psz )  </pre></td></table><p>send a string on the display.<p><table border="0"  width="100 %"  bgcolor="#ffd0d0"  cellpadding="6"><tr> <td valign=middle><pre>uc_line:   line number on the display (1, 2, 3 or 4)*psz: pointer on the string to writereturn:   none</pre></td></table><hr></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -