Exemple #1
0
/*!	\details	Writes ANSI-C string to LCD (DDRAM memory space). */
void lcd_puts(const uint8_t *str)
{
	/* Send a ANSI-C string to LCD. */
	while ('\0' != *str)
	{
#if ( USE_FORMATTED_OUTPUT )
		if(('\n' == *str))
		{/*New line */
			lcd_goto(LCD_2nd_LINE, 0u);
		}
		else if(('\r' == *str))
		{/* Return home */
			lcd_return();
		}
		else if(('\t' == *str))
		{/* Tab space */
			uint8_t i;

			for(i=0u; i<TAB_SPACE; i++)
			{/* Shift cursor to the right. */
				cursor_shift(RIGHT);
			}
		}
		else
#endif
		{
			/* Display a symbol. */
			lcd_putc(*str);
		}
		/* Get the next symbol. */
		str++;
	}
}
Exemple #2
0
//-------------------------------
void lcd_prints(const char *p)
{/* WRITE A STRING TO LCD */
 ENABLE(LCD_WIRE,RS);
  while(*p)
  {
#if ( USE_FORMATTED_OUTPUT )
//-------------------------------
// new line
//-------------------------------
   if((*p == '\n'))
   {
	DISABLE(LCD_WIRE,RS);
	lcd_goto(2,0);
	ENABLE(LCD_WIRE,RS);
	p++;
   }
//-------------------------------
// return
//-------------------------------
   else if((*p == '\r'))
   {
	DISABLE(LCD_WIRE,RS);
	lcd_return();
	ENABLE(LCD_WIRE,RS);
	p++;
   }
//-------------------------------
// tab
//-------------------------------
   else if((*p == '\t'))
   {
	DISABLE(LCD_WIRE,RS);
	switch(TAB_SPACE)
    {
	 case 8: lcd_cmd(0x14,0); // cursor right shift
     	  	 lcd_cmd(0x14,0); // cursor right shift
     		 lcd_cmd(0x14,0); // cursor right shift
     		 lcd_cmd(0x14,0); // cursor right shift
     case 4: lcd_cmd(0x14,0); // cursor right shift
     	  	 lcd_cmd(0x14,0); // cursor right shift
     case 2: lcd_cmd(0x14,0); // cursor right shift
     case 1: lcd_cmd(0x14,0); // cursor right shift
    }
	ENABLE(LCD_WIRE,RS);
	p++;
   }
//-------------------------------
// display
//-------------------------------
   else
#endif
    lcd_cmd(*p++,0);
 }
 DISABLE(LCD_WIRE,RS);
}
Exemple #3
0
/*!	\brief	Initialize the LCD.
 * 	\note	This library use the 4-bit interface. */
void lcd_init(void)
{
	/* GPIO initialization. */
	Set_All_pins_as_Outputs();
	/* LCD initialization. */
	lcd_config(DEFAULT_DISPLAY_CONFIG);	/*!	\brief	Initializing by instruction. 4-bit interface initialization. */
	lcd_setmode(DEFAULT_VIEW_MODE);
	lcd_setmode(DEFAULT_ENTRY_MODE);
	lcd_clrscr();
	lcd_return();
	#if (USE_PROGRESS_BAR)
	lcd_initbar();
	#endif
}
Exemple #4
0
// initialize LCD
void lcd_init(void)
{
    // set up registers
	DDRC = DDRC | 0b00110000; // pc4 rs, pc5 enable
	DDRD = DDRD | 0xFF; // data
	_delay_ms(15); //wait for power up
	
	//initialisation of LCD screen
	lcd_send(0,0b00011100); // function set (5x7 dot format, 2 line mode, 8-bit data)
	lcd_send(0,0b00110000); // Blink OFF, underline OFF, Display ON
	lcd_send(0,0b01100000); // character entry mode with increment and display shift OFF
    lcd_clear();
    lcd_return();
}