Definition in file LCD_driver.c.
#include "Main.h"
#include "LCD_driver.h"
Include dependency graph for LCD_driver.c:

Go to the source code of this file.
Functions | |
| void | LCD_AllSegments (unsigned char input) |
| display all or hide all LCD segments on the STK502 LCD | |
| void | LCD_Init (void) |
| Initialize LCD_displayData buffer. Set up the LCD (timing, contrast, etc.). | |
| __interrupt void | LCD_SOF_interrupt (void) |
| Latch the LCD_displayData and Set LCD_status.updateComplete. | |
| void | LCD_WriteDigit (unsigned char c, unsigned char digit) |
| Stores LCD control data in the LCD_displayData buffer. (The LCD_displayData is latched in the LCD_SOF interrupt). | |
Variables | |
| __flash unsigned int | LCD_character_table [] |
| unsigned char | LCD_displayData [LCD_REGISTER_COUNT] |
| _LCD_status | LCD_status = {0x01} |
| unsigned char | LCD_timer = LCD_TIMER_SEED |
|
|
display all or hide all LCD segments on the STK502 LCD
Definition at line 167 of file LCD_driver.c. References LCD_displayData. Referenced by LCD_Init(), and LCD_update(). 00168 { 00169 unsigned char i; 00170 unsigned char *ptr; 00171 00172 if( input ) // if input == TRUE 00173 input = 0xFF; // set setgemts to 0xFF 00174 // (else set segments to 0x00) 00175 00176 ptr = LCD_displayData; 00177 i = 20; 00178 do // Set all LCD segment register to the variable Segments 00179 { 00180 *ptr++ = input; // Set/clear the bits in all LCD registers 00181 } while ( --i ); 00182 }
|
|
|
Initialize LCD_displayData buffer. Set up the LCD (timing, contrast, etc.).
Definition at line 96 of file LCD_driver.c. References FALSE, LCD_AllSegments(), LCD_CONTRAST_LEVEL, and LCD_INITIAL_CONTRAST. Referenced by Initialization(). 00097 { 00098 LCD_AllSegments( FALSE ); // Clear segment buffer. 00099 LCDCRA = (1<<LCDEN); // Enable LCD. 00100 00101 LCD_CONTRAST_LEVEL(LCD_INITIAL_CONTRAST); //Set the LCD contrast level 00102 00103 // Select asynchronous clock source, enable all COM pins and enable all segment pins. 00104 LCDCRB = (1<<LCDCS) | (1<<LCDMUX1) | (1<<LCDMUX0) | (1<<LCDPM2) | (1<<LCDPM1)| (1<<LCDPM0); 00105 LCDFRR = (1<<LCDPS0); // Set LCD prescaler to CLK(lcd)/64 = 64Hz. 00106 00107 LCDCRA |= (1<<LCDIE); //Enable LCD_Start_frame interrupt 00108 }
Here is the call graph for this function: ![]() |
|
|
Latch the LCD_displayData and Set LCD_status.updateComplete.
Definition at line 188 of file LCD_driver.c. References _LCD_status::blinkLCD, FALSE, LCD_displayData, LCD_timer, LCD_TIMER_SEED, pLCDREG, TRUE, _LCD_status::updateComplete, and _LCD_status::updateRequired. 00189 { 00190 unsigned char i; 00191 unsigned char *src, *dest; 00192 00193 LCD_timer--; 00194 if( LCD_timer == 0 ) // if time out 00195 { 00196 if( LCD_status.updateRequired == TRUE ) 00197 { 00198 LCD_timer = LCD_TIMER_SEED; // Reload the LCD_timer 00199 LCD_status.updateComplete = TRUE; // Set the LCD_ScrollReady to true. 00200 LCD_status.blinkLCD = ~LCD_status.blinkLCD; // Toggle LCD_Blink variable. 00201 00202 // Copy display data buffer to I/O segment registers. 00203 i = 20; 00204 dest = &pLCDREG; 00205 src = LCD_displayData; 00206 do 00207 { 00208 *dest++ = *src++; 00209 } while ( --i ); 00210 } 00211 else 00212 { 00213 LCD_timer = 1; //If LCD timer allows update of the LCD, but update is blocked 00214 // by LCD_status.updateRequired == FALSE the LCD_timer is preloaded 00215 // with smallest timer seed to ensure fastest LCD update. 00216 LCD_status.updateComplete = FALSE; //Block for further access to the LCD_displayData until 00217 // LCD update has been performed. 00218 } 00219 } 00220 }
|
|
||||||||||||
|
Stores LCD control data in the LCD_displayData buffer. (The LCD_displayData is latched in the LCD_SOF interrupt).
Definition at line 116 of file LCD_driver.c. References LCD_character_table, and LCD_displayData. Referenced by LCDscrollMsg(), and LCDwriteData(). 00117 { 00118 00119 unsigned int seg; 00120 unsigned char i; 00121 unsigned char mask, nibble; 00122 unsigned char *ptr; 00123 00124 //Lookup character table for segmet data 00125 seg = 0x0000; 00126 if ( (c >= '*') && (c <= 'z') ) 00127 { 00128 // c is in character_table. 00129 // Convert to upper if necessarry. 00130 if ( c >= 'a' ) c &= ~0x20; 00131 c -= '*'; 00132 seg = LCD_character_table[c]; 00133 } 00134 00135 // Adjust mask according to digit 00136 mask = 0x0F; // (1), 3, 5, 7 00137 if ( digit & 0x01 ) 00138 { 00139 } 00140 else 00141 { 00142 mask = 0xF0; // (0), 2, 4, 6 00143 } 00144 00145 i = digit-2; 00146 if ( i >= 6 ) 00147 return; 00148 i >>= 1; 00149 ptr = LCD_displayData + i; // i = {0,0,1,1,2,2} 00150 00151 i = 4; 00152 do 00153 { 00154 nibble = seg & 0x000F; 00155 seg >>= 4; 00156 if ( digit & 0x01 ) 00157 nibble <<= 4; 00158 *ptr = (*ptr & mask) | nibble; 00159 ptr += 5; 00160 } while ( --i ); 00161 }
|
|
|
Definition at line 35 of file LCD_driver.c. Referenced by LCD_WriteDigit(). |
|
|
Definition at line 32 of file LCD_driver.c. Referenced by LCD_AllSegments(), LCD_SOF_interrupt(), and LCD_WriteDigit(). |
|
|
Definition at line 29 of file LCD_driver.c. Referenced by LCD_update(). |
|
|
Definition at line 30 of file LCD_driver.c. Referenced by LCD_SOF_interrupt(). |
1.4.5