示例#1
0
文件: lcd.c 项目: dkrishna92/ARM
void lcd_command_write( unsigned char command )
{
  unsigned char temp=0;
  unsigned int temp1=0;

  temp=command;
  temp=(temp>>4)&0x0F;
  temp1=(temp<<28)&LCD_DATA_MASK;

  LCD_CTRL_CLR = LCDRS;
  LCD_CTRL_SET = LCDEN;
  LCD_DATA_CLR = LCD_DATA_MASK;
  LCD_DATA_SET = temp1;
  delay(10000);
  LCD_CTRL_CLR = LCDEN;

  temp=command;
  temp&=0x0F;
  temp1=(temp<<28)&LCD_DATA_MASK;
  delay(100*2);

  LCD_CTRL_CLR |= LCDRS;
  LCD_CTRL_SET |= LCDEN;
  LCD_DATA_CLR = LCD_DATA_MASK;
  LCD_DATA_SET = temp1;
  delay(10000);	
  LCD_CTRL_CLR |= LCDEN;
  wait_lcd();
}
示例#2
0
文件: lcd.c 项目: dkrishna92/ARM
/**
********************************************************************************************
  Function Name :	lcd_data_write()
  
  Description   :	
  
  Input         :	
  
  Output        :	Void
  
  Note          :
********************************************************************************************
*/
void lcd_data_write( unsigned char data )
{
  unsigned char temp=0;
  unsigned int temp1=0;

  temp=data;
  temp=(temp>>4)&0x0F;
  temp1=(temp<<19)&LCD_DATA_MASK;

  LCD_CTRL_SET |= LCDEN;  
  LCD_CTRL_SET |= LCDRS;
  LCD_DATA_CLR |= LCD_DATA_MASK;
  LCD_DATA_SET |= temp1;
  LCD_CTRL_CLR |= LCDEN;
  

  temp=data;
  temp&=0x0F;
  temp1=(temp<<19)&LCD_DATA_MASK;

  LCD_CTRL_SET |= LCDEN;  
  LCD_CTRL_SET |= LCDRS;
  LCD_DATA_CLR |= LCD_DATA_MASK;
  LCD_DATA_SET |= temp1;
  LCD_CTRL_CLR |= LCDEN;
  
  wait_lcd();
}
void write_char(unsigned char *c1) 
{ 
	EN = 1; 
	RS = 1; 
	RW = 0; 
	P1 = *c1; 
	EN = 0; 
	wait_lcd(); 
} 
void clear_lcd(void) 
{ 
	EN = 1; 
	RS = 0; 
	RW = 0; 
	P1 = 0x01; 
	EN = 0; 
	wait_lcd(); 
} 
void s_lcd(void)
{
	EN = 1;
	RS = 0;
	RW = 0;
	P1 = 0xC0;
	EN = 0;
	wait_lcd();
}
void init_lcd(void) 
{ 
	EN = 1; 
	RS = 0; 
	RW = 0; 
	P1 = 0x38; 
	EN = 0; 
	wait_lcd(); 
	EN = 1; 
	RS = 0; 
	RW = 0; 
	P1 = 0x0E; 
	EN = 0;
	wait_lcd(); 
	EN = 1; 
	RS = 0; 
	RW = 0; 
	P1 = 0x06; 
	EN = 0; 
	wait_lcd(); 
}