📄 readme.display
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%This file explains how the display driver display.c works.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Display (LCD) Functions%%%%%%%%%%%%%%%%%%%%%%%*******************************************************************Note: "home" is the top left corner of the display. "row-home" is the left-most position of the current line.*******************************************************************%%%%%%%%%%%%%%%%%%%%%%%%%Display General Functions%%%%%%%%%%%%%%%%%%%%%%%%%int display_init(void);------------------------ Initializes the display:- Calls the SSC1 initialization function (ssc_init).- Calls the PWM initialization function (pwm_init)- Sets the contrast and brightness with PWM set function (pwm_set).- Turns it on and sets the cursor to home.- Returns 0 on success.int display_clear(void);------------------------- Clears the display and sets the cursor to home.- Returns 0 on success.int display_cleanup(void);--------------------------- Clears the display, sets power to down mode.- Resets the contrast and brightness with PWM set function (pwm_set).- Returns 0 on success.int display_wait(void);------------------------- Waits until the busy flag is reset (i.e. no internal operation is being processed).- Returns 0 on success.%%%%%%%%%%%%%%%%%%%%%%%%Display Cursor Functions%%%%%%%%%%%%%%%%%%%%%%%%extern int display_scroll(void);---------------------------------- Scrolls down one line.- The cursor points to the begining of the new line.- Returns 0 on success.extern int display_cursor_show(int option);--------------------------------------------- Shows or hides the cursor according to the value of option.- Recognizable values of option: CURSOR_OFF (=0) CURSOR_ON (=1)- Returns 0 on success.extern int display_goto(int option);-------------------------------------- The cursor points to a new location as specified by the parameter option.- Recognizable values of option: DISPLAY_LEFT (=0): The cursor goes back one position. If the cursor is at row-home, it will go to the end of the previous line. If the cursor is at home, then it will go to the bottom right corner of the display. DISPLAY_RIGHT (=1): The cursor goes forward one position. If the cursor is at row-end, it will go to the begining of the next line. If the cursor is at the end of the last row, then it will go to home. DISPLAY_HOME (=2) The cursor goes to home. DISPLAY_NEXTLINE (=3) The cursor moves down to a new line. If the cursor was at the last line, it will scroll down to a new line. DISPLAY_ROWHOME (=4) The cursor goes to row-home.- Returns 0 on success.%%%%%%%%%%%%%%%%%%%%%Display I/O Functions%%%%%%%%%%%%%%%%%%%%%int display_read(int cmd_data, unsigned char *value);------------------------------------------------------- cmd_data can be COMMAND (=0) or DATA(=1)- Only one COMMAND is available here: read the busy flag BF and the address counter AC (BF + AC = 1 Byte).- In the DATA case, reads byte of data in memory address pointed to by AC.- Returns 0 on success.- Recommended: * Set the AC counter before calling display_read(DATA) as follows: display.write(COMMAND, 0x80 | uc_AC_value); * Call display_wait before calling display_readint display_write(int cmd_data, unsigned char value);------------------------------------------------------- cmd_data can be COMMAND (=0) or DATA(=1)- Writes one byte, command or data, to the LCD.- Returns 0 on success.- Recommended: * Call display_wait before calling display_readextern int display_print(char *data);--------------------------------------- Prints a string of data till it encounters end of string.- Special characters: '\0' End of string. Printing stops. All characters following this one will not be printed. '\n' New line. Moves the cursor down to a new line. Scrolls down if necessary. '\r' Carriage return. Moves the cursor to row-home. '\b' Moves the cursor back one position.- Returns 0 on success.- Note: * The display holds a maximum of 80 characters. * If exactly 80 characters are provided where the 80-th character is not a special character, then the last character will be printed but the cursor will remain there. * If the 80-th character is a '\r' or a '\b', no scrolling down will occur. * If the 80-th character is a '\n', the display will be scrolled down to a new line. * If more than 80 characters are provided, the display will be scrolled down by as much as necessary. Note that in this case, some of the characters at the begining of the string will not show on the display. int display_printf(char *data, int i_value)-------------------------------------------- If data includes the character sequence "%d", then, when printing out 'data', this function will replace this sequence with the value of i_value.- Notes on display_print apply here. int display_clear_line(void)----------------------------- Clears the line(row) the cursor is at currently. The cursor goes to the beginning of the line (row-home). %%%%%%%%%%%%%%%Other functions%%%%%%%%%%%%%%%unsigned char maplcdchar(unsigned char c_char);---------------------------------------------------- There is some difference in how the LCD intereprets ASCII values, so this function maps a character to the ASCII expected by the LCD.unsigned char mapfromlcd(unsigned char uc_char)------------------------------------------------ This function maps a character read from the lcd to the ASCII used usually. %%%%%%%%%%%%%PWM functions%%%%%%%%%%%%%int pwm_init(void);int pwm_set(int id, unsigned int uc_duty_cycle_val); __________________________________________________________________________________________________________________Prepared by Houda Karaki 30.05.2005, Infineon Technologies Duisburg
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -