74 #if defined( DOXYGEN )
75 static const seg_map[];
76 static const LCD_character_table[];
77 static const seg_inf[];
78 static const lcd_symbol_chart[LCD_SYMBOL_COUNT];
82 static const unsigned char seg_map[] PROGMEM = {
83 NUM_LCD_SYMBOL_A|NUM_LCD_SYMBOL_B|NUM_LCD_SYMBOL_C|NUM_LCD_SYMBOL_D|NUM_LCD_SYMBOL_E|NUM_LCD_SYMBOL_F ,
84 NUM_LCD_SYMBOL_B|NUM_LCD_SYMBOL_C ,
85 NUM_LCD_SYMBOL_A|NUM_LCD_SYMBOL_B| NUM_LCD_SYMBOL_D|NUM_LCD_SYMBOL_E| NUM_LCD_SYMBOL_G,
86 NUM_LCD_SYMBOL_A|NUM_LCD_SYMBOL_B|NUM_LCD_SYMBOL_C|NUM_LCD_SYMBOL_D| NUM_LCD_SYMBOL_G,
87 NUM_LCD_SYMBOL_B|NUM_LCD_SYMBOL_C| NUM_LCD_SYMBOL_F|NUM_LCD_SYMBOL_G,
88 NUM_LCD_SYMBOL_A| NUM_LCD_SYMBOL_C|NUM_LCD_SYMBOL_D| NUM_LCD_SYMBOL_F|NUM_LCD_SYMBOL_G,
89 NUM_LCD_SYMBOL_A| NUM_LCD_SYMBOL_C|NUM_LCD_SYMBOL_D|NUM_LCD_SYMBOL_E|NUM_LCD_SYMBOL_F|NUM_LCD_SYMBOL_G,
90 NUM_LCD_SYMBOL_A|NUM_LCD_SYMBOL_B|NUM_LCD_SYMBOL_C ,
91 NUM_LCD_SYMBOL_A|NUM_LCD_SYMBOL_B|NUM_LCD_SYMBOL_C|NUM_LCD_SYMBOL_D|NUM_LCD_SYMBOL_E|NUM_LCD_SYMBOL_F|NUM_LCD_SYMBOL_G,
92 NUM_LCD_SYMBOL_A|NUM_LCD_SYMBOL_B|NUM_LCD_SYMBOL_C|NUM_LCD_SYMBOL_D| NUM_LCD_SYMBOL_F|NUM_LCD_SYMBOL_G,
93 NUM_LCD_SYMBOL_A|NUM_LCD_SYMBOL_B|NUM_LCD_SYMBOL_C| NUM_LCD_SYMBOL_E|NUM_LCD_SYMBOL_F|NUM_LCD_SYMBOL_G,
94 NUM_LCD_SYMBOL_C|NUM_LCD_SYMBOL_D|NUM_LCD_SYMBOL_E|NUM_LCD_SYMBOL_F|NUM_LCD_SYMBOL_G,
95 NUM_LCD_SYMBOL_A| NUM_LCD_SYMBOL_D|NUM_LCD_SYMBOL_E|NUM_LCD_SYMBOL_F ,
96 NUM_LCD_SYMBOL_B|NUM_LCD_SYMBOL_C|NUM_LCD_SYMBOL_D|NUM_LCD_SYMBOL_E| NUM_LCD_SYMBOL_G,
97 NUM_LCD_SYMBOL_A| NUM_LCD_SYMBOL_D|NUM_LCD_SYMBOL_E|NUM_LCD_SYMBOL_F|NUM_LCD_SYMBOL_G,
98 NUM_LCD_SYMBOL_A| NUM_LCD_SYMBOL_E|NUM_LCD_SYMBOL_F|NUM_LCD_SYMBOL_G,
105 static const unsigned int LCD_character_table[] PROGMEM =
181 static const unsigned char seg_inf[] PROGMEM = {
192 static const lcd_symbol_t lcd_symbol_chart[LCD_SYMBOL_COUNT] PROGMEM= {
258 static bool lcd_scroll_enable;
259 static int lcd_scroll_prescale;
260 static int lcd_scroll_prescale_value;
261 static int lcd_num_print(uint16_t numb,
bool negative, lcd_padding_t padding);
286 lcd_config_t lcd_config ;
287 lcd_config.blanking = LCD_BLANKING_OFF;
288 lcd_config.buffer = LCD_BUFFER_ON;
289 lcd_config.wave = LCD_WAVE_LOW_POWER;
290 lcd_config.clock = LCD_CLOCK_EXTERN;
291 lcd_config.bias = LCD_BIAS_HALF;
292 lcd_config.prescl = LCD_PRESCL_16;
293 lcd_config.div = LCD_DIV_8;
294 lcd_config.drive = LCD_DRIVE_450;
295 lcd_config.contrast = LCD_CONTRAST_3_30;
298 PRR &= ~(1 << PRLCD);
301 LCDCRB = lcd_config.lcdcrb|(LCD_PM_0_39<<LCDPM0)|(LCD_DUTY_QUART<<LCDMUX0);
302 LCDFRR = lcd_config.lcdfrr;
303 LCDCCR = lcd_config.lcdccr;
304 LCDCRA = lcd_config.lcdcra|(1<<LCDEN)|(1<<LCDIE);
307 lcd_symbol_clr_all();
310 lcd_scroll_prescale_value = LCD_CLCK_FRQ/128;
311 lcd_scroll_prescale_value >>= (lcd_config.prescl == 0) ? 4 : (5+lcd_config.prescl);
312 lcd_scroll_prescale_value /= (lcd_config.div+1);
313 lcd_scroll_prescale_value = (lcd_scroll_prescale_value==0) ? 1 : lcd_scroll_prescale_value;
314 lcd_scroll_prescale = lcd_scroll_prescale_value;
327 while (!(LCDCRA & (1<<LCDIF)))
334 LCDCRA = (1<<LCDEN)|(1<<LCDIF)|(1<<LCDBL);
336 while ( !(LCDCRA & (1<<LCDIF)) )
340 LCDCRA = (0<<LCDEN) | (0<<LCDIE);
362 while (inNumber >= 10){
367 newByte = newByte << 4;
368 newByte = (newByte | inNumber);
409 }
else if (numb < -9999) {
430 volatile unsigned char* lcd_data = (
volatile unsigned char*)0xEC;
435 lcd_data[pgm_read_byte(&seg_inf[j])&0x1F] &= ~((pgm_read_byte(&seg_inf[j])>>5)<<(i*2));
477 memcpy((
void*)
lcd_text, (
void const*)s, length);
543 unsigned char mem_offset;
544 unsigned char bit_offset;
545 volatile unsigned char* lcd_data = (
volatile unsigned char*)0xEC;
548 bit_offset = (symbol >> 5);
549 mem_offset = (symbol & 0x1F);
550 if ( mem_offset >= 20 ){
553 lcd_data = lcd_data + mem_offset;
555 *lcd_data = *lcd_data | ( 1 << bit_offset);
568 unsigned char offset;
569 unsigned char setbit;
570 volatile unsigned char* lcd_data = (
volatile unsigned char*)0xEC;
573 setbit = (symbol >> 5);
574 offset = (symbol & 0x1F);
579 lcd_data = lcd_data + offset;
581 *lcd_data = *lcd_data & ~( 1 << setbit);
595 count = (start +
count)>LCD_SYMBOL_COUNT ?
596 LCD_SYMBOL_COUNT - start :
600 for(i=start; i<start+
count; ++i){
616 count = (start +
count)>LCD_SYMBOL_COUNT ?
617 LCD_SYMBOL_COUNT - start :
621 for(i=start; i<
count; ++i){
647 if (numb >> 4*i == 0) {
648 if (negative ==
true) {
649 lcd_nmb_print_dig(pgm_read_byte(&seg_map[(padding == LCD_NUM_PADDING_ZERO) ? LCD_SEV_SEG_INDEX_0 : LCD_SEV_SEG_INDEX_MINUS]), i++);
650 if (padding == LCD_NUM_PADDING_ZERO) {
657 lcd_nmb_print_dig(pgm_read_byte(&seg_map[(padding == LCD_NUM_PADDING_ZERO) ? LCD_SEV_SEG_INDEX_0 : LCD_SEV_SEG_INDEX_SPACE]), i++);
661 if (negative ==
true) {
682 volatile unsigned char* lcd_data = (
volatile unsigned char*)0xEC;
687 lcd_data[pgm_read_byte(&seg_inf[j])&0x1F] |= (pgm_read_byte(&seg_inf[j])>>5)<<(dig*2);
690 lcd_data[pgm_read_byte(&seg_inf[j])&0x1F] &= ~((pgm_read_byte(&seg_inf[j])>>5)<<(dig*2));
740 for (i=1; i<pos; i++) {
745 for ( i=pos; i<=7; ++i) {
770 unsigned int seg, segMask;
772 unsigned char mask, nibble, nibbleMask;
774 volatile unsigned char* lcd_data = (
volatile unsigned char*)0xEC;
775 unsigned char lcd_reg;
782 if (((c >=
'*') && (c <=
'z')) || (c ==
' ')){
796 seg = pgm_read_dword(&LCD_character_table[c]);
813 nibble = seg & 0x000F;
814 nibbleMask = segMask & 0x000F;
820 mask = 0xF0 | nibbleMask;
824 mask = 0x0F | ( nibbleMask <<4 );
827 *lcd_data |= (lcd_reg & mask) | nibble;
830 *lcd_data &= (lcd_reg & mask) | nibble;
848 if (lcd_scroll_enable) {
849 if (--lcd_scroll_prescale == 0) {
851 lcd_scroll_prescale = lcd_scroll_prescale_value;
static void start(void)
Start measurement.
int lcd_num_clr(void)
This will clear numbers displayed on the LCD.
void lcd_symbol_clr(lcd_symbol_t symbol)
This will clear any symbol on the Raven LCD.
int lcd_num_putdec(int numb, lcd_padding_t padding)
This will put a DEC value on the LCD that represents the input parameter.
static int lcd_text_rd_ptr
Textd buffer read pointer for text field in LCD display.
static int lcd_num_print(uint16_t numb, bool negative, lcd_padding_t padding)
This will print a number to the LCD with the following parameters.
int lcd_num_puthex(uint16_t numb, lcd_padding_t padding)
This will put a HEX value on the LCD that represents the input parameter.
void lcd_symbol_set_group(int start, int count)
This will enable a group of symbols from the lcd_symbol_chart.
static void lcd_nmb_print_dig(uint8_t val, int dig)
This will print a number according to the segment map of the LCD.
static int lcd_char_put(unsigned char c, int pos)
This will put a single char out to the LCD by looking up the proper segments.
uint8_t itobcd(uint8_t inNumber)
This will convert the incoming decimal number to BCD.
int lcd_puts(const char *s)
This will put a string of characters out to the LCD.
static int lcd_text_sl(void)
This will scroll the test on the LCD.
void lcd_single_print_dig(uint8_t numb, uint8_t pos)
This will add the passed in number to any of the four locations of the four digit segment display on ...
void lcd_symbol_set(lcd_symbol_t symbol)
This will enable any of the symbols on the Raven LCD.
int lcd_puta(size_t length, const uint8_t *s)
This will put a string of characters of a certain length out to the LCD.
static volatile clock_time_t count
These routines define the AVR-specific calls declared in /core/sys/clock.h CLOCK_SECOND is the number...
void led_on(void)
Turns the Raven nose LED on.
static int lcd_text_wr_ptr
Text pointer for writing new chars to text buffer.
ISR(LCD_vect)
This is the LCD Start of Frame Interrupt Subroutine.
static unsigned char lcd_text[20]
LCD text buffer.
void led_off(void)
Turns the Raven nose LED off.
void lcd_deinit(void)
This will disable the LCD operation.
void lcd_symbol_clr_group(int start, int count)
This will disable a group of symbols from the lcd_symbol_chart.
int lcd_init(void)
This function will initialize the proper settings for the LCD driver.
int lcd_putchar(unsigned char c)
This will put a single character out to the LCD.
int lcd_puts_P(const char *s)
This will put a string out to the LCD from Flash.
int abs(int I)
Returns the absolute value of I (also called the magnitude of I).
static int lcd_text_put(const char *s, int pos)
This will put test out to the LCD at a certain location padded with spaces.
#define PORTB
Peripheral PORTB base pointer.