2.png (149.87 KB, 下載次數: 96)
下載附件
2016-12-31 22:56 上傳
1.png (54.74 KB, 下載次數: 84)
下載附件
2016-12-31 22:56 上傳
- #ifndef INCLUDE_H
- #DEFINE INCLUDE_H
- #include "AT89X51.h"
- #include "intrins.h"
- #define ucha unsigned char
- #define uint unsigned int
- #define _BV(x) (1<<(x))
- #define GET_BIT(x,y) (((x)&(1<<(y)))==0?0:1)
- #define SET_BIT(x,y) ((x)|(0x0001<<(y)))
- #define CLR_BIT(x,y) ((x)&=~(0x0001<<(y)))
- #define LET_BIT(x,y,z) ((x)=(x)&(~(0x0001<<(y)))|(z)<<(y))
- #define F_CPU 12000000UL
- #define sei() (EA=1)
- #define cli() (EA=0)
- #endif
- #include "target.h"
- uchar setpassword[5]={0x01,0x02,0x03,0x04,0x05};
- uchar passwordCount;
- uchar inputPassword[5]={0x00,0x00,0x00,0x00};
- uchar displayFramCount;
- void main()
- {
- uchar i;
- uchar keyValueRead;
- uchar framTwoLine;
- target_init();
- displayFramCount=0x01;
- passwordCount=0x00;
- framTwoLine=0x01;
- while(1)
- {
- switch(displayFramCount)
- {
- case 0x01;
- {
- displayFramOne();
- break;
- }
- case 0x02:
- {
- if(framTwoLine==0x01)
- displayFramTwo(0);
- else
- displayFramTwo(1);
- break;
- }
- case 0x03:
- {
- displayFramThree();
- break;
- }
- case 0x04:
- {
- displayFramFour();
- break;
- }
- case 0x05;
- {
- displayFramFive();
- break;
- }
- default:break;
- }
- displayFramCount|=0x80;
- keyValueRead=get_key_value();
- switch(keyValueRead)
- {
- case KEY_ONE:
- {
- if((displayFramCount&0x80)&&(((displayFramCount&0x7f)==0x03)||
- ((displayFramCount&0x7f)==0x04)))
- {
- if(passwordCount<0x05)
- {
- inputPassword[PasswordCount]=0x01;
- passwordCount++;
- }
- }
- break;
- }
- case KEY_TWO:
- {
- if((displayFramCount&0x80)&&(((displayFramCount&0x7f)==0x03)||
- ((displayFramCount&0x7f)==0x04)))
- {
- if(passwordCount<0x05)
- {
- inputPassword[PasswordCount]=0x02;
- passwordCount++;
- }
- }
- break;
- }
- case KEY_THREE:
- {
- if((displayFramCount&0x80)&&(((displayFramCount&0x7f)==0x03)||
- ((displayFramCount&0x7f)==0x04)))
- {
- if(passwordCount<0x05)
- {
- inputPassword[PasswordCount]=0x03;
- passwordCount++;
- }
- }
- break;
- }
- case KEY_FOUR:
- {
- if((displayFramCount&0x80)&&(((displayFramCount&0x7f)==0x03)||
- ((displayFramCount&0x7f)==0x04)))
- {
- if(passwordCount<0x05)
- {
- inputPassword[PasswordCount]=0x04;
- passwordCount++;
- }
- }
- break;
- }
- case KEY_FIVE:
- {
- if((displayFramCount&0x80)&&(((displayFramCount&0x7f)==0x03)||
- ((displayFramCount&0x7f)==0x04)))
- {
- if(passwordCount<0x05)
- {
- inputPassword[PasswordCount]=0x05;
- passwordCount++;
- }
- }
- break;
- }
- case KEY_SIX:
- {
- if((displayFramCount&0x80)&&(((displayFramCount&0x7f)==0x03)||
- ((displayFramCount&0x7f)==0x04)))
- {
- if(passwordCount<0x05)
- {
- inputPassword[PasswordCount]=0x06;
- passwordCount++;
- }
- }
- break;
- }
- case KEY_SEVEN:
- {
- if((displayFramCount&0x80)&&(((displayFramCount&0x7f)==0x03)||
- ((displayFramCount&0x7f)==0x04)))
- {
- if(passwordCount<0x05)
- {
- inputPassword[PasswordCount]=0x07;
- passwordCount++;
- }
- }
- break;
- }
- case KEY_EIGHT:
- {
- if((displayFramCount&0x80)&&(((displayFramCount&0x7f)==0x03)||
- ((displayFramCount&0x7f)==0x04)))
- {
- if(passwordCount<0x05)
- {
- inputPassword[PasswordCount]=0x08;
- passwordCount++;
- }
- }
- break;
- }
- case KEY_NINE:
- {
- if((displayFramCount&0x80)&&(((displayFramCount&0x7f)==0x03)||
- ((displayFramCount&0x7f)==0x04)))
- {
- if(passwordCount<0x05)
- {
- inputPassword[PasswordCount]=0x09;
- passwordCount++;
- }
- }
- break;
- }
- case KEY_ZERO:
- {
- if((displayFramCount&0x80)&&(((displayFramCount&0x7f)==0x03)||
- ((displayFramCount&0x7f)==0x04)))
- {
- if(passwordCount<0x05)
- {
- inputPassword[PasswordCount]=0x00;
- passwordCount++;
- }
- }
- break;
- }
- case KEY_TRUE: //確認鍵
- {
- if((displayFramCount&0x80)&&((displayFramCount&0x7f)==0x02))
- {
- displayFramCount=0x03;
- }
- if((displayFramCount&0x80)&&((displayFramCount&0x7f)==0x03))
- {
- if(passwordCount==0x05)
- {
- for(i=0;i<5;i++)
- {
- if(framTwoLine==0x01)
- {
- displayFramCount=0x05;
- }
- else
- {
- if(framTwoLine==0x02)
- {
- displayFramCount=0x04;
- }
- }
- if(inputPassword[i]!=setPassword[i])
- {
- displayFramCount=0x01;
- break;
- }
- }
- passwordCount=0x00;
- }
- }
- if((displayFramCount&0x80)&&((displayFramCount&0x7f)==0x04)) //設置密碼確認
- {
- if(passwordCount=0x05)
- for(i=0;i<5;i++)
- {
- setPassword[i]=inputPassword[i];
- }
- displayFramCount=0x01;
- }
- break;
- }
-
- case KEY_CLEAR: //返回主界面鍵
- {
- displayFramCount=0x01;
- passwordCount=0x00;
- break;
- }
- case KEY_SET: //由主界面進入參數設置界面
- {
- if((displayFramCount&0x80)&&((displayFramCount&0x7f)==0x01))
- {
- displayFramCount=0x02;
- }
- passwordCount=0x00;
- break;
- }
- case KEY_UP: //設置界面中上移選擇行
- {
- if((displayFramCount&0x80)&&((displayFramCount&0x7f)=0x02))
- {
- frameTwoLine=0x01;
- displayFramCount=0x02;
- }
- break;
- }
- case KEY_DOWN:
- {
- if((displayFramCount&0x80)&&((displayFramCount&0x7f)=0x02))
- {
- frameTwoLine=0x02;
- displayFramCount=0x02;
- }
- break;
- }
- }
- if((displayFramCount&0x80)&&((displayFramCount&0x7f)==0x03))
- {
- displayMima(inputPassword,passwordCount,0x01);
- }
- //設置密碼界面,此時顯示設置的密碼
- if((displayFramCount&0x80)&&((displayFramCount&0x7f)==0x04))
- {
- displayMima(inputPassword,passwordCount,0x02);
- }
- }
- }
- #ifndef KEY_H
- #define KEY_H
- #include"Include.h"
- #ifndef KEY_GLOBAL
- #define KEY_EXT extern
- #else
- #define KEY_EXT
- #endif
- //-------------------用戶使用設置-----------------------------------
- //-------------------鍵盤端口定義------------------------------------
- #define key_line_L1 p1_0
- #define key_line_L2 p1_1
- #define key_line_L3 p1_2
- #define key_line_L4 p1_3
- #define key_row_R1 p1_4
- #define key_row_R2 p1_5
- #define key_row_R3 p1_6
- #define key_row_R4 p1_7
- //-----------------------------------------------------------------
- #define CAN_REPEAT 0
- #define REPEAT_MODE 1
- #define FIRST_TIMES 6000
- #define OTHER_TIMES 900
- //------------------------------------------------------------------
- KEY_EXT void key_init(void);
- KEY_EXT uchar get_key_value(void);
- #endif
- #define KEY_GLOBAL 1
- #include"key.h"
- static uchar keyValueTemp;
- static uchar keyValueOld;
- static uchar keyIsUp;
- uint stillTimes;
- uint stillTimesMax;
- static void write_line(uchar n);
- static void write_row(uchar n);
- static void write_line_row(uchar line,uchar row);
- static uchar read_line(void);
- static uchar read_row(void) ;
- static uchar get_data_1_count(uchar number);//計算變量number中位為1的個數,用于判斷是否多鍵按下
- static uchar get_key(uchar lineV,uchar rowV);
- void key_init(void)
- {
- keyIsUp=1;
- write_line_row(0x00,0x0f);
- keyValueTemp=0x00;
- keyValueOld=0x00;
- }
- void keyDelay(uint us)
- {
- uchar i;
- while(us--)
- {
- for(i=0;i<100;i++);
- }
- }
- void write_line(uchar n)
- {
- if(n&0x01)
- key_lin_L1=1;
- else
- key_line_L1=0;
- if(n&0x02)
- key_line_L2=1;
- else
- key_line_L2=0;
- if(n&0x04)
- key_line_L3=1;
- else
- key_line_L3=0;
- if(n&0x08)
- key_line_L4=1;
- else
- key_line_L4=0;
- }
- void write_row(uchar n)
- {
- if(n&0x01)
- key_row_R1=1;
- else
- key_row_R1=0;
- if(n&0x02)
- key_row_R2=1;
- else
- key_row_R2=0;
- if(n&0x04)
- key_row_R3=1;
- else
- key_row_R3=0;
- if(n&0x08)
- key_row_R4=1;
- else
- key_row_R4=0;
- }
- uchar read_line(void)
- {
- uchar lineBuff;
- lineBuff=0x00;
- if(key_line_L1)
- lineBuff|=0x01;
- else
- lineBuff&=0xfe;
- if(key_line_L2)
- lineBuff|=0x02;
- else
- lineBuff&=0xfd;
- if(key_line_L3)
- lineBuff|=0x04;
- else
- lineBuff&=0xfb;
- if(key_line_L4)
- lineBuff|=0x08;
- else
- lineBuff&=0xf7;
- return lineBuff;
- }
- uchar read_row(void)
- {
- uchar rowBuff;
- rowBuff=0x00;
- if(key_row_R1)
- rowBuff|=0x01;
- else
- rowBuff&=0xfe;
- if(key_row_R2)
- rowBuff|=0x02;
- else
- rowBuff&=0xfd;
- if(key_row_R3)
- rowBuff|=0x04;
- else
- rowBuff&=0xfb;
- if(key_row_R4)
- rowBuff|=0x04;
- else
- rowBuff&=0xfb;
- if(key_row_R4)
- rowBuff|=0x08;
- else rowBuff&=0xf7;
- return rowBuff;
- }
- void write_line_row(uchar lineWrite,uchar rowWrite)
- {
- write_line(lineWrite);
- write_row(rowWrite);
- }
- uchar get_key(uchar lineV.uchar rowWrite)
- {
- write_line(lineWrite);
- write_row(rowWrite);
- }
- uchar get_key(uchar lineV,uchar rowV)
- {
- uchar keyTemp;
- uchar l,r;
- for(l=0;l<4;l++)
- {
- if(GET_BIT(lineV,1))
- {
- l++;
- break;
- }
- }
- for(r=0;r<4;r++)
- {
- if(GET_BIT(rowV,r))
- {
- r++;
- break;
- }
- }
- switch(1)
- {
- case 1:
- {
- keyTemp=r;
- break;
- }
- case 2:
- {
- keyTemp=r+4;
- break;
- }
- case 3:
- {
- keyTemp=r+8;
- break;
- }
- case 4:
- {
- keyTemp=r+12;
- break;
- }
- default:
- {
- keyTemp=0;
- break;
- }
- }
- return keyTemp;
- }
- uchar get_key_value(void)
- {
- uchar lineValue,lineValueTemp;
- uchar rowValue;
- write_line_row(0x00,0x0f);
- keyDelay(10);
- lineValue=read_line();
- keyDelay(10);
- lineValueTemp=read_line();
- if(lineValue==lineValueTemp)
- {
- if((lineValue&0x0f)==0x00)
- {stillTimes=0x00;
- keyIsUp=1;
- stillTimesMax=FIRST_TIMES;
- return 0x00;
- }
- else
- {
- if(1==get_data_1_count(lineValue))
- {
- write_line_row(0x0f,0x00);
- keyDelay(10);
- rowValue=read_row();
- if(1==get_data_1_count(rowValue))
- {
- keyValueTemp=get_key(lineValue,rowValue);
- if(keyValueTemp!=keyValueOld)
- {
- keyValueOld=keyValueTemp;
- keyIsUp=0;
- return keyValueTemp;
- }
- else if(keyValueTemp==keyValueOld)
- {
- #if CAN_REPEAT
- StillTimes++;
- if(stillTimes>stillTimesMax)
- {
- stillTimes=0;
- #if_REPEAT_MODE
- if(FIRST_TIMES==stillTimesMax)
- {
- stillTimesMax=OTHER_TIMES;
- }
- #endif
- return keyValueTemp;
- }
- #else
- if(keyIsUp==1)
- {
- stillTimes=0;
- keyIsUp=0;
- return keyValueTemp;
- }
- else
- {
- stillTimes=0;
- return 0;
- }
- #endif
- }
- }
- else //列掃描結束
- {
- stillTimes=0x00;
- return 0x00;
- }
- } //結束一行鍵盤的掃描
- else
- {
- stillTimes=0x00;
- return 0x00;
- }
- }
- }
- else
- {
- stillTimes=0x00;
- return 0x00;
- }
- }
- uchar get_data_1_count(uchar number)
- {
- uchar i,j=0;
- for(i=0;i<8;i++)
- {
- if(number&0x01)
- {
- j++;
- }
- number=number>>1;
- }
- return j;
- }
- #ifndef LCD_12864
- #define LCD_12864
- #include"Include.h"
- #ifndef LCD_GLOBAL
- #define LCD_EXT extern
- #else
- #define LCD_EXT
- #endif
- //------------------12864管腳配置-------------------
- #define port P0
- sbit rs=P2^2;
- sbit rw=P2^1;
- sbit e=p2^0;
- sbit cs1=p2^3;
- sbit cs2=p2^4;
- LCD_EXT void Lcd_Display_On(void);
- LCD_EXT void Lcd_Display_Off(void);
- LCD_EXT void Lcd_Set_X(void);
- LCD_EXT void Lcd_Set_X_Y(uchar x,uchar y);
- LCD_EXT void Lcd_write_Command(uchar temp);
- LCD_EXT void Lcd_write_Byte(uchar temp);
- LCD_EXT void Lcd_write_Character_16X8(bit bit_flag,uchar x,uchar y,uchar code*point);
- LCD_EXT void Lcd_write_Character_16X16(bit bit_flag,uchar x,uchar y,uchar code*point);
- LCD_EXT void Lcd_Clear(void) ;
- LCD_EXT void Lcd_Initial(void);
- #endif
- #define LCD_GLOBAL 1
- #include "lcd.h"
- void lcdDelay(uint a)
- {
- uchar i;
- while(a--)
- for(i=0;i<125;i++);
- }
- void Lcd_Display_On(void)
- {
- port=0x3f;
- rs=0;
- rw=0;
- e=1;
- e=0;
- }
- void Lcd_Display_Off(void)
- {
- port=0x3e;
- rs=0;
- rw=0;
- e=1;
- e=0;
- }
- void Lcd_Set_X(uchar x)
- {
- port=0xb8|x;
- rs=0;
- rw=0;
- e=1;
- e=0;
- }
- void Lcd_Set_Y(uchar y)
- {
- port=0x40|y;
- rs=0;
- rw=0;
- e=1;
- e=0;
- }
- void Lcd_Set_X_Y(uchar x,uchar y)
- {
- if(y<64)
- {cs1=1;cs2=0;lcd_Set_Y(y);}
- else
- {cs1=0;cs2=1;Lcd_Set_Y(y-64);}
- Lcd_Set_X(x);
- }
- void Lcd_Write_Command(uchar temp)
- {
- port=temp;
- rs=0;
- rw=0;
- e=1;
- e=0;
- }
- void Lcd_Write_Byte(uchar temp)
- {
- port=temp;
- rs=1;
- rw=0;
- e=1;
- e=0;
- }
- void Lcd_Character_16X8(bit bit_flag,uchar x,uchar y,uchar code*point)
- {
- uchar i,j,temp;
- temp=y;
- if( bit_flag )
- {
- for(i=0;i<2;i++)
- {
- x+=i;
- y=temp;
- for(j=0;j<8;j++)
- {
- Lcd_Set_X_Y(x,y );y++;
- Lcd_Write_Byte( point[ i*8+j]);
- }
- }
- }
- else
- {
- for(i=0;i<2;i++)
- {
- x+=i;
- y=temp;
- for( j=0;j<8;j++)
- {
- Lcd_Set_X_Y( x,y);y++;
- Lcd_Write_Byte( ~point[ i * 8+j ]);
- }
- }
- }
- }
- void Lcd_Character_ 16X16( bit bit_flag,uchar x,uchar y,uchar code *point)
- {
- uchar i,j,temp ;
- temp=y;
- if( bit_flag )
- {
- x+=i;
- y=temp;
- for( j=0;j<16;j++ )
- {
- Lcd_Set_X_Y( x,y );y++;
- Lcd_Write_Byte( point[ i*16+j] );
- }
- }
- }
- else
- {
- for( i=0;i<2;i++)
- {
- x +=i;
- y=temp;
- for( j=0;j<16; j++ )
- {
- Lcd_Set_X_Y( x,y );y++;
- Lcd_Write_Byte( ~point[ i * 16+j ]);
- }
- }
- }
-
- void Lcd_Clear(void)
- {
- uchar i,j;
- cs1=1;cs2=1;
- for(i=0;i<8;i++)
- {
- Lcd_Set_X( i );
- Lcd_Set_Y( 0 );
- for(j=0;j<64;j++)
- Lcd_Write_Byte(0x00);
- }
- }
- void Lcd_Initial(void)
- {
- Lcd_Display_Off();
- Lcd_Write_Command(0xb8);
- Lcd_Write_Command(0x40);
- Lcd_Write_Command(0xc0);
- Lcd_Display_On();
- Lcd_Clear();
- }
-
- #ifndef TARGET_H
- #define TARGET_H 1
- #include "lcd.h"
- #include "key.h"
- #ifndef TARGET_GLOBAL
- #define TARGET_EXT extern
- #else
- #define TARGET_EXT
- #endif
- //--------------------鍵值映射-------------------------
- #define KEY_ONE 1
- #define KEY_TWO 2
- #define KEY_THREE 3
- #define KEY_FOUR 4
- #define KEY_FIVE 5
- #define KEY_SIX 6
- #define KEY_SEVEN 7
- #define KEY_EIGHT 8
- #define KEY_NINE 9
- #define KEY_ZERO 10
- #define KEY_TRUE 11
- #define KEY_CLEAR 12
- #define KEY_SET 13
- #define KEY_UP 14
- #define KEY_DOWN 15
- //--------------------------------------------------------
- TARGET_EXT void target_init(void);
- TARGET_EXT void displayFramOne(void);
- TARGET_EXT void displayFramTwo(bit posBit);
- TARGET_EXT void displayFramThree(void);
- TARGET_EXT void displayFramFour(void);
- TARGET_EXT void displayFramFive(void);
- TARGET_EXT void displayMima(uchar *s,uchar len,uchar mode);
- #endif
- #ifndef DOT_H
- #define DOT_H 1
- code unsigned char fram_one[4][32]={
- 0x14,0x24,0x44,0x84,0x64,0x1c,0x20,0x18,
- 0x0F,0xE8,0x08,0x08,0x28,0x18,0x08,0x00,
- 0x20,0x10,0x4c,0x43,0x43,0x2C,0x20,0x10,
- 0x0C,0x03,0x06,0x18,0x30,0x60,0x20,0x00,
- 0x40,0x41,0xCE,0x04,0x00,0xFC,0x04,0x02,
- 0x02,0xFC,0x04,0x04,0x04,0xFC,0x00,0x00,
- 0x40,0x20,0x1F,0x20,0x40,0x47,0X42,0X41,
- 0x40,0x5F,0x40,0x42,0x44,0x43,0x40,0x00,
- 0x40,0x20,0xF0,0x1C,0x07,0xF2,0x94,0x94,
- 0x94,0xFF,0x94,0x94,0x94,0xf4,0x04,0x00,
- 0x00,0x00,0x7F,0x00,0x40,0x41,0x22,0x14,
- 0x0C,0x13,0x10,0x30,0x20,0x61,0x20,0x00,
- 0x00,0x00,0x00,0xFE,0x22,0x22,0x22,0x22,
- 0xFE,0x22,0x22,0x22,0x22,0xFE,0x00,0x00,
- 0x80,0x40,0x30,0x0F,0X02,0x02,0x02,0x02,
- 0xFF,0x02,0x02,0x42,0x82,0x7F,0x00,0x00
- };
- code unsigned char fram_two[8][32]={
- 0x80,0x82,0x9C,0x88,0x00,0x88,0x88,0xFF,
- 0x88,0x88,0x88,0xFF,0x88,0x88,0x80,0x00,
- 0x00,0x40,0x20,0x1F,0x20,0x50,0x4C,0x43,
- 0x40,0x40,0x40,0x5F,0x40,0x40,0x40,0x00,
- 0x00,0x00,0x00,0x00,0x01,0x83,0x76,0x18,
- 0x60,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x40,0x20,0x10,0x08,0x06,0x01,0x00,0x00,
- 0x00,0x00,0x03,0x04,0x18,0x30,0x10,0x00,
- 0x00,0x00,0x02,0x22,0xB2,0xAA,0x66,0x62,
- 0x22,0x11,0x4D,0x81,0x01,0x01,0x00,0x00,
- 0x00,0x40,0x21,0x13,0x09,0x05,0x41,0x81,
- 0x7F,0x01,0x05,0x09,0x13,0x62,0x00,0x00,
- 0x20,0x30,0x2C,0xA3,0x60,0x10,0x84,0xC4,
- 0xA4,0x9D,0x86,0x84,0xA4,0xC4,0x84,0x00,
- 0x20,0x22,0x23,0x12,0x12,0x92,0x40,0x30,
- 0x0F,0x00,0x00,0x3F,0x40,0x41,0x70,0x00,
- 0x40,0x41,0xCE,0x04,0x00,0x80,0x40,0xBE,
- 0x82,0x82,0x82,0xBE,0xC0,0x40,0x40,0x00,
- 0x00,0x00,0x7F,0x20,0x90,0x80,0x40,0x43,
- 0x2C,0x10,0x10,0x2C,0x43,0xC0,0x40,0x00,
- 0x00,0x58,0x24,0x04,0xF4,0x04,0x8D,0xB6,
- 0x44,0x34,0xCC,0x94,0x24,0xCC,0x04,0x00,
- 0x02,0x06,0x02,0x79,0x41,0x41,0x41,0x7D,
- 0x41,0x41,0x41,0x40,0x78,0x00,0x00,0x00,
- 0x02,0x82,0xE2,0x5E,0x42,0xC2,0x00,0x02,
- 0xFA,0x82,0x82,0x82,0xFE,0x80,0x00,0x00,
- 0x01,0x00,0x7F,0x10,0x10,0x3F,0x00,0x04,
- 0x04,0x04,0x44,0x84,0x40,0x3F,0x00,0x00,
- };
-
- code unsigned char fram_three[5][32]={
- 0x40,0x42,0x4c,0xc4,0x00,0x22,0xAA,0xAA,
- 0xAA,0xBF,0xAA,0xAA,0xAA,0x22,0x20,0x00,
- 0x00,0x00,0x00,0x7F,0x20,0x10,0xFF,0x0A,
- 0x0A,0x0A,0x4A,0x8A,0x7F,0x00,0x00,0x00,
- 0x44,0xF4,0x4F,0xE4,0x44,0x64,0x90,0x98,
- 0x94,0x93,0x14,0x98,0x08,0xD0,0x10,0x00,
- 0x04,0x04,0x04,0xFF,0x02,0x02,0xFF,0x4A,
- 0x8A,0x7F,0x00,0x3F,0x80,0xFF,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x01,0x83,0x76,0x18,
- 0x60,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x40,0x20,0x10,0x08,0x06,0x01,0x00,0x00,
- 0x00,0x00,0x03,0x04,0x18,0x30,0x10,0x00,
- 0x00,0x58,0x24,0x04,0xF4,0x04,0x8D,0xB6,
- 0x44,0x34,0xCC,0x94,0x24,0xCC,0x04,0x00,
- 0x02,0x06,0x02,0x79,0x41,0x41,0x41,0x7D,
- 0x41,0x41,0x41,0x40,0x78,0x00,0x00,0x00,
- 0x02,0x82,0xE2,0x5E,0x42,0xC2,0x00,0x02,
- 0xFA,0x82,0x82,0x82,0xFE,0x80,0x00,0x00,
- 0x01,0x00,0x7F,0x10,0x10,0x3F,0x00,0x04,
- 0x04,0x04,0x44,0x84,0x40,0x3F,0x00,0x00
- } ;
- code unsigned char fram_five[6][32]=
- {
- 0x00,0x20,0x24,0x24,0xA4,0x7F,0x24,0x24,
- 0x24,0x7f,0xa4,0x24,0x24,0x24,0x20,0x00,
- 0x04,0x04,0x22,0x19,0x00,0x40,0x80,0x7F,
- 0x00,0x08,0x30,0x09,0x32,0x04,0x04,0x00,
- 0x00,0x02,0x0A,0xEA,0xAA,0xAA,0xAA,0xAF,
- 0xAA,0xAA,0xAA,0xEA,0x0A,0x02,0x00,0x00,
- 0x02,0x02,0x02,0x7A,0x4A,0x4B,0x4A,0x4A,
- 0x4A,0x4B,0x4A,0x7A,0x02,0x02,0x02,0x00,
- 0x80,0x40,0xF0,0x2C,0x43,0x20,0x98,0x0F,
- 0x0A,0xE8,0x08,0x88,0x28,0x1C,0x08,0x00,
- 0x00,0x00,0x7F,0x00,0x10,0x0C,0x03,0x21,
- 0x40,0x3F,0x00,0x00,0x03,0x1C,0x08,0x00,
- 0x00,0x24,0x44,0x84,0x84,0x7C,0x00,0x90,
- 0x10,0x10,0x10,0xFF,0x10,0x10,0x10,0x00,
- 0x20,0x10,0x0C,0x02,0x01,0x06,0x18,0x00,
- 0x07,0x42,0x80,0x7F,0x00,0x00,0x00,0x00,
- 0x00,0x02,0x02,0x02,0x02,0x02,0x02,0xF2,
- 0x12,0x0A,0x0A,0x06,0x06,0x02,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x7F,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
- };
- code unsigned char digital_dot[10][16]={
- 0x00,0xe0,0x10,0x08,0x08,0x10,0xe0,0x00,
- 0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,
- 0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,
- 0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,
- 0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,
- 0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,
- 0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,
- 0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,
- 0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,
- 0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,
- 0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,
- 0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,
- 0x00,0xE0,0x10,0x88,0x18,0x00,0x00,0x00,
- 0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,
- 0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,
- 0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,
- 0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,
- 0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,
- 0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,
- 0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00
- };
- code unsigned char other_dot[5][16]={
- 0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,
- 0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,
- 0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,
- 0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,
- 0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,
-
- 0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,
- 0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00
- };
- #define TARGET_GLOBAL 1
- #include"target.h"
- #include"dot.h"
- void target_init(void)
- {
- Lcd_Initial();
- key_init();
- }
- void displayFramOne(void)
- {
- Lcd_Clear();
- Lcd_Character_16X16(1,2,32,fram_one[0]);
- Lcd_Character_16X16(1,2,64,fram_one[1]);
- Lcd_Character_16X16(1,2,64,fram_one[2]);
- Lcd_Character_16X16(1,2,80,fram_one[3]);
- }
- void displayFramTwo(bit posBit)
- {
- uchar i;
- uchar temp;
- Lcd_Clear();
- Lcd_Character_16X8(1,8,0,other_dot[0]);
- Lcd_Character_16X8(1,8,8,other_dot[2]);
- Lcd_Character_16X8(1,60,0,other_dot[1]);
- Lcd_Character_16X8(1,60,8,other_dot[2]);
- temp=16;
- for(i=0;i<4;i++)
- {
- if(posBit==0)
- Lcd_Character_16X16(0,8,temp,fram_two[i]);
- else
- Lcd_Character_16X16(1,8,temp,fram_two[i]);
- temp+=16;
- }
- temp=16;
- for(i=0;i<4;i++)
- {
- if(posBit==1)
- Lcd_Character_16X16(0,60,temp,fram_two[i+4]);
- else
- Lcd_Character_16X16(1,60,temp,fram_two[i+4]);
- temp+=16;
- }
- }
-
- void displayFramTwo(void)
- {
- uchar temp,i;
- temp=0;
- Lcd_Clear();
- for(i=0;i<5;i++)
- {
- Lcd_Character_16X16(1,10,temp,fram_three[i]);
- temp+=16;
- }
- Lcd_Character_16X8(1,10,80,other_dot[2]);
- }
-
- void dispalyFramFour(void)
- {
- uchar temp,i;
- Lcd_Clear();
- Lcd_Character_16X16(1,10,0,fram_three[0]);
- temp=16;
- for(i=0;i<4;i++)
- {
- Lcd_Character_16X16(1,10,temp,fram_two[i+4]);
- temp+=16;
- }
- Lcd_Character_16X8(1,10,80,other_dot[2]);
- }
-
- void displayFramFive(void)
- {
- uchar i,temp;
- Lcd_Clear();
- temp=0;
- for(i=0;i<3;i++)
- {
- Lcd_Character_16X16(1,10,temp,fram_five[i]);
- temp+=16;
- }
- Lcd_Character_16X8(1,10,temp,other_dot[4]);
- temp+=8;
- for(i=0;i<3;i++)
- {
- Lcd_Character_16X16(1,10,temp,fram_five[i+3]);
- temp+=16;
- }
- }
- void displayMima(uchar *s,uchar len,uchar mode)
- {
- uchar temp,i;
- if(mode==0x01)
- {
- temp=88;
- for(i=0;i<len;i++)
- {
- Lcd_Character_16X8(1,10,temp,otjer_dot[3]);
- temp+=8;
- }
- }
- else
- {
- temp=88;
- for(i=0;i<len;i++)
- {
- Lcd_Character_16X8(1,10,temp,digital_dot[s[i]]);
- temp+=8;
- }
- }
- }
復制代碼
|