# STM32F103C8T6 TFTILI9328液晶顯示屏使用教程
硬件----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
STM32F103C8T6 TFTILI9328 ST-LINKV2下載 杜幫線
效果--------------------------------------------------------------------
代碼——————————————————————————————————————————————————————------------------------------------------
- TFT.C
- ```c
- /****************************************************************************************************
- 文件功能描述:320x240TFT驅動程序,控制TFT實現漢字,字符顯示,畫點功能。
- ****************************************************************************************************/
- #include "stm32f10x.h" //STM32器件寄存器定義頭文件,必須包含
- #include "user_Config.h" //用戶配置頭文件,用于配置硬件連接資源,位于項目文件夾下
- #include "Ascii_8x16.h" //8x16大小字符
- #include "Chinese.h" //16x16像素大小的漢字
- //**************聲明外部函數和變量**************
- extern unsigned int Device_code;
- /****************************************************************************************************
- // 實現功能: 延時
- // 輸入參數: count 設置延時時間
- ****************************************************************************************************/
- void delayms(unsigned int count)
- {
- int i,j;
- for(i=0;i
- {
- for(j=0;j<0x640;j++);
- }
- }
- /****************************************************************************************************
- // 實現功能: 寫命令
- // 輸入參數: DH 需要輸入16bits命令的高8位
- // DL 需要輸入16bits命令的低8位
- ****************************************************************************************************/
- void Write_Cmd(unsigned char DH,unsigned char DL)
- {
- CS_CLR;
- RS_CLR;
- RD_SET;
- RW_CLR;
-
- //注意:當使用8位數據口驅動16位數據模式時,使用74HC573作為IO擴展,程序如下
- GPIO_Write(DataPort,(u16)(DL | 0xff00)); //送低8位命令給573待鎖存
- LE_SET; //鎖存位
- LE_CLR; //斷開鎖存,位選573的Q7~Q0仍保持
- GPIO_Write(DataPort,(u16)(DH | 0xff00)); //送高8位命令給TFT
- /*
- //如果使用16位數據口驅動16位數據模式,則無需IO擴展,直接將數據送到數據口即可
- DataPort_L=DL;
- DataPort_H=DH;
- */
- RW_SET;
- CS_SET;
- }
- /****************************************************************************************************
- // 實現功能: 寫數據(2*8bits)
- // 輸入參數: DH 需要輸入16bits數據的高8位
- // DL 需要輸入16bits數據的低8位
- ****************************************************************************************************/
- void Write_Data(unsigned char DH,unsigned char DL)
- {
-
- CS_CLR;
- RS_SET;
- //注意:當使用8位數據口驅動16位數據模式時,使用74HC573作為IO擴展,程序如下
- GPIO_Write(DataPort,(u16)(DL | 0xff00)); //送低8位命令給573待鎖存
- LE_SET; //鎖存位
- LE_CLR; //斷開鎖存,位選573的Q7~Q0仍保持
- GPIO_Write(DataPort,(u16)(DH | 0xff00)); //送高8位命令給TFT
- /*
- //如果使用16位數據口驅動16位數據模式,則無需IO擴展,直接將數據送到數據口即可
- DataPort_L=DL;
- DataPort_H=DH;
- */
- RW_CLR;
- RW_SET;
- CS_SET;
- }
- /****************************************************************************************************
- // 實現功能: 寫數據(16位)
- // 輸入參數: y 需要輸入16bits數據
- ****************************************************************************************************/
- void Write_Data_U16(unsigned int y)
- {
- unsigned char m,n;
- m=y>>8;
- n=y;
- Write_Data(m,n);
- }
- /****************************************************************************************************
- // 實現功能: 向x寄存器寫入y數據
- // 輸入參數: x 需要輸入的命令 16位
- // y 需要輸入的數據 16位
- ****************************************************************************************************/
- void Write_Cmd_Data (unsigned char x,unsigned int y)
- {
- unsigned char m,n;
- m=y>>8;
- n=y;
- Write_Cmd(0x00,x);
- Write_Data(m,n);
- }
- /****************************************************************************************************
- // 實現功能: 設置坐標
- // 輸入參數: x0,y0 起始坐標
- // x1,y1 結束坐標
- ****************************************************************************************************/
- void LCD_SetPos(unsigned int x0,unsigned int x1,unsigned int y0,unsigned int y1)
- {
- Write_Cmd_Data(0x50,x0); // Horizontal GRAM Start Address
- Write_Cmd_Data(0x51,x1); // Horizontal GRAM End Address
- Write_Cmd_Data(0x52,y0); // Vertical GRAM Start Address
- Write_Cmd_Data(0x53,y1); // Vertical GRAM Start Address
- Write_Cmd_Data(0x20,x0); // GRAM horizontal Address
- Write_Cmd_Data(0x21,y0); // GRAM Vertical Address
- Write_Cmd (0x00,0x22); // 0x0022,Start to Write Data to GRAM
- }
- /****************************************************************************************************
- // 實現功能: TFT清屏
- // 輸入參數: bColor 清屏所使用的背景色
- ****************************************************************************************************/
- void CLR_Screen(unsigned int bColor)
- {
- unsigned int i,j;
- LCD_SetPos(0,240,0,320); //320x240,坐標從0開始
- for (i=0;i<320;i++)
- {
- for (j=0;j<240;j++)
- Write_Data_U16(bColor);
- }
- }
- /****************************************************************************************************
- // 實現功能: 顯示Ascii字符
- // 輸入參數: x 橫坐標
- // y 縱坐標
- // c 需要顯示的字符
- // fColor 字符顏色
- // bColor 字符背景顏色
- ****************************************************************************************************/
- void LCD_PutChar(unsigned int x, unsigned int y, char c, unsigned int fColor, unsigned int bColor)
- {
- unsigned int i,j;
- LCD_SetPos(x,x+8-1,y,y+16-1); //設置字符顯示位置
- for(i=0; i<16;i++)
- { //循環寫入16字節,一個字符為16字節
- unsigned char m=Font8x16[(c-0x20)*16+i]; //提取c字符的第i個字節以,c減去0x20是由于Ascii碼庫中的0~1f被去掉
- for(j=0;j<8;j++)
- { //循環寫入8位,一個字節為8位
- if((m&0x80)==0x80)
- { //判斷最高位是否為1
- Write_Data_U16(fColor); //最高位為1,寫入字符顏色
- }
- else
- {
- Write_Data_U16(bColor); //最高位為0,寫入背景顏色
- }
- m<<=1; //左移1位,準備寫下一位
- }
- }
- }
- /****************************************************************************************************
- // 實現功能: 顯示16x16漢字
- // 輸入參數: x 橫坐標
- // y 縱坐標
- // g 需要顯示的字符編碼
- // fColor 字符顏色
- // bColor 字符背景顏色
- ****************************************************************************************************/
- void Put16x16(unsigned short x, unsigned short y, unsigned char g[2], unsigned int fColor,unsigned int bColor)
- {
- unsigned int i,j,k;
-
- LCD_SetPos(x, x+16-1,y, y+16-1); //設置漢字顯示位置
- for (k=0;k<64;k++) //循環64次,查詢漢字字模位置
- {
- if ((ch16[k].GBK[0]==g[0])&&(ch16[k].GBK[1]==g[1])) //判斷第k個漢字的編碼是否與輸入漢字g[2]相等
- {
- for(i=0;i<32;i++) //如果相等,既已找到待顯示字模位置,循環寫入32字節
- {
- unsigned short m=ch16[k].hz16[i]; //讀取32字節中的第i字節
- for(j=0;j<8;j++) //循環寫入8位數據
- {
- if((m&0x80)==0x80) Write_Data_U16(fColor); //判斷最高位是否為1,最高位為1,寫入字符顏色
- else Write_Data_U16(bColor); //最高位為0,寫入背景顏色
- m<<=1; //左移1位,準備寫下一位
- }
- }
- }
- }
- }
- /****************************************************************************************************
- // 實現功能: 顯示中英文字符串
- // 輸入參數: x 橫坐標
- // y 縱坐標
- // *s 待顯示的字符串,例如LCD_PutString(24,16,"123Eee",White,Blue);即把"123Eee"的第一個字符地址賦給指針變量s.
- // bColor 字符背景顏色
- ****************************************************************************************************/
- void LCD_PutString(unsigned short x, unsigned short y, unsigned char *s, unsigned int fColor, unsigned int bColor)
- {
- unsigned char l=0; //顯示屏位置增量
-
- while(*s)
- {
- if( *s < 0x80) //判斷s指向的字符串中的某字符的編碼值是否小于128,如果小于,即為ASCII字符
- {
- LCD_PutChar(x+l*8,y,*s,fColor,bColor); //顯示該字符
- s++;l++; //指針加1,位置加1
- }
- else
- {
- Put16x16(x+l*8,y,(unsigned char*)s,fColor,bColor); //顯示該漢字
- s+=2;l+=2; //因為漢字為編碼為2字節,指針加2,顯示16x16所以位置加2
- }
- }
- }
- /****************************************************************************************************
- // 實現功能: 指定位置顯示RGB顏色
- // 輸入參數: x0,y0 起始坐標
- // x1,y1 結束坐標
- // Color 背景顏色
- ****************************************************************************************************/
- void Show_RGB (unsigned short x0,unsigned short x1,unsigned short y0,unsigned short y1,unsigned int Color)
- {
- unsigned int i,j;
-
- LCD_SetPos(x0,x1,y0,y1); //橫屏這里要進行坐標變換,如果是豎屏,則直接是x0,x1,y0,y1做參數
- for (i=y0;i<=y1;i++)
- {
- for (j=x0;j<=x1;j++)
- Write_Data_U16(Color);
- }
- }
- /****************************************************************************************************
- // 實現功能: TFT初始化
- ****************************************************************************************************/
- void TFT_Initial(void)
- {
- RST_SET;
- delayms(1); // Delay 1ms
- RST_CLR;
- delayms(10); // Delay 10ms
- RST_SET;
- delayms(50); // Delay 50 ms
- if(Device_code==0x9320)
- {
- //************* Start Initial Sequence **********//
- Write_Cmd_Data(0x00,0x0001); //Set the OSC bit as ‘1’ to start the internal oscillator
- Write_Cmd_Data(0x01,0x0100); // set SS and SM bit
- Write_Cmd_Data(0x02,0x0700); // set 1 line inversion
- Write_Cmd_Data(0x03,0x1030); //set GRAM Write direction and BGR=1
- Write_Cmd_Data(0x04,0x0000); // Resize register
- Write_Cmd_Data(0x08,0x0202); // set the back porch and front porch
- Write_Cmd_Data(0x09,0x0000); // set non-display area refresh cycle ISC[3:0]
- Write_Cmd_Data(0x0A,0x0000); // FMARK function
- Write_Cmd_Data(0x0C,0x0000); // RGB interface setting
- Write_Cmd_Data(0x0D,0x0000); // Frame marker Position
- Write_Cmd_Data(0x0F,0x0000); // RGB interface polarity
- delayms(30);
- //*************Power On sequence ****************//
- Write_Cmd_Data(0x10, 0x16b0); // SAP, BT[3:0], AP, DSTB, SLP, STB
- delayms(30);
- Write_Cmd_Data(0x11, 0x0007); //Write final user’s setting values to VC bit
- Write_Cmd_Data(0x12, 0x013a); // set Internal reference voltage
- Write_Cmd_Data(0x13, 0x1a00); // VDV[4:0] for VCOM amplitude
- delayms(30);
- Write_Cmd_Data(0x29, 0x000c); // Set VCM[5:0] for VCOMH
- delayms(30); // Delay 50ms
- // ----------- Adjust the Gamma Curve ----------//
- Write_Cmd_Data(0x0030, 0x0000);
- Write_Cmd_Data(0x0031, 0x0505);
- Write_Cmd_Data(0x0032, 0x0304);
- Write_Cmd_Data(0x0035, 0x0006);
- Write_Cmd_Data(0x0036, 0x0707);
- Write_Cmd_Data(0x0037, 0x0105);
- Write_Cmd_Data(0x0038, 0x0002);
- Write_Cmd_Data(0x0039, 0x0707);
- Write_Cmd_Data(0x003C, 0x0704);
- Write_Cmd_Data(0x003D, 0x0807);
- //------------------ Set GRAM area ---------------//
- Write_Cmd_Data(0x0050, 0x0000); // Horizontal GRAM Start Address
- Write_Cmd_Data(0x0051, 0x00EF); // Horizontal GRAM End Address
- Write_Cmd_Data(0x0052, 0x0000); // Vertical GRAM Start Address
- Write_Cmd_Data(0x0053, 0x013F); // Vertical GRAM Start Address
- Write_Cmd_Data(0x0060, 0x2700); // Gate Scan Line
- Write_Cmd_Data(0x0061, 0x0001); // NDL,VLE, REV
- Write_Cmd_Data(0x006A, 0x0000); // set scrolling line
- Write_Cmd_Data(0x20, 0x0000); // GRAM horizontal Address
- Write_Cmd_Data(0x21, 0x0000); // GRAM Vertical Address
- //-------------- Partial Display Control ---------//
- Write_Cmd_Data(0x0080, 0x0000);
- Write_Cmd_Data(0x0081, 0x0000);
- Write_Cmd_Data(0x0082, 0x0000);
- Write_Cmd_Data(0x0083, 0x0000);
- Write_Cmd_Data(0x0084, 0x0000);
- Write_Cmd_Data(0x0085, 0x0000);
- //-------------- Panel Control ---------//
- Write_Cmd_Data(0x90,0x0010); //Frame Cycle Contral
- Write_Cmd_Data(0x92,0x0000); //Panel Interface Contral
- Write_Cmd_Data(0x93,0x0003); //Panel Interface Contral 3.
- Write_Cmd_Data(0x95,0x0110); //Frame Cycle Contral
- Write_Cmd_Data(0x97,0x0000); //
- Write_Cmd_Data(0x98,0x0000); //Frame Cycle Contral.
- //-------------- Display on ---------//
- Write_Cmd_Data(0x07,0x0173);
- }
- else if(Device_code==0x1505 )
- {
- //************* Start Initial Sequence **********//
- Write_Cmd_Data(0x00,0x0001); //Set the OSC bit as ‘1’ to start the internal oscillator
- Write_Cmd_Data(0x01,0x0100); // set SS and SM bit
- Write_Cmd_Data(0x02,0x0700); // set 1 line inversion
- Write_Cmd_Data(0x03,0x1030); //set GRAM Write direction and BGR=1
- Write_Cmd_Data(0x04,0x0000); // Resize register
- Write_Cmd_Data(0x08,0x0202); // set the back porch and front porch
- Write_Cmd_Data(0x09,0x0000); // set non-display area refresh cycle ISC[3:0]
- Write_Cmd_Data(0x0A,0x0000); // FMARK function
- Write_Cmd_Data(0x0C,0x0000); // RGB interface setting
- Write_Cmd_Data(0x0D,0x0000); // Frame marker Position
- Write_Cmd_Data(0x0F,0x0000); // RGB interface polarity
- delayms(30);
- //*************Power On sequence ****************//
- Write_Cmd_Data(0x10, 0x16b0); // SAP, BT[3:0], AP, DSTB, SLP, STB
- delayms(30);
- Write_Cmd_Data(0x11, 0x0007); //Write final user’s setting values to VC bit
- Write_Cmd_Data(0x12, 0x013a); // set Internal reference voltage
- Write_Cmd_Data(0x13, 0x1a00); // VDV[4:0] for VCOM amplitude
- delayms(30);
- Write_Cmd_Data(0x29, 0x000c); // Set VCM[5:0] for VCOMH
- delayms(30); // Delay 50ms
- // ----------- Adjust the Gamma Curve ----------//
- Write_Cmd_Data(0x0030, 0x0000);
- Write_Cmd_Data(0x0031, 0x0505);
- Write_Cmd_Data(0x0032, 0x0304);
- Write_Cmd_Data(0x0035, 0x0006);
- Write_Cmd_Data(0x0036, 0x0707);
- Write_Cmd_Data(0x0037, 0x0105);
- Write_Cmd_Data(0x0038, 0x0002);
- Write_Cmd_Data(0x0039, 0x0707);
- Write_Cmd_Data(0x003C, 0x0704);
- Write_Cmd_Data(0x003D, 0x0807);
- //------------------ Set GRAM area ---------------//
- Write_Cmd_Data(0x0050, 0x0000); // Horizontal GRAM Start Address
- Write_Cmd_Data(0x0051, 0x00EF); // Horizontal GRAM End Address
- Write_Cmd_Data(0x0052, 0x0000); // Vertical GRAM Start Address
- Write_Cmd_Data(0x0053, 0x013F); // Vertical GRAM Start Address
- Write_Cmd_Data(0x0060, 0x2700); // Gate Scan Line
- Write_Cmd_Data(0x0061, 0x0001); // NDL,VLE, REV
- Write_Cmd_Data(0x006A, 0x2700); // set scrolling line
- Write_Cmd_Data(0x20, 0x0000); // GRAM horizontal Address
- Write_Cmd_Data(0x21, 0x0000); // GRAM Vertical Address
- //-------------- Partial Display Control ---------//
- Write_Cmd_Data(0x0080, 0x0000);
- Write_Cmd_Data(0x0081, 0x0000);
- Write_Cmd_Data(0x0082, 0x0000);
- Write_Cmd_Data(0x0083, 0x0000);
- Write_Cmd_Data(0x0084, 0x0000);
- Write_Cmd_Data(0x0085, 0x0000);
- //-------------- Panel Control ---------//
- Write_Cmd_Data(0x90,0x0010); //Frame Cycle Contral
- Write_Cmd_Data(0x92,0x0000); //Panel Interface Contral
- Write_Cmd_Data(0x93,0x0003); //Panel Interface Contral 3.
- Write_Cmd_Data(0x95,0x0110); //Frame Cycle Contral
- Write_Cmd_Data(0x97,0x0000); //
- Write_Cmd_Data(0x98,0x0000); //Frame Cycle Contral.
- //-------------- Display on ---------//
- Write_Cmd_Data(0x07,0x0173);
- }
- else if(Device_code==0x9328)
- {
- //************* Start Initial Sequence **********//
- Write_Cmd_Data(0x0001,0x0100); //set SS and SM bit //設置掃描方向 100
- Write_Cmd_Data(0x0002,0x0700); //EOR=1 and B/C=1 to set the line inversion //設置行反轉
- Write_Cmd_Data(0x0003,0x1030); //set Entry Mode //設置進入模式 1030
- Write_Cmd_Data(0x0004,0x0000); //
- Write_Cmd_Data(0x00A4,0x0001);
- Write_Cmd_Data(0x0008,0x0202); // set the back porch and front porch
- Write_Cmd_Data(0x0009,0x0000); // set non-display area refresh cycle ISC[3:0]
- Write_Cmd_Data(0x000A,0x0000); // FMARK function
- Write_Cmd_Data(0x000C,0x0000); // RGB interface setting
- Write_Cmd_Data(0x000D, 0x0000); // Frame marker Position
- Write_Cmd_Data(0x000F, 0x0000); // RGB interface polarity
- //*************Power On sequence ****************//
- Write_Cmd_Data(0x0010, 0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB
- Write_Cmd_Data(0x0011, 0x0007); // DC1[2:0], DC0[2:0], VC[2:0]
- Write_Cmd_Data(0x0012, 0x0000); // VREG1OUT voltage
- Write_Cmd_Data(0x0013, 0x0000); // VDV[4:0] for VCOM amplitude
- delayms(30);
- Write_Cmd_Data(0x0010, 0x1690); // SAP, BT[3:0], AP, DSTB, SLP, STB
- Write_Cmd_Data(0x0011, 0x0227); // R11h=0x0221 at VCI=3.3V, DC1[2:0], DC0[2:0], VC[2:0]
- delayms(30);
- Write_Cmd_Data(0x0012, 0x001C); // External reference voltage= Vci;
- delayms(30);
- Write_Cmd_Data(0x0013, 0x1800); // R13=1200 when R12=009D;VDV[4:0] for VCOM amplitude
- Write_Cmd_Data(0x0029, 0x001C); // R29=000C when R12=009D;VCM[5:0] for VCOMH
- Write_Cmd_Data(0x002B, 0x000D); // Frame Rate = 91Hz
- delayms(30);
- Write_Cmd_Data(0x0020, 0x0000); // GRAM horizontal Address
- Write_Cmd_Data(0x0021, 0x0000); // GRAM Vertical Address
- // ----------- Adjust the Gamma Curve ----------//
- Write_Cmd_Data(0x0030, 0x0007);
- Write_Cmd_Data(0x0031, 0x0302);
- Write_Cmd_Data(0x0032, 0x0105);
- Write_Cmd_Data(0x0035, 0x0206);
- Write_Cmd_Data(0x0036, 0x0808);
- Write_Cmd_Data(0x0037, 0x0206);
- Write_Cmd_Data(0x0038, 0x0504);
- Write_Cmd_Data(0x0039, 0x0007);
- Write_Cmd_Data(0x003C, 0x0105);
- Write_Cmd_Data(0x003D, 0x0808);
- //------------------ Set GRAM area ---------------//
- Write_Cmd_Data(0x0050, 0x0000); // Horizontal GRAM Start Address
- Write_Cmd_Data(0x0051, 0x00EF); // Horizontal GRAM End Address
- Write_Cmd_Data(0x0052, 0x0000); // Vertical GRAM Start Address
- delayms(30);
- Write_Cmd_Data(0x0053, 0x013F); // Vertical GRAM Start Address
- delayms(30);
- Write_Cmd_Data(0x0060, 0xA700); // Gate Scan Line
- Write_Cmd_Data(0x0061, 0x0001); // NDL,VLE, REV
- Write_Cmd_Data(0x006A, 0x0000); // set scrolling line
- //-------------- Partial Display Control ---------//
- Write_Cmd_Data(0x0080, 0x0000);
- Write_Cmd_Data(0x0081, 0x0000);
- Write_Cmd_Data(0x0082,0x0000);
- Write_Cmd_Data(0x0083,0x0000);
- Write_Cmd_Data(0x0084,0x0000);
- Write_Cmd_Data(0x0085,0x0000);
- //-------------- Panel Control -------------------//
- Write_Cmd_Data(0x0090, 0x0010);
- Write_Cmd_Data(0x0092, 0x0000);
- Write_Cmd_Data(0x0093, 0x0003);
- Write_Cmd_Data(0x0095, 0x0110);
- Write_Cmd_Data(0x0097, 0x0000);
- Write_Cmd_Data(0x0098, 0x0000);
- Write_Cmd_Data(0x0007, 0x0133); // 262K color and display ON
- }
- }
- /****************************************************************************************************
- // 實現功能: 畫點
- // 輸入參數: x,y 需要畫點坐標
- // color 點的顏色
- ****************************************************************************************************/
- void Put_pixel(unsigned int x,unsigned int y,unsigned int color)
- {
- LCD_SetPos(x,x,y,y); //橫屏這里要進行坐標變換,如果是豎屏,則直接是x0,x1,y0,y1做參數
- Write_Data_U16(color); //在指定點寫入顏色數據
- }
- ```
- TFT.H
- ```c
- #ifndef uchar
- #define uchar unsigned char
- #endif
- #ifndef uint
- #define uint unsigned int
- #endif
- unsigned char pic[];
- void TFT_Initial(void);
- void show_colour_bar (void);
- void Write_Cmd_Data(unsigned char x, unsigned int y);
- void Write_Cmd(unsigned char DH,unsigned char DL);
- void Write_Data(unsigned char DH,unsigned char DL);
- void delayms(unsigned int tt);
- void show_photo(void);
- void Show_RGB (unsigned int x0,unsigned int x1,unsigned int y0,unsigned int y1,unsigned int Color);
- void Write_Data_U16(unsigned int y);
- void CLR_Screen(unsigned int bColor);
- void PutGB3232(unsigned short x, unsigned short y, unsigned char c[2], unsigned int fColor,unsigned int bColor);
- void LCD_PutChar(unsigned short x, unsigned short y, char c, unsigned int fColor, unsigned int bColor);
- void LCD_PutString(unsigned short x, unsigned short y, unsigned char *s, unsigned int fColor, unsigned int bColor);
- void LCD_PutString24(unsigned short x, unsigned short y, unsigned char *s, unsigned int fColor, unsigned int bColor);
- void LCD_PutChar8x8(unsigned short x, unsigned short y, char c, unsigned int fColor, unsigned int bColor);
- void Put16x16(unsigned short x, unsigned short y, unsigned char g[2], unsigned int fColor,unsigned int bColor);
- void Put_pixel(unsigned int x,unsigned int y,unsigned int color);
- void address_set(unsigned int x1,unsigned int y1,unsigned int x2,unsigned int y2);
- void LCD_SetPos(unsigned short x0,unsigned short x1,unsigned short y0,unsigned short y1);
- void line(int x1,int y1,int x2,int y2,int color);
- void draw_circle(int x, int y, int r, int color);
- void LCD_PutSingleChar(unsigned int x, unsigned int y, char c, unsigned int fColor, unsigned int bColor);
- void Line( uchar X0,
- uchar Y0,
- uchar X1,
- uchar Y1,
- unsigned int color);
- void Rectangle( uchar left,
- uchar top,
- uchar right,
- uchar bottom,
- unsigned int color);
- void Bar( uchar left,
- uchar top,
- uchar right,
- uchar bottom,
- unsigned int color);
- ```
- user_Config.h
- ```c
- /*2.8寸TFT觸摸屏接口定義*/
- #define GPIO_TFT_DATA GPIOA //數據口PA0~PA7
- #define RCC_GPIO_TFT RCC_APB2Periph_GPIOA
- #define GPIO_CTRB GPIOB //控制口PB8~PB13
- #define RCC_GPIO_CTRB RCC_APB2Periph_GPIOB
- #define RS_CLR GPIO_ResetBits(GPIO_CTRB, GPIO_Pin_13) //RS置低
- #define RS_SET GPIO_SetBits(GPIO_CTRB, GPIO_Pin_13) //RS置高
- #define RW_CLR GPIO_ResetBits(GPIO_CTRB, GPIO_Pin_12) //RW置低
- #define RW_SET GPIO_SetBits(GPIO_CTRB, GPIO_Pin_12) //RW置高
- #define RD_CLR GPIO_ResetBits(GPIO_CTRB, GPIO_Pin_11) //E RD置低
- #define RD_SET GPIO_SetBits(GPIO_CTRB, GPIO_Pin_11) //E ED置高
- #define CS_CLR GPIO_ResetBits(GPIO_CTRB, GPIO_Pin_10) //CS置低
- #define CS_SET GPIO_SetBits(GPIO_CTRB, GPIO_Pin_10) //CS置高
- #define RST_CLR GPIO_ResetBits(GPIO_CTRB, GPIO_Pin_9) //RST置低
- #define RST_SET GPIO_SetBits(GPIO_CTRB, GPIO_Pin_9) //RST置高
- #define LE_CLR GPIO_ResetBits(GPIO_CTRB, GPIO_Pin_8) //LE置低
- #define LE_SET GPIO_SetBits(GPIO_CTRB, GPIO_Pin_8) //LE置高
- #define DataPort GPIOA //PA口為數據口
- #define D0 GPIO_Pin_0 //D0使用的GPIO管腳
- #define D1 GPIO_Pin_1 //D1使用的GPIO管腳
- #define D2 GPIO_Pin_2 //D2使用的GPIO管腳
- #define D3 GPIO_Pin_3 //D3使用的GPIO管腳
- #define D4 GPIO_Pin_4 //D4使用的GPIO管腳
- #define D5 GPIO_Pin_5 //D5使用的GPIO管腳
- #define D6 GPIO_Pin_6 //D6使用的GPIO管腳
- #define D7 GPIO_Pin_7 //D7使用的GPIO管腳
- /*全局變量-顏色代碼*/
- #define White 0xFFFF //顯示顏色代碼
- #define Black 0x0000
- #define Blue 0x001F
- #define Blue2 0x051F
- #define Red 0xF800
- #define Magenta 0xF81F
- #define Green 0x07E0
- #define Cyan 0x7FFF
- #define Yellow 0xFFE0
- /*函數聲明區*/
- void RCC_Configuration(void);
- void NVIC_Configuration(void);
- void Delay(vu32 nCount);
- ```
- Ascii_8x16.h
- ```c
- //ASCII碼的0x20~0x7f,0x00~0x1f為控制命令,所以被去掉
- const unsigned char Font8x16[] =
- {
- /*-- 文字: ASCII值0x20--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- /*-- 文字: ! ASCII值0x21--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x18,0x18,0x00,0x00,
- /*-- 文字: " ASCII值0x22--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x12,0x36,0x24,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- /*-- 文字: # ASCII值0x23--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x24,0x24,0x24,0xFE,0x48,0x48,0x48,0xFE,0x48,0x48,0x48,0x00,0x00,
- /*-- 文字: [ DISCUZ_CODE_12 ]nbsp; ASCII值0x24--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x10,0x38,0x54,0x54,0x50,0x30,0x18,0x14,0x14,0x54,0x54,0x38,0x10,0x10,
- /*-- 文字: % ASCII值0x25--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x44,0xA4,0xA8,0xA8,0xA8,0x54,0x1A,0x2A,0x2A,0x2A,0x44,0x00,0x00,
- /*-- 文字: & ASCII值0x26--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x30,0x48,0x48,0x48,0x50,0x6E,0xA4,0x94,0x88,0x89,0x76,0x00,0x00,
- /*-- 文字: ' ASCII值0x27--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x60,0x60,0x20,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- /*-- 文字: ( ASCII值0x28--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x02,0x04,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x08,0x04,0x02,0x00,
- /*-- 文字: ) ASCII值0x29--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x40,0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40,0x00,
- /*-- 文字: * ASCII值0x2a--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x10,0x10,0xD6,0x38,0x38,0xD6,0x10,0x10,0x00,0x00,0x00,0x00,
- /*-- 文字: + ASCII值0x2b--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x00,0x00,0x00,
- /*-- 文字: , ASCII值0x2c--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x20,0xC0,
- /*-- 文字: - ASCII值0x2d--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- /*-- 文字: . ASCII值0x2e--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,
- /*-- 文字: / ASCII值0x2f--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x01,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,
- /*-- 文字: 0 ASCII值0x30--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18,0x00,0x00,
- /*-- 文字: 1 ASCII值0x31--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x10,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,
- /*-- 文字: 2 ASCII值0x32--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x04,0x04,0x08,0x10,0x20,0x42,0x7E,0x00,0x00,
- /*-- 文字: 3 ASCII值0x33--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x3C,0x42,0x42,0x04,0x18,0x04,0x02,0x02,0x42,0x44,0x38,0x00,0x00,
- /*-- 文字: 4 ASCII值0x34--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x04,0x0C,0x14,0x24,0x24,0x44,0x44,0x7E,0x04,0x04,0x1E,0x00,0x00,
- /*-- 文字: 5 ASCII值0x35--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x58,0x64,0x02,0x02,0x42,0x44,0x38,0x00,0x00,
- /*-- 文字: 6 ASCII值0x36--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x1C,0x24,0x40,0x40,0x58,0x64,0x42,0x42,0x42,0x24,0x18,0x00,0x00,
- /*-- 文字: 7 ASCII值0x37--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x7E,0x44,0x44,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,
- /*-- 文字: 8 ASCII值0x38--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x24,0x18,0x24,0x42,0x42,0x42,0x3C,0x00,0x00,
- /*-- 文字: 9 ASCII值0x39--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x26,0x1A,0x02,0x02,0x24,0x38,0x00,0x00,
- /*-- 文字: : ASCII值0x3a--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,
- /*-- 文字: ; ASCII值0x3b--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x20,
- /*-- 文字: < ASCII值0x3c--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x02,0x00,0x00,
- /*-- 文字: = ASCII值0x3d--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,
- /*-- 文字: > ASCII值0x3e--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x20,0x40,0x00,0x00,
- /*-- 文字: ? ASCII值0x3f--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x3C,0x42,0x42,0x62,0x02,0x04,0x08,0x08,0x00,0x18,0x18,0x00,0x00,
- /*-- 文字: @ ASCII值0x40--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x38,0x44,0x5A,0xAA,0xAA,0xAA,0xAA,0xB4,0x42,0x44,0x38,0x00,0x00,
- /*-- 文字: A ASCII值0x41--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x10,0x10,0x18,0x28,0x28,0x24,0x3C,0x44,0x42,0x42,0xE7,0x00,0x00,
- /*-- 文字: B ASCII值0x42--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0xF8,0x44,0x44,0x44,0x78,0x44,0x42,0x42,0x42,0x44,0xF8,0x00,0x00,
- /*-- 文字: C ASCII值0x43--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x3E,0x42,0x42,0x80,0x80,0x80,0x80,0x80,0x42,0x44,0x38,0x00,0x00,
- /*-- 文字: D ASCII值0x44--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0xF8,0x44,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x44,0xF8,0x00,0x00,
- /*-- 文字: E ASCII值0x45--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0xFC,0x42,0x48,0x48,0x78,0x48,0x48,0x40,0x42,0x42,0xFC,0x00,0x00,
- /*-- 文字: F ASCII值0x46--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0xFC,0x42,0x48,0x48,0x78,0x48,0x48,0x40,0x40,0x40,0xE0,0x00,0x00,
- /*-- 文字: G ASCII值0x47--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x3C,0x44,0x44,0x80,0x80,0x80,0x8E,0x84,0x44,0x44,0x38,0x00,0x00,
- /*-- 文字: H ASCII值0x48--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0xE7,0x42,0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,
- /*-- 文字: I ASCII值0x49--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,
- /*-- 文字: J ASCII值0x4a--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x3E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x88,0xF0,
- /*-- 文字: K ASCII值0x4b--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0xEE,0x44,0x48,0x50,0x70,0x50,0x48,0x48,0x44,0x44,0xEE,0x00,0x00,
- /*-- 文字: L ASCII值0x4c--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0xE0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x42,0xFE,0x00,0x00,
- /*-- 文字: M ASCII值0x4d--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0xEE,0x6C,0x6C,0x6C,0x6C,0x54,0x54,0x54,0x54,0x54,0xD6,0x00,0x00,
- /*-- 文字: N ASCII值0x4e--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0xC7,0x62,0x62,0x52,0x52,0x4A,0x4A,0x4A,0x46,0x46,0xE2,0x00,0x00,
- /*-- 文字: O ASCII值0x4f--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x44,0x38,0x00,0x00,
- /*-- 文字: P ASCII值0x50--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0xFC,0x42,0x42,0x42,0x42,0x7C,0x40,0x40,0x40,0x40,0xE0,0x00,0x00,
- /*-- 文字: Q ASCII值0x51--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x82,0xB2,0xCA,0x4C,0x38,0x06,0x00,
- /*-- 文字: R ASCII值0x52--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0xFC,0x42,0x42,0x42,0x7C,0x48,0x48,0x44,0x44,0x42,0xE3,0x00,0x00,
- /*-- 文字: S ASCII值0x53--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x3E,0x42,0x42,0x40,0x20,0x18,0x04,0x02,0x42,0x42,0x7C,0x00,0x00,
- /*-- 文字: T ASCII值0x54--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0xFE,0x92,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,
- /*-- 文字: U ASCII值0x55--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0xE7,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,
- /*-- 文字: V ASCII值0x56--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0xE7,0x42,0x42,0x44,0x24,0x24,0x28,0x28,0x18,0x10,0x10,0x00,0x00,
- /*-- 文字: W ASCII值0x57--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0xD6,0x92,0x92,0x92,0x92,0xAA,0xAA,0x6C,0x44,0x44,0x44,0x00,0x00,
- /*-- 文字: X ASCII值0x58--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x18,0x18,0x18,0x24,0x24,0x42,0xE7,0x00,0x00,
- /*-- 文字: Y ASCII值0x59--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0xEE,0x44,0x44,0x28,0x28,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,
- /*-- 文字: Z ASCII值0x5a--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x7E,0x84,0x04,0x08,0x08,0x10,0x20,0x20,0x42,0x42,0xFC,0x00,0x00,
- /*-- 文字: [ ASCII值0x5b--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x1E,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1E,0x00,
- /*-- 文字: \ ASCII值0x5c--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x10,0x08,0x08,0x04,0x04,0x04,0x02,0x02,
- /*-- 文字: ] ASCII值0x5d--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x78,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x78,0x00,
- /*-- 文字: ^ ASCII值0x5e--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x1C,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- /*-- 文字: _ ASCII值0x5f--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
- /*-- 文字: ` ASCII值0x60--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- /*-- 文字: a ASCII值0x61--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x1E,0x22,0x42,0x42,0x3F,0x00,0x00,
- /*-- 文字: b ASCII值0x62--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0xC0,0x40,0x40,0x40,0x58,0x64,0x42,0x42,0x42,0x64,0x58,0x00,0x00,
- /*-- 文字: c ASCII值0x63--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x40,0x40,0x40,0x22,0x1C,0x00,0x00,
- /*-- 文字: d ASCII值0x64--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x06,0x02,0x02,0x02,0x1E,0x22,0x42,0x42,0x42,0x26,0x1B,0x00,0x00,
- /*-- 文字: e ASCII值0x65--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x7E,0x40,0x40,0x42,0x3C,0x00,0x00,
- /*-- 文字: f ASCII值0x66--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x0F,0x11,0x10,0x10,0x7E,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,
- /*-- 文字: g ASCII值0x67--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x44,0x44,0x38,0x40,0x3C,0x42,0x42,0x3C,
- /*-- 文字: h ASCII值0x68--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0xC0,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,
- /*-- 文字: i ASCII值0x69--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,
- /*-- 文字: j ASCII值0x6a--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x0C,0x0C,0x00,0x00,0x1C,0x04,0x04,0x04,0x04,0x04,0x04,0x44,0x78,
- /*-- 文字: k ASCII值0x6b--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0xC0,0x40,0x40,0x40,0x4E,0x48,0x50,0x68,0x48,0x44,0xEE,0x00,0x00,
- /*-- 文字: l ASCII值0x6c--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,
- /*-- 文字: m ASCII值0x6d--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x49,0x49,0x49,0x49,0x49,0xED,0x00,0x00,
- /*-- 文字: n ASCII值0x6e--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xDC,0x62,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,
- /*-- 文字: o ASCII值0x6f--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,
- /*-- 文字: p ASCII值0x70--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD8,0x64,0x42,0x42,0x42,0x44,0x78,0x40,0xE0,
- /*-- 文字: q ASCII值0x71--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x22,0x42,0x42,0x42,0x22,0x1E,0x02,0x07,
- /*-- 文字: r ASCII值0x72--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0x32,0x20,0x20,0x20,0x20,0xF8,0x00,0x00,
- /*-- 文字: s ASCII值0x73--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x40,0x3C,0x02,0x42,0x7C,0x00,0x00,
- /*-- 文字: t ASCII值0x74--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x10,0x10,0x10,0x0C,0x00,0x00,
- /*-- 文字: u ASCII值0x75--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC6,0x42,0x42,0x42,0x42,0x46,0x3B,0x00,0x00,
- /*-- 文字: v ASCII值0x76--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x28,0x10,0x10,0x00,0x00,
- /*-- 文字: w ASCII值0x77--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD7,0x92,0x92,0xAA,0xAA,0x44,0x44,0x00,0x00,
- /*-- 文字: x ASCII值0x78--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x24,0x18,0x18,0x18,0x24,0x76,0x00,0x00,
- /*-- 文字: y ASCII值0x79--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x28,0x18,0x10,0x10,0xE0,
- /*-- 文字: z ASCII值0x7a--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x44,0x08,0x10,0x10,0x22,0x7E,0x00,0x00,
- /*-- 文字: { ASCII值0x7b--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x03,0x04,0x04,0x04,0x04,0x04,0x08,0x04,0x04,0x04,0x04,0x04,0x04,0x03,0x00,
- /*-- 文字: | ASCII值0x7c--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
- /*-- 文字: } ASCII值0x7d--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x60,0x10,0x10,0x10,0x10,0x10,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x60,0x00,
- /*-- 文字: ~ ASCII值0x7e--*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x30,0x4C,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- /*-- 文字: ASCII值0x7f--*/
- /*-- Fixedsys11; 此字體下對應的點陣為:寬x高=8x16 --*/
- 0x00,0x00,0x00,0x7E,0x7E,0x7E,0x7E,0x7E,0x7E,0x7E,0x7E,0x7E,0x00,0x00,0x00,0x00
- };
- ```
- Chinese.h
- ```c
- /////////////////////////////////////////////////////////////////////////
- // 漢字取模步驟:1、在文字輸入區輸入漢字;2、在輸入區鼠標右鍵選擇字體,字體選Fixedsys,大小選12號,即16x16,后點確定
- // 3、鍵盤輸入CTRL+ENTER組合鍵,4、點擊左邊菜單"取模方式-》C51格式",即會在點陣生成區中顯示結果。
- //注意:軟件默認為橫向取模,如果需要修改取模方式,點擊左邊菜單"參數設置-》其他選項"即可修改.
- /////////////////////////////////////////////////////////////////////////
- // ------------------ 漢字字模數據結構體定義 ------------------------ //
- const struct hz16_tab //結構體名hz16_tab
- {
- unsigned char GBK[2]; //編譯器在編譯漢字時會編譯成GBK碼,每個漢字為兩字節,例如"北"字內碼為0xb1b1.
- unsigned char hz16[32]; //每個16x16漢字為16x16/8=32字節
- } ch16[] = //數據表
- {
- "合",0x01,0x00,0x02,0x80,0x04,0x40,0x08,0x20,0x10,0x18,0x20,0x2E,0xDF,0xF4,0x00,0x00,
- 0x00,0x00,0x1F,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x1F,0xF0,0x10,0x10,0x00,0x00,
- /*-- 文字: 肥 --*/
- /*-- Fixedsys12; 此字體下對應的點陣為:寬x高=16x16 --*/
- "肥",0x00,0x00,0x3D,0xFC,0x25,0x24,0x25,0x24,0x3D,0x24,0x25,0x24,0x25,0xFC,0x25,0x04,
- 0x3D,0x00,0x25,0x00,0x25,0x00,0x25,0x00,0x45,0x02,0x55,0x02,0x88,0xFE,0x00,0x00,
- /*-- 文字: 煒 --*/
- /*-- Fixedsys12; 此字體下對應的點陣為:寬x高=16x16 --*/
- "煒",0x10,0x40,0x10,0x40,0x17,0xFE,0x14,0x40,0x54,0x40,0x5B,0xFC,0x50,0x40,0x90,0x40,
- 0x17,0xFE,0x10,0x42,0x28,0x42,0x24,0x42,0x44,0x54,0x40,0x48,0x80,0x40,0x00,0x40,
- /*-- 文字: 煌 --*/
- /*-- Fixedsys12; 此字體下對應的點陣為:寬x高=16x16 --*/
- "煌",0x10,0x40,0x10,0x80,0x13,0xFC,0x16,0x04,0x1B,0xFC,0x52,0x04,0x53,0xFC,0x90,0x00,
- 0x13,0xFC,0x30,0x40,0x2B,0xFC,0x24,0x40,0x44,0x44,0x47,0xFE,0x80,0x00,0x00,0x00,
- /*-- 文字: 電 --*/
- /*-- Fixedsys12; 此字體下對應的點陣為:寬x高=16x16 --*/
- "電",0x01,0x00,0x01,0x00,0x01,0x00,0x3F,0xF8,0x21,0x08,0x21,0x08,0x3F,0xF8,0x21,0x08,
- 0x21,0x08,0x21,0x08,0x3F,0xF8,0x21,0x08,0x01,0x02,0x01,0x02,0x00,0xFE,0x00,0x00,
- /*-- 文字: 子 --*/
- /*-- Fixedsys12; 此字體下對應的點陣為:寬x高=16x16 --*/
- "子",0x00,0x00,0x3F,0xF0,0x00,0x20,0x00,0x40,0x00,0x80,0x01,0x00,0x01,0x00,0x01,0x04,
- 0xFF,0xFE,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x05,0x00,0x02,0x00,
- /*-- 文字: 有 --*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=16x16 --*/
- "有",0x01,0x00,0x01,0x00,0x7F,0xFE,0x02,0x00,0x04,0x00,0x0F,0xF0,0x18,0x10,0x28,0x10,
- 0x4F,0xF0,0x88,0x10,0x08,0x10,0x0F,0xF0,0x08,0x10,0x08,0x90,0x08,0x70,0x08,0x20,
- /*-- 文字: 限 --*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=16x16 --*/
- "限",0x00,0x00,0xFB,0xF8,0x92,0x08,0x93,0xF8,0xA2,0x08,0xA2,0x08,0x93,0xF8,0x8A,0x80,
- 0x8A,0x48,0xAA,0x50,0x92,0x20,0x82,0x20,0x82,0x10,0x82,0x8E,0x83,0x04,0x82,0x00,
- /*-- 文字: 公 --*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=16x16 --*/
- "公",0x00,0x00,0x04,0x40,0x06,0x40,0x04,0x40,0x08,0x20,0x08,0x10,0x10,0x18,0x22,0x0E,
- 0x43,0x04,0x02,0x00,0x04,0x20,0x08,0x10,0x11,0xF8,0x3F,0x18,0x10,0x10,0x00,0x00,
- /*-- 文字: 司 --*/
- /*-- 宋體12; 此字體下對應的點陣為:寬x高=16x16 --*/
- "司",0x00,0x00,0x3F,0xFC,0x00,0x04,0x00,0x04,0x7F,0xE4,0x00,0x04,0x00,0x04,0x3F,0xC4,
- 0x20,0x44,0x20,0x44,0x3F,0xC4,0x20,0x44,0x20,0x04,0x00,0x14,0x00,0x08,0x00,0x00,
- /*-- 文字: 面 --*/
- /*-- Fixedsys12; 此字體下對應的點陣為:寬x高=16x16 --*/
- "面",0x00,0x00,0x7F,0xFE,0x02,0x00,0x04,0x00,0x3F,0xFC,0x24,0x44,0x24,0x44,0x27,0xC4,
- 0x24,0x44,0x24,0x44,0x27,0xC4,0x24,0x44,0x24,0x44,0x3F,0xFC,0x20,0x04,0x00,0x00,
- /*-- 文字: 向 --*/
- /*-- Fixedsys12; 此字體下對應的點陣為:寬x高=16x16 --*/
- "向",0x02,0x00,0x04,0x00,0x3F,0xFC,0x20,0x04,0x20,0x04,0x27,0xE4,0x24,0x24,0x24,0x24,
- 0x24,0x24,0x24,0x24,0x27,0xE4,0x24,0x24,0x20,0x04,0x20,0x14,0x20,0x08,0x00,0x00,
- /*-- 文字: 教 --*/
- /*-- Fixedsys12; 此字體下對應的點陣為:寬x高=16x16 --*/
- "教",0x08,0x20,0x08,0x20,0x7F,0x20,0x0A,0x7E,0xFF,0xC4,0x08,0x44,0x10,0xC4,0x3E,0x48,
- 0xC4,0x28,0x08,0x28,0x0F,0x10,0xF8,0x10,0x08,0x28,0x08,0xC8,0x2B,0x06,0x10,0x04,
- /*-- 文字: 學 --*/
- /*-- Fixedsys12; 此字體下對應的點陣為:寬x高=16x16 --*/
- "學",0x01,0x08,0x10,0x8C,0x0C,0xC8,0x08,0x90,0x7F,0xFE,0x40,0x04,0x8F,0xE8,0x00,0x40,
- 0x00,0x80,0x7F,0xFE,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x02,0x80,0x01,0x00,
- /*-- 文字: 面 --*/
- /*-- Fixedsys12; 此字體下對應的點陣為:寬x高=16x16 --*/
- "面",0x00,0x00,0x7F,0xFE,0x02,0x00,0x04,0x00,0x3F,0xFC,0x24,0x44,0x24,0x44,0x27,0xC4,
- 0x24,0x44,0x24,0x44,0x27,0xC4,0x24,0x44,0x24,0x44,0x3F,0xFC,0x20,0x04,0x00,0x00,
- /*-- 文字: 向 --*/
- /*-- Fixedsys12; 此字體下對應的點陣為:寬x高=16x16 --*/
- "向",0x02,0x00,0x04,0x00,0x3F,0xFC,0x20,0x04,0x20,0x04,0x27,0xE4,0x24,0x24,0x24,0x24,
- 0x24,0x24,0x24,0x24,0x27,0xE4,0x24,0x24,0x20,0x04,0x20,0x14,0x20,0x08,0x00,0x00,
- /*-- 文字: 開 --*/
- /*-- Fixedsys12; 此字體下對應的點陣為:寬x高=16x16 --*/
- "開",0x00,0x00,0x7F,0xFE,0x04,0x20,0x04,0x20,0x04,0x20,0x04,0x20,0xFF,0xFE,0x04,0x20,
- 0x04,0x20,0x04,0x20,0x08,0x20,0x08,0x20,0x10,0x20,0x20,0x20,0x40,0x20,0x00,0x00,
- /*-- 文字: 發 --*/
- /*-- Fixedsys12; 此字體下對應的點陣為:寬x高=16x16 --*/
- "發",0x02,0x00,0x22,0x40,0x22,0x30,0x22,0x10,0x7F,0xFE,0x24,0x00,0x04,0x00,0x07,0xE0,
- 0x0C,0x20,0x0A,0x20,0x0A,0x20,0x11,0x40,0x20,0x80,0x41,0x60,0x86,0x1C,0x18,0x08
- };
復制代碼
|