Definition in file stk504_lcd.h.
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
| union | _LCD_status |
Defines | |
| #define | AVR 0xF2 |
| #define | BC8 0x51 |
| #define | BELL 0x4F |
| #define | COL 0x44 |
| #define | DOT 0x84 |
| #define | FR 0x62 |
| #define | FR_ 0x42 |
| #define | G8 0xD0 |
| #define | ICE 0x04 |
| #define | KEY 0x52 |
| #define | LCD_CONTRAST_LEVEL(level) LCDCCR=(0x0F & level); |
| #define | LCD_INITIAL_CONTRAST 0x0F |
| #define | LCD_REGISTER_COUNT 20 |
| #define | LCD_TIMER_SEED 5 |
| #define | MO 0x60 |
| #define | MO_ 0x40 |
| #define | pLCDREG (*(unsigned char *)(0xEC)) |
| #define | S0 0x83 |
| #define | S1 0xC3 |
| #define | S10 0x8D |
| #define | S11 0x88 |
| #define | S2 0xA3 |
| #define | S3 0xC8 |
| #define | S4 0xA8 |
| #define | S5 0xCD |
| #define | S6 0xAD |
| #define | S7 0xD2 |
| #define | S8 0xB2 |
| #define | S9 0x92 |
| #define | SA 0xE2 |
| #define | SA_ 0xC2 |
| #define | segIN 0x50 |
| #define | segOUT 0xC4 |
| #define | SG0 0xE3 |
| #define | SG1 0xE8 |
| #define | SG2 0xED |
| #define | SU 0x63 |
| #define | SU_ 0x43 |
| #define | TH 0xE1 |
| #define | TH_ 0xC1 |
| #define | TU 0xE0 |
| #define | TU_ 0xC0 |
| #define | WARM 0xD1 |
| #define | WARNING 0xCF |
| #define | WE 0x61 |
| #define | WE_ 0x41 |
Functions | |
| void | LCD_AllSegments (unsigned char input) |
| Fills the Whole display buffer with one's or zero's. | |
| void | LCD_BarSeg (unsigned char value) |
| Write a hex value to the 8 bar segments on the display. | |
| void | LCD_init (void) |
| Initializes the ATmega3290 to use the STK504 Display. | |
| void | LCD_PutChar (unsigned char c, unsigned char digit) |
| Diplays a character on the 14-segment digits. | |
| void | LCD_PutDigit (unsigned char c, unsigned char digit) |
| Write a hex value to one of the 7-segment digits on the display Digit 0 has a special case as it can only display '-' and '1'. Digit[1..4] can display [0..9][A..F] See LCD_digit_table[] for some special symbols that can also be displayed. | |
| void | LCD_SetSeg (unsigned char symbol, unsigned char val) |
| Turns ON or OFF a segment in the LCD display buffer. | |
| void | LCD_Update (void) |
| Moves display buffer content to LCDDR[0..19]. Allows forced update to the phyhsical LCDDR registers, instead of setting updateRequired and waiting for the interrupt to update the LCD registers. | |
Variables | |
| unsigned char | LCD_displayData [LCD_REGISTER_COUNT] |
| LCD display buffer (for double buffering). | |
| volatile union _LCD_status | LCD_status |
| LCD_status = {0, 0, 0, 0, 0, 0, FALSE, TRUE};. | |
| unsigned char | LCD_timer |
|
|
Definition at line 54 of file stk504_lcd.h. |
|
|
Definition at line 49 of file stk504_lcd.h. Referenced by LCD_PutDigit(). |
|
|
Definition at line 55 of file stk504_lcd.h. |
|
|
Definition at line 63 of file stk504_lcd.h. |
|
|
Definition at line 64 of file stk504_lcd.h. |
|
|
Definition at line 37 of file stk504_lcd.h. |
|
|
Definition at line 45 of file stk504_lcd.h. |
|
|
Definition at line 50 of file stk504_lcd.h. Referenced by LCD_PutDigit(). |
|
|
Definition at line 62 of file stk504_lcd.h. |
|
|
Definition at line 60 of file stk504_lcd.h. |
|
|
Definition at line 83 of file stk504_lcd.h. Referenced by LCD_init(). |
|
|
Definition at line 27 of file stk504_lcd.h. Referenced by LCD_init(). |
|
|
Definition at line 28 of file stk504_lcd.h. |
|
|
Definition at line 29 of file stk504_lcd.h. Referenced by LCD_vect_interrupt(). |
|
|
Definition at line 33 of file stk504_lcd.h. |
|
|
Definition at line 41 of file stk504_lcd.h. |
|
|
Definition at line 82 of file stk504_lcd.h. Referenced by LCD_Update(), and LCD_vect_interrupt(). |
|
|
Definition at line 66 of file stk504_lcd.h. |
|
|
Definition at line 67 of file stk504_lcd.h. |
|
|
Definition at line 76 of file stk504_lcd.h. Referenced by main(). |
|
|
Definition at line 77 of file stk504_lcd.h. Referenced by main(). |
|
|
Definition at line 68 of file stk504_lcd.h. |
|
|
Definition at line 69 of file stk504_lcd.h. |
|
|
Definition at line 70 of file stk504_lcd.h. |
|
|
Definition at line 71 of file stk504_lcd.h. |
|
|
Definition at line 72 of file stk504_lcd.h. |
|
|
Definition at line 73 of file stk504_lcd.h. |
|
|
Definition at line 74 of file stk504_lcd.h. |
|
|
Definition at line 75 of file stk504_lcd.h. Referenced by main(). |
|
|
Definition at line 38 of file stk504_lcd.h. |
|
|
Definition at line 46 of file stk504_lcd.h. |
|
|
Definition at line 52 of file stk504_lcd.h. |
|
|
Definition at line 53 of file stk504_lcd.h. |
|
|
Definition at line 57 of file stk504_lcd.h. |
|
|
Definition at line 58 of file stk504_lcd.h. |
|
|
Definition at line 59 of file stk504_lcd.h. |
|
|
Definition at line 39 of file stk504_lcd.h. |
|
|
Definition at line 47 of file stk504_lcd.h. |
|
|
Definition at line 36 of file stk504_lcd.h. |
|
|
Definition at line 44 of file stk504_lcd.h. |
|
|
Definition at line 34 of file stk504_lcd.h. |
|
|
Definition at line 42 of file stk504_lcd.h. |
|
|
Definition at line 61 of file stk504_lcd.h. |
|
|
Definition at line 56 of file stk504_lcd.h. |
|
|
Definition at line 35 of file stk504_lcd.h. |
|
|
Definition at line 43 of file stk504_lcd.h. |
|
|
Fills the Whole display buffer with one's or zero's.
Definition at line 282 of file stk504_lcd.c. References LCD_displayData. Referenced by LCD_init(). 00286 { 00287 unsigned char i; 00288 unsigned char *ptr; 00289 00290 if( input ) // If input == TRUE 00291 input = 0xFF; // set segments to 0xFF. 00292 // (else set segments to 0x00) 00293 ptr = LCD_displayData; 00294 i = 20; 00295 do // Fill the display buffer. 00296 { 00297 *ptr++ = input; // Set/clear the bits in all LCD registers. 00298 } while ( --i ); 00299 }
|
|
|
Write a hex value to the 8 bar segments on the display.
Definition at line 343 of file stk504_lcd.c. References LCD_displayData. Referenced by main(). 00347 { 00348 unsigned char mask, i, n, m; 00349 unsigned char *ptr; 00350 mask = 0x80; 00351 00352 ptr = LCD_displayData + 18; // Point to the first relevant LCDDR; i = {0,0,1,1,2,2} 00353 00354 for(n=0; n<4 ; n++) 00355 { 00356 i=0; 00357 for(m=0; m<2; m++) 00358 { 00359 i |= ( value & mask ); 00360 i >>= 1; 00361 value <<= 1; // Shift next bits into position 00362 } 00363 // At this point high variable i high nibble contain | 0 | sn | sn+1 | 0 | starting with LSBs 00364 *ptr = i | (*ptr & 0x9F); // 0x9F is mask to erase old bit values in 00365 ptr -= 5; // next segment register. 00366 } 00367 }
|
|
|
Initializes the ATmega3290 to use the STK504 Display.
Definition at line 399 of file stk504_lcd.c. References FALSE, LCD_AllSegments(), LCD_CONTRAST_LEVEL, and LCD_INITIAL_CONTRAST. Referenced by main(). 00402 { 00403 00404 LCD_AllSegments( FALSE ); // Clear segment buffer. 00405 PRR &= ~(1<<PRLCD); // Make sure LCD isn't disabled in power reduction register 00406 LCDCRA = (1<<LCDEN); // Enable LCD. 00407 00408 LCD_CONTRAST_LEVEL(LCD_INITIAL_CONTRAST); //Set the LCD contrast level. 00409 00410 // Select asynchronous clock source, enable all COM pins and enable all segment pins. 00411 LCDCRB = (1<<LCDCS) | (1<<LCDMUX1) | (1<<LCDMUX0) | (1<<LCDPM3)| (1<<LCDPM2) | (1<<LCDPM1)| (1<<LCDPM0); 00412 LCDFRR = (1<<LCDPS0); // Set LCD prescaler to CLK(lcd)/64 = 64Hz. 00413 00414 LCDCRA |= (1<<LCDIE); //Enable LCD_Start_frame interrupt. 00415 00416 }
Here is the call graph for this function: ![]() |
|
||||||||||||
|
Diplays a character on the 14-segment digits.
Definition at line 134 of file stk504_lcd.c. References LCD_character_table, and LCD_displayData. Referenced by main(). 00139 { 00140 unsigned int seg, segMask; 00141 unsigned char i; 00142 unsigned char mask, nibble, nibbleMask; 00143 unsigned char *ptr; 00144 00145 if ( digit == 0 || digit >=8) 00146 { 00147 return; //digit is out og range. 00148 } 00149 00150 //Lookup character table for segment data. 00151 if ( (c >= '*') && (c <= 'z') ) 00152 { 00153 if ( c >= 'a' ) c &= ~0x20; // c is in character_table. Convert to upper if necessarry. 00154 c -= '*'; 00155 if ( c > 0x35 ) 00156 { 00157 return; // c points outside array. 00158 } 00159 else 00160 { 00161 seg = LCD_character_table[c]; 00162 } 00163 } 00164 else 00165 { 00166 return; //ASCII code out of range. 00167 } 00168 00169 // Adjust mask according to digit 00170 segMask = 0x4008; // masking out two bits not part of the segment. 00171 00172 i = digit-1; //i used as pointer offset. 00173 if ( i >= 8 ) //Test if LCD digit is out of range. 00174 return; 00175 i >>= 1; 00176 ptr = LCD_displayData + i; // Point to the first relevant LCDDR; i = {0,0,1,1,2,2} 00177 00178 i = 4; //i used as loop counter. 00179 do 00180 { 00181 nibble = seg & 0x000F; 00182 nibbleMask = segMask & 0x000F; 00183 00184 seg >>= 4; 00185 segMask >>= 4; 00186 00187 if ( digit & 0x01 ) 00188 { 00189 mask = 0xF0 | nibbleMask; 00190 } 00191 else 00192 { 00193 nibble <<= 4; 00194 mask = 0x0F | ( nibbleMask <<4 ); 00195 } 00196 *ptr = (*ptr & mask) | nibble; //Write new bit values. 00197 ptr += 5; 00198 } while ( --i ); 00199 }
|
|
||||||||||||
|
Write a hex value to one of the 7-segment digits on the display Digit 0 has a special case as it can only display '-' and '1'. Digit[1..4] can display [0..9][A..F] See LCD_digit_table[] for some special symbols that can also be displayed.
Definition at line 207 of file stk504_lcd.c. References BC8, G8, LCD_digit_table, LCD_displayData, and LCD_SetSeg(). 00215 { 00216 unsigned char i, j, seg; 00217 unsigned char mask, lastnibblemask, lookupdata; 00218 unsigned char *ptr; 00219 00220 //special case for digit = 0 00221 if (digit == 0) 00222 { 00223 LCD_SetSeg( G8, 0 ); 00224 LCD_SetSeg( BC8, 0 ); 00225 if ( c == '-' ) 00226 { 00227 LCD_SetSeg( G8, 1 ); 00228 } 00229 else 00230 { 00231 if ( c == '1' ) 00232 { 00233 LCD_SetSeg ( BC8, 1 ); 00234 } 00235 } 00236 return; 00237 } 00238 00239 if ( (c >= '*') && (c <= 'F') && (digit <= 4)) 00240 { 00241 c -= '*'; 00242 lookupdata = LCD_digit_table[c]; // c is in character_table. 00243 } 00244 else 00245 { 00246 return; // ASCII code out of range. 00247 } 00248 00249 ptr = LCD_displayData + 19; // Point to the first relevant LCDDR; 19, 14, 9, 4 00250 00251 for (j=0; j<4 ;j++) // Read out the 4 half-nibbles from lookupdata. 00252 { 00253 mask = 0xC0; 00254 lastnibblemask = 0x40; 00255 seg = ( lookupdata & mask ); // Variable lookupdata contains: 00256 // msb| A | B | F | G | E | C | D | |lsb (7seg) 00257 00258 //Shift half-nibble and masks into correct location. 00259 for (i = digit-1; i>0; i--) 00260 { 00261 seg >>= 2; 00262 mask >>= 2; 00263 lastnibblemask >>= 2; 00264 } 00265 if (j == 3) //need special mask for the last half nibble since it contains only one valid bit. 00266 { 00267 mask = mask & ~lastnibblemask; 00268 } 00269 00270 *ptr = (*ptr & ~mask) | seg; //Write new bit values. 00271 ptr -= 5; 00272 lookupdata <<= 2; //Prepare for next two bits. 00273 } 00274 }
Here is the call graph for this function: ![]() |
|
||||||||||||
|
Turns ON or OFF a segment in the LCD display buffer.
Definition at line 308 of file stk504_lcd.c. References LCD_displayData. Referenced by LCD_PutDigit(), and main(). 00313 { 00314 unsigned char offset; 00315 unsigned char setbit; 00316 unsigned char *ptr; 00317 00318 // Symbol format = bbbnnnnn where b is bit[0..7] and n is offset[0..19] 00319 // Valid symbols are defined in stk504_lcd.h 00320 setbit = (symbol >> 5); 00321 offset = (symbol & 0x1F); 00322 if ( offset >= 20 ) 00323 { 00324 return; //data out of range of the LCD registers 00325 } 00326 ptr = LCD_displayData + offset; // Point to the relevant LCDDR 00327 if ( input ) 00328 { 00329 *ptr = (*ptr) | ( 1 << setbit); // Set bit 00330 } 00331 else 00332 { 00333 *ptr = (*ptr) & ~( 1 << setbit); // Clear bit 00334 } 00335 }
|
|
|
Moves display buffer content to LCDDR[0..19]. Allows forced update to the phyhsical LCDDR registers, instead of setting updateRequired and waiting for the interrupt to update the LCD registers.
Definition at line 375 of file stk504_lcd.c. References LCD_displayData, and pLCDREG. 00380 { 00381 unsigned char *src, *dest; 00382 unsigned char i; 00383 00384 i = 20; 00385 dest = &pLCDREG; 00386 src = LCD_displayData; 00387 do 00388 { 00389 *dest++ = *src++; 00390 } while ( --i ); 00391 }
|
|
|
LCD display buffer (for double buffering).
Definition at line 33 of file stk504_lcd.c. Referenced by LCD_AllSegments(), LCD_BarSeg(), LCD_PutChar(), LCD_PutDigit(), LCD_SetSeg(), LCD_Update(), and LCD_vect_interrupt(). |
|
|
LCD_status = {0, 0, 0, 0, 0, 0, FALSE, TRUE};.
Definition at line 31 of file stk504_lcd.c. Referenced by LCD_timerDelay(), and main(). |
|
|
Definition at line 32 of file stk504_lcd.c. Referenced by LCD_timerDelay(), and LCD_vect_interrupt(). |
1.4.5