MP3播放器详细设计方案

源代码在线查看: lcd_drv.h

软件大小: 17283 K
上传用户: csytml
关键词: MP3 播放器 详细设计 方案
下载地址: 免注册下载 普通下载 VIP

相关代码

				/*H**************************************************************************
				* $RCSfile: lcd_drv.h,v $         
				*----------------------------------------------------------------------------
				* Copyright (c) 2002 Atmel.
				*----------------------------------------------------------------------------
				* RELEASE:      $Name: DEMO_FAT_1_9_9 $      
				* REVISION:     $Revision: 1.5 $     
				* FILE_CVSID:   $Id: lcd_drv.h,v 1.5 2002/05/24 09:51:15 njourdan Exp $       
				*----------------------------------------------------------------------------
				* PURPOSE:
				* This file contains the LCD controller definition
				*
				* NOTES:
				* Definition for Hitachi HD44780 LCD controller:
				*
				* - 2x16 characters
				* - 8 bit interface
				*
				* DB7:0     = AD7:0
				* RS        = A0
				* R/W       = '0' not used, busy is never tested
				* E         = P3.6/WR# inverted
				*****************************************************************************/
				
				#ifndef _LCD_DRV_H_
				#define _LCD_DRV_H_
				
				/*_____ I N C L U D E S ____________________________________________________*/
				
				
				/*_____ M A C R O S ________________________________________________________*/
				
				/*----- LCD timing -----*/
				#define TEMPO_40US   (Byte)(0.0019*FPER)    /* tempo duration of 40 us */
				#define TEMPO_1_5MS  (Uint16)(0.06*FPER)    /* tempo duration of 1.5 ms */
				#define TEMPO_30MS   (TEMPO_1_5MS * 20)     /* tempo duration of 30 ms */
				
				/*----- LCD control -----*/
				#define LCD_NB_LINE     (Byte)0x02      /* 2 display lines */
				#define LCD_NB_COLUMN   (Byte)0x10      /* 16 characters per line */
				
				#define C_R             (char)0x0D
				#define L_F             (char)0x0A
				#define B_S             (char)0x08
				
				/*----- LCD command -----*/
				#define LCD_CLR         (Byte)0x01      /* clear entire display */
				
				#define LCD_HOME        (Byte)0x02      /* cursor back to home position */
				
				#define LCD_SET         (Byte)0x04      /* set cursor move direction and specifies shift or display */
				#define LCD_NO_INC      (Byte)0x00      /* inc OFF */
				#define LCD_INC         (Byte)0x02      /* inc ON */
				#define LCD_NO_SHIFT    (Byte)0x00      /* no shift */
				#define LCD_SHIFT       (Byte)0x01      /* shift entire display */
				
				#define LCD_DISPLAY     (Byte)0x08      /* control Display,cursor,blink - ON / OFF */
				#define LCD_DISP_OFF    (Byte)0x08      /* display OFF */
				#define LCD_DISP_ON     (Byte)0x0C      /* display ON */
				#define LCD_CURS_OFF    (Byte)0x00      /* cursor OFF */
				#define LCD_CURS_ON     (Byte)0x02      /* cursor ON */
				#define LCD_BLINK_OFF   (Byte)0x00      /* cursor blink OFF */
				#define LCD_BLINK_ON    (Byte)0x01      /* cursor blink ON */
				
				#define LCD_CURS        (Byte)0x10      /* move Cursor and shift display */
				#define LCD_CURS_SHIFT  (Byte)0x00      /* cursor shift */
				#define LCD_DISP_SHIFT  (Byte)0x08      /* display shift */
				#define LCD_RIGHT       (Byte)0x04      /* cursor/display shift right */
				#define LCD_LEFT        (Byte)0x00      /* cursor/display shift left */
				
				#define LCD_FCTSET      (Byte)0x20      /* Set: 4 bits mode , nb of lines, nb of dot matrix */
				#define LCD_4BIT        (Byte)0x00      /* command for 4 bit mode */
				#define LCD_8BIT        (Byte)0x10      /* command for 8 bit mode */
				#define LCD_1_LINE      (Byte)0x00      /* set in 1 Line mode */
				#define LCD_2_LINE      (Byte)0x08      /* set in 2 Line mode */
				#define LCD_5x8DOTS     (Byte)0x00      /* set in 5*8 dots   */
				#define LCD_5x11DOTS    (Byte)0x04      /* set in 5*11 dots   */
				
				#define LCD_CGRAM       (Byte)0x40      /* Set CG RAM address */
				#define LCD_DDRAM       (Byte)0x80      /* Set DD RAM adresse */
				#define LCD_BF          (Byte)0x08      /* busy flag */
				#define LCD_SHIFT       (Byte)0x01      /* shift ON */
				#define LCD_DATA        (Byte)0x0F      /* data mask on 4 bit  */
				#define LCD_LINE0       (Byte)0x80      /* line 0 command */
				#define LCD_LINE1       (Byte)0xC0      /* line 1 command */
				#define LCD_LINE_OFFSET (Byte)0x40      /* line address offset */
				
				/*----- CGRAM -----*/
				#define CGRAM_CHAR_SIZE (Byte)0x08      /* 8 patterns to define a char */
				
				
				/*_____ D E F I N I T I O N ________________________________________________*/
				
				extern  xdata Byte  lcd_cmd;
				extern  xdata Byte  lcd_data;
				
				
				/*_____ D E C L A R A T I O N ______________________________________________*/
				
				#define Lcd_cur_on()                    lcd_cmd = (LCD_DISP_ON | LCD_CURS_ON | LCD_BLINK_ON)
				#define Lcd_cur_off()                   lcd_cmd = LCD_DISP_ON
				#define Lcd_put_char(c)                 lcd_data = c
				#define Lcd_put_cmd(c)                  lcd_cmd = c
				
				void    lcd_init (void);
				void    lcd_clr (void);
				void    lcd_set_cur (Byte, Byte);
				void    lcd_cgram (Byte, Byte code *);
				void    lcd_putchar (char);
				
				
				
				#endif  /* _LCD_DRV_H_ */
				
							

相关资源