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

📄 general.h

📁 瑞萨单片机LCD控制
💻 H
字号:
/**************************************************************************/
/**MITSUBISHI**MITSUBISHI**MITSUBISHI**MITSUBISHI**MITSUBISHI**MITSUBISHI**/
/**************************************************************************/
/**************************************************************************/
/*  DISCLAIMER:                                                           */
/*  We (MITSUBISHI ELECTRIC B.V.) do not warrant that the Software is     */
/*  free from claims by a third party of copyright, patent, trademark,    */
/*  trade secret or any other intellectual property infringement.         */
/*                                                                        */
/*  Under no circumstances are we liable for any of the following:        */
/*                                                                        */
/*  1. third-party claims against you for losses or damages;              */
/*  2. loss of, or damage to, your records or data; or                    */
/*  3. economic consequential damages (including lost profits or          */
/*     savings) or incidental damages, even if we are informed of         */
/*     their possibility.                                                 */
/*                                                                        */
/*  We do not warrant uninterrupted or error free operation of the        */
/*  Software. We have no obligation to provide service, defect            */
/*  correction, or any maintenance for the Software. We have no           */
/*  obligation to supply any Software updates or enhancements to you      */
/*  even if such are or later become available.                           */
/*                                                                        */
/*  IF YOU DOWNLOAD OR USE THIS SOFTWARE YOU AGREE TO THESE TERMS.        */
/*                                                                        */
/*  THERE ARE NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING THE            */
/*  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A               */
/*  PARTICULAR PURPOSE.                                                   */
/**************************************************************************/
/**************************************************************************/
/*                                                                        */
/*                                                                        */
/*       Name         :      GENERAL.H                                    */
/*       Date         :      12.02.1999                                   */ 
/*       Author       :      CA                                           */
/*       Change       :                                                   */
/*               (Date)  (Author)  (Description)                          */
/*                                                                        */
/**************************************************************************/

/************************* exported variables *****************************/


public near unsigned int    timer_100ms;
                                           // buffer of each single digit
public near unsigned int    lcd_1;         
public near unsigned int    lcd_2;
public near unsigned int    lcd_3;
public near unsigned int    lcd_4;
public near unsigned int    lcd_5;
public near unsigned int    lcd_6;
public near unsigned int    lcd_7;
public near unsigned int    lcd_8;
public near unsigned int    lcd_9;
public near unsigned int    lcd_10;
public near unsigned int    lcd_11;
public near unsigned int    lcd_12;

public near unsigned int    state_lcd;      // buffer for sequence-states
public near unsigned int    state_common;   // buffer for common-states
                                            
public near unsigned char    port_1_c0;     // port buffer
public near unsigned char    port_2_c0;
public near unsigned char    port_1_c1;
public near unsigned char    port_2_c1;
public near unsigned char    port_1_c2;
public near unsigned char    port_2_c2;
public near unsigned char    port_1_c3;
public near unsigned char    port_2_c3;

public near unsigned char    port_3_c0;
public near unsigned char    port_4_c0;
public near unsigned char    port_3_c1;
public near unsigned char    port_4_c1;
public near unsigned char    port_3_c2;
public near unsigned char    port_4_c2;
public near unsigned char    port_3_c3;
public near unsigned char    port_4_c3;

public near unsigned char    port_5_c0;
public near unsigned char    port_5_c1;
public near unsigned char    port_5_c2;
public near unsigned char    port_5_c3;

public near unsigned int TIME_ON;
public near unsigned int TIME_OFF;

/************************  defines ****************************************/

/* definition of lcd symbols            */
/* all values depend on pin reservation */
            /* All digits can be initialised with the follwing 'common'/'segment' */ 
            /* line combinations:                */       
            /* Example for the first digit       */
            /*   C3     C2     C1     C0         */
            /*  ----   ----   ----   ----        */
            /*  ||||   ||||   ||||   |||+-------------- SEG 1  (bit0) */
            /*  ||||   ||||   ||||   ||+--------------- SEG 2  (bit1  */
            /*  ||||   ||||   ||||   |+---------------- SEG 3  (bit2) */
            /*  ||||   ||||   ||||   +----------------- SEG 4  (bit3) */
            /*  ||||   ||||   |||+--------------------- SEG 1  (bit4) */                                      
            /*  ||||   ||||   ||+---------------------- SEG 2  (bit5) */
            /*  ||||   ||||   |+----------------------- SEG 3  (bit6) */
            /*  ||||   ||||   +------------------------ SEG 4  (bit7) */                       
            /*  ||||   |||+---------------------------- SEG 1  (bit8) */
            /*  ||||   ||+----------------------------- SEG 2  (bit9) */            
            /*  ||||   |+------------------------------ SEG 3  (bit10)*/
            /*  ||||   +------------------------------- SEG 4  (bit11)*/                       
            /*  |||+----------------------------------- SEG 1  (bit12)*/
            /*  ||+------------------------------------ SEG 2  (bit13)*/            
            /*  |+------------------------------------- SEG 3  (bit14)*/
            /*  +-------------------------------------- SEG 4  (bit15)*/ 

/* for OPTREX  FRD-0346P   SEG1 corresponds to pin 1  of LCD */
/*                         SEG2 corresponds to pin 2  of LCD */
/*                         SEG3 corresponds to pin 35 of LCD */
/*                         SEG4 corresponds to pin 36 of LCD */  
#define	C0A	0x8000
#define	C0B	0x0400
#define	RDS	0x1000
#define	C0D	0x4000

#define	C1A	0x0100
#define	C1B	0x0040
#define	C1C	0x0800
#define	C1D	0x2000

#define	C2A	0x0010
#define	C2B	0x0004
#define	C2C	0x0080
#define	C2D	0x0200

#define	FARE	0x0008
#define	C3B	0x0002
#define	C3C	0x0001
#define	C3D	0x0020


#define LCD_OFF              0x0000
#define LCD_1                0x4002				//0x0440
#define LCD_2                0x83c1				//0x4C31
#define LCD_3                C3C+C2C+C1C+C0A+C1B		//0x0x4C61
#define LCD_4                C2A+C2D+C1B+C2C+C1C		//0x0D60
#define LCD_5                C3C+C2A+C2D+C1B+C1C+C0A		//0x4961
#define LCD_6                C3C+C2A+C1A+C2D+C1B+C1C+C0A	//0x0971
#define LCD_7                C3C+C2B+C1D			//0x4540
#define LCD_8                C3C+C2A+C1A+C0A+C2C+C1C+C2D+C1B	//0x4D71
#define LCD_9                C3C+C2A+C2C+C2D+C1B+C1C+C0A	//0x4D61
#define LCD_0                C3C+C2A+C1A+C0A+C2C+C1C		//0x4551


#define LCD_C                C3C+C2A+C1A+C0A		//0x4111
#define LCD_O                C3C+C2A+C1A+C0A+C2C+C1C	//0x4551
#define LCD_N                C1A+C2A+C3D+C0B+C1C+C2C	//0x8552
#define LCD_T                C3C+C3B+C0D		//0x6008
#define LCD_R                C3C+C2C+C1B+C2D+C2A+C1A+C0B	//0x4D32
#define LCD_L                C2A+C1A+C0A		//0x0111
#define LCD_D                C2C+C1C+C1B+C2D+C1A+C0A	//0x6449 
#define LCD_W                C2A+C1A+C1D+C0B+C1C+C2C	//0x05D2  
#define LCD_I                C3B+C0D			//0x0440
#define LCD_H                C2A+C1A+C2C+C1C+C2D+C1B	//0x0D70
#define LCD_M                C2A+C1A+C2C+C1C+C3D+C2B	//0x8750


#define	D9_a	0x0008

#define D10_A	0x0004
#define D10_B	0x0008
#define D10_C	0x0800
#define D10_D	0x4000
#define D10_E	0x0400
#define D10_F	0x0040
#define D10_G	0x0080
#define D10_col 0x8000

#define D11_A	0x0001
#define D11_B	0x0002
#define D11_C	0x0200
#define D11_D	0x1000
#define D11_E	0x0100
#define D11_F	0x0010
#define D11_G	0x0020

#define D12_A	0x0008
#define D12_B	0x0080
#define D12_C	0x0800
#define D12_D	0x8000
#define D12_E	0x0400
#define D12_F	0x0004
#define D12_G	0x0040

#define LCD_D10_0	D10_A+D10_B+D10_C+D10_D+D10_E+D10_F
#define LCD_D10_1	D10_B+D10_C
#define LCD_D10_2	D10_A+D10_B+D10_D+D10_E+D10_G
#define LCD_D10_3	D10_A+D10_B+D10_C+D10_D+D10_G
#define LCD_D10_4	D10_B+D10_C+D10_F+D10_G
#define LCD_D10_5	D10_A+D10_C+D10_D+D10_F+D10_G
#define LCD_D10_6	D10_A+D10_C+D10_D+D10_E+D10_F+D10_G
#define LCD_D10_7	D10_A+D10_B+D10_C
#define LCD_D10_8	D10_A+D10_B+D10_C+D10_D+D10_E+D10_F+D10_G
#define LCD_D10_9	D10_A+D10_B+D10_C+D10_D+D10_F+D10_G

#define LCD_D11_0	D11_A+D11_B+D11_C+D11_D+D11_E+D11_F
#define LCD_D11_1	D11_B+D11_C
#define LCD_D11_2	D11_A+D11_B+D11_D+D11_E+D11_G
#define LCD_D11_3	D11_A+D11_B+D11_C+D11_D+D11_G
#define LCD_D11_4	D11_B+D11_C+D11_F+D11_G
#define LCD_D11_5	D11_A+D11_C+D11_D+D11_F+D11_G
#define LCD_D11_6	D11_A+D11_C+D11_D+D11_E+D11_F+D11_G
#define LCD_D11_7	D11_A+D11_B+D11_C
#define LCD_D11_8	D11_A+D11_B+D11_C+D11_D+D11_E+D11_F+D11_G
#define LCD_D11_9	D11_A+D11_B+D11_C+D11_D+D11_F+D11_G

#define LCD_D12_0	D12_A+D12_B+D12_C+D12_D+D12_E+D12_F
#define LCD_D12_1	D12_B+D12_C
#define LCD_D12_2	D12_A+D12_B+D12_D+D12_E+D12_G
#define LCD_D12_3	D12_A+D12_B+D12_C+D12_D+D12_G
#define LCD_D12_4	D12_B+D12_C+D12_F+D12_G
#define LCD_D12_5	D12_A+D12_C+D12_D+D12_F+D12_G
#define LCD_D12_6	D12_A+D12_C+D12_D+D12_E+D12_F+D12_G
#define LCD_D12_7	D12_A+D12_B+D12_C
#define LCD_D12_8	D12_A+D12_B+D12_C+D12_D+D12_E+D12_F+D12_G
#define LCD_D12_9	D12_A+D12_B+D12_C+D12_D+D12_F+D12_G






/* definitions of display states */
#define STATE_LCD_OFF        0x0000
#define STATE_LCD_1            0x0001
#define STATE_LCD_2            0x0002
#define STATE_LCD_3            0x0003
#define STATE_LCD_4            0x0004
#define STATE_LCD_5            0x0005
#define STATE_LCD_6            0x0006
#define STATE_LCD_7            0x0007
#define STATE_LCD_8            0x0008
#define STATE_LCD_9            0x0009
#define STATE_LCD_10            0x000A
#define STATE_LCD_11           0x000B
#define STATE_LCD_12            0x000C
#define STATE_LCD_13           0x000D
#define STATE_LCD_14           0x000E
#define STATE_LCD_15           0x000F
#define STATE_LCD_16           0x0010
#define STATE_LCD_17            0x0011
#define STATE_LCD_18            0x0012
#define STATE_LCD_19            0x0013
#define STATE_LCD_20            0x0014
#define STATE_LCD_21           0x0015
#define STATE_LCD_22            0x0016
#define STATE_LCD_23            0x0017
#define STATE_LCD_24            0x0018
#define STATE_LCD_25            0x0019
#define STATE_LCD_26            0x001A
#define STATE_LCD_27            0x001B
#define STATE_LCD_28            0x001C
#define STATE_LCD_29            0x001D
#define STATE_LCD_30            0x001E
#define STATE_LCD_31            0x001F
#define STATE_LCD_32            0x0020
#define STATE_LCD_33            0x0021
#define STATE_LCD_34            0x0022
#define STATE_LCD_35            0x0023

/* definition for common/segment multiplex state machine */
#define STATE_COMMON_C0_ON    	0x0000
#define STATE_COMMON_C0_OFF 	0x0001
#define STATE_COMMON_C1_ON    	0x0002
#define STATE_COMMON_C1_OFF 	0x0003
#define STATE_COMMON_C2_ON    	0x0004
#define STATE_COMMON_C2_OFF 	0x0005
#define STATE_COMMON_C3_ON    	0x0006
#define STATE_COMMON_C3_OFF 	0x0007
#define STATE_COMMON_C4_ON    	0x0008
#define STATE_COMMON_C4_OFF 	0x0008
#define STATE_COMMON_C0_IN	0X0009
#define STATE_COMMON_C1_IN	0X000A
#define STATE_COMMON_C2_IN	0X000B
#define STATE_COMMON_C3_IN	0X000C

#define STATE_COMMON_C0_IN2	0X000D
#define STATE_COMMON_C1_IN2	0X000E
#define STATE_COMMON_C2_IN2	0X000F
#define STATE_COMMON_C3_IN2	0X0010

/************************* function prototypes ****************************/

⌨️ 快捷键说明

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