⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lcd.h

📁 AIJI_NBC的S3C4530A_4510B评估板iar源码
💻 H
字号:
/*
 * $Revision: 1.1 $
 */

/*************************************************************************/
/*                                                                       */
/* FILE NAME                                      VERSION                */
/*                                                                       */
/* source\lcd.h                                    1.0                   */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*     lcd.h header code for NBC board(S3C4530A0)                        */
/*                                                                       */
/*                                                                       */
/* DATA STRUCTURES                                                       */
/*                                                                       */
/* FUNCTIONS : lcd routine and base address                              */
/*                                                                       */
/* DEPENDENCIES                                                          */
/*                                                                       */
/*                                                                       */
/* NAME:    Nicolas Park           					 */
/* The last mofification date:  28-July-2001                             */
/* REMARKS:  Created initial version 1.0                                 */
/*                                                                       */
/*                                Copyrigth (C) 2001 AIJISYSTEM CO.,LTD  */
/*************************************************************************/


#define lcd_inst_write    (*(volatile unsigned char *)(0x3600000))  // lcd base address(nECS0)
#define lcd_data_write    (*(volatile unsigned char *)(0x3600002))

#define  SHIFT_LEFT  0x18   //Shift left instruction value
#define  SHIFT_RIGHT 0x1c  //Shift right instruction value

void lcd_delay()    /* delay for module to ready to accept new instruction */
{
	volatile int delay;
	for( delay = 0; delay <= 20000; delay++) ;
}

void long_delay()  // delay for long time
{
	volatile int delay;
	for( delay = 0; delay <= 300000; delay++) ;
}

void delay()  // delay for more long time
{
	volatile int delay;
	for( delay = 0; delay <= 1500000; delay++) ;
}


void instruction_set(unsigned char value)
{
	lcd_inst_write = value;
	lcd_delay ();
}

void clr_lcd() { instruction_set (0x01); }

void init_LCD ()
{
	instruction_set(0x38);    
	instruction_set(0x0C);    /* cursor OFF */
	instruction_set(0x06);    /* entry mode set */
	instruction_set(0x02);    /* cursor HOME */
	instruction_set(0x01);    /* clr_lcd */
}

void char_position ( char x,  char y)
{
	unsigned char position;
	if (y > 1) y = 1;
	if (x > 15) x = 15;

	position = y ? x + 0xc0 : x + 0x80;

	instruction_set (position);
}

void lcd_char_out ( char ch )
{
	lcd_data_write = ch ;
	lcd_delay ();
}

void lcd_string_out ( char x,  char y, char *text )
{
	char_position ( x, y );
	while ( *text )
		lcd_char_out ( *(text++));
}

void lcd_text_out ( char value,char text[] )
{
	int str_length, piece;
	str_length = strlen (text);
	instruction_set (value);
	for (piece  = 0; piece < str_length ; piece++)
	{

		 lcd_data_write = text[piece];
		 lcd_delay ();
	}
}

void lcd_text(char *str1,char *str2)
{
	clr_lcd();
	lcd_text_out(0x80,str1);
	lcd_text_out(0xc0,str2);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -