ورود به حساب ثبت نام جدید فراموشی کلمه عبور
برای ورود به حساب کاربری خود، نام کاربری و کلمه عبورتان را در زیر وارد کرده و روی «ورود به سایت» کلیک کنید.





اگر فرم ورود برای شما نمایش داده نمیشود، اینجا را کلیک کنید.









اگر فرم ثبت نام برای شما نمایش داده نمی‌شود، اینجا را کلیک کنید.









اگر فرم بازیابی کلمه عبور برای شما نمایش داده نمی‌شود، اینجا را کلیک کنید.






جهت تبلیغ در وب سایت ECA کلیک کنید.

کاربران برچسب زده شده

نمایش نتایج: از 1 به 9 از 9
  1. #1
    2007/08/02
    1,297
    789

    وجود لرزش در یک طرف lcd 4.3 اینچ فروشگاه

    با درود و خسته نباشید
    من ماژول کامل ال سی دی 4.3 فروشگاه خریدم ولی نمیدونم چرا سمت راست ال سی دی هر تصویری که قرار میدم لبه داره . ثابت هم نیست هی میزنه
    ولی تقریبا از وسط به سمت چپ تصویر و متن عالیه
    فرکانس میکرو روی 64 مگ تنظیم کردم ولی با سرعت 36 مگ هم همین بود
  2. #2
    2014/01/25
    شهرکرد
    247
    267

    پاسخ : وجود لرزش در یک طرف lcd 4.3 اینچ فروشگاه

    درایور نمایشگر SSD1963 استفاده کردی ؟؟؟ این مشکل بخاطر اینه که تایمینگ برنامه به تایمینگ نمایشگر همخوانی نداره، اونها رو از روی دیتاشیت نمایشگر ببین و جایگذاری کن.
  3. #3
    2008/12/26
    384
    114

    پاسخ : وجود لرزش در یک طرف lcd 4.3 اینچ فروشگاه

    سلام
    یه نمونه کد راه اندازی تست شده دیگه پیدا کن و اون قسمت کامند ها رو با کامندهای برنامه قبلیت تغییر بده
    بقول دوستمون در کامندها بگرد تایمینگ رو پیدا کن و برنامه قبلیت رو با اون تنظیم کن
  4. #4
    2007/08/02
    1,297
    789

    پاسخ : وجود لرزش در یک طرف lcd 4.3 اینچ فروشگاه

    نقل قول نوشته اصلی توسط mohammadne

    مهمان عزیز شما حق دیدن لینک ها را ندارید

    عضویت

    درایور نمایشگر SSD1963 استفاده کردی ؟؟؟ این مشکل بخاطر اینه که تایمینگ برنامه به تایمینگ نمایشگر همخوانی نداره، اونها رو از روی دیتاشیت نمایشگر ببین و جایگذاری کن.
    ممنون جناب

    مهمان عزیز شما حق دیدن لینک ها را ندارید

    عضویت


    من توی سرچ هایی که زدم شما ظاهرا قبلا توی درایو این ال سی دی مشکل داشتید(توی سایت ایران میکرو) و بر طرفش کردید مثلا توی فارسی نویسی توی ال سی دی . من هم همین مشکل دارم توی کیل فارسی مینویسم درسته ولی توی ال سی دی حروف جدا جدا میشه .
    امکانش هست قسمت کانفیگ ال سی دی که قبلا درایو کردین برای من بزارین و بگید با مشکل فارسی نویسی چیکار کردید ؟؟؟
  5. #5
    2008/12/26
    384
    114

    پاسخ : وجود لرزش در یک طرف lcd 4.3 اینچ فروشگاه

    سلام
    اینو کامند هاش رو نگاه کن چجور تنظیم شدن
    //--------------------------------------------
    // Modified by: Sadegh Mohammadi
    // http://sadmonew.blogfa.com
    // 1391/03/28
    //--------------------------------------------
    //=============================================================================
    #include "stm32f10x.h"
    //=============================================================================
    // Configuration
    //=============================================================================

    //=============================================================================


    #define SSD1963_DATAPORT GPIOC
    #define SSD1963_DATAPORT_1 GPIOB
    #define SSD1963_CTRLPORT GPIOB

    #define PIN_RD (1 << 8)
    #define PIN_WR (1 << 9)
    #define PIN_CS (1 << 10)
    #define PIN_A0 (1 << 11) // D/C
    #define PIN_RST (1 << 1)//on port A

    //===================
    #define TFT_FPS 60ULL
    #define TFT_WIDTH 480ULL
    #define TFT_HSYNC_BACK_PORCH 2ULL
    #define TFT_HSYNC_FRONT_PORCH 2ULL
    #define TFT_HSYNC_PULSE 41ULL

    #define TFT_HEIGHT 272ULL
    #define TFT_VSYNC_BACK_PORCH 2ULL
    #define TFT_VSYNC_FRONT_PORCH 2ULL
    #define TFT_VSYNC_PULSE 10ULL


    #define TFT_HSYNC_PERIOD (TFT_HSYNC_PULSE + TFT_HSYNC_BACK_PORCH + TFT_WIDTH + TFT_HSYNC_FRONT_PORCH)
    #define TFT_VSYNC_PERIOD (TFT_VSYNC_PULSE + TFT_VSYNC_BACK_PORCH + TFT_HEIGHT + TFT_VSYNC_FRONT_PORCH)
    #define TFT_PCLK (TFT_HSYNC_PERIOD * TFT_VSYNC_PERIOD * TFT_FPS)
    #define LCD_FPR ((TFT_PCLK * 1048576)/100000000)

    //=============================================================================
    // SSD1963 commands
    //=============================================================================
    #define SSD1963_NOP 0x00
    #define SSD1963_SOFT_RESET 0x01
    #define SSD1963_GET_POWER_MODE 0x0A
    #define SSD1963_GET_ADDRESS_MODE 0x0B
    #define SSD1963_GET_DISPLAY_MODE 0x0D
    #define SSD1963_GET_TEAR_EFFECT_STATUS 0x0E
    #define SSD1963_ENTER_SLEEP_MODE 0x10
    #define SSD1963_EXIT_SLEEP_MODE 0x11
    #define SSD1963_ENTER_PARTIAL_MODE 0x12
    #define SSD1963_ENTER_NORMAL_MODE 0x13
    #define SSD1963_EXIT_INVERT_MODE 0x20
    #define SSD1963_ENTER_INVERT_MODE 0x21
    #define SSD1963_SET_GAMMA_CURVE 0x26
    #define SSD1963_SET_DISPLAY_OFF 0x28
    #define SSD1963_SET_DISPLAY_ON 0x29
    #define SSD1963_SET_COLUMN_ADDRESS 0x2A
    #define SSD1963_SET_PAGE_ADDRESS 0x2B
    #define SSD1963_WRITE_MEMORY_START 0x2C
    #define SSD1963_READ_MEMORY_START 0x2E
    #define SSD1963_SET_PARTIAL_AREA 0x30
    #define SSD1963_SET_SCROLL_AREA 0x33
    #define SSD1963_SET_TEAR_OFF 0x34
    #define SSD1963_SET_REAR_ON 0x35
    #define SSD1963_SET_ADDRESS_MODE 0x36
    #define SSD1963_SET_SCROLL_START 0x37
    #define SSD1963_EXIT_IDLE_MODE 0x38
    #define SSD1963_ENTER_IDLE_MODE 0x39
    #define SSD1963_SET_PIXEL_FORMAT 0x3A
    #define SSD1963_WRITE_MEMORY_CONTINUE 0x3C
    #define SSD1963_READ_MEMORY_CONTINUE 0x3E
    #define SSD1963_SET_TEAR_SCANLINE 0x44
    #define SSD1963_GET_SCANLINE 0x45
    #define SSD1963_READ_DDB 0xA1
    #define SSD1963_SET_LCD_MODE 0xB0
    #define SSD1963_GET_LCD_MODE 0xB1
    #define SSD1963_SET_HORI_PERIOD 0xB4
    #define SSD1963_GET_HORI_PERIOD 0xB5
    #define SSD1963_SET_VERT_PERIOD 0xB6
    #define SSD1963_GET_VERT_PERIOD 0xB7
    #define SSD1963_SET_GPIO_CONF 0xB8
    #define SSD1963_GET_GPIO_CONF 0xB9
    #define SSD1963_SET_GPIO_VALUE 0xBA
    #define SSD1963_GET_GPIO_STATUS 0xBB
    #define SSD1963_SET_POST_PROC 0xBC
    #define SSD1963_GET_POST_PROC 0xBD
    #define SSD1963_SET_PWM_CONF 0xBE
    #define SSD1963_GET_PWM_CONF 0xBF
    #define SSD1963_GET_LCD_GEN0 0xC0
    #define SSD1963_SET_LCD_GEN0 0xC1
    #define SSD1963_GET_LCD_GEN1 0xC2
    #define SSD1963_SET_LCD_GEN1 0xC3
    #define SSD1963_GET_LCD_GEN2 0xC4
    #define SSD1963_SET_LCD_GEN2 0xC5
    #define SSD1963_GET_LCD_GEN3 0xC6
    #define SSD1963_SET_LCD_GEN3 0xC7
    #define SSD1963_SET_GPIO0_ROP 0xC8
    #define SSD1963_GET_GPIO0_ROP 0xC9
    #define SSD1963_SET_GPIO1_ROP 0xCA
    #define SSD1963_GET_GPIO1_ROP 0xCB
    #define SSD1963_SET_GPIO2_ROP 0xCC
    #define SSD1963_GET_GPIO2_ROP 0xCD
    #define SSD1963_SET_GPIO3_ROP 0xCE
    #define SSD1963_GET_GPIO3_ROP 0xCF
    #define SSD1963_SET_DBC_CONF 0xD0
    #define SSD1963_GET_DBC_CONF 0xD1
    #define SSD1963_SET_DBC_TH 0xD4
    #define SSD1963_GET_DBC_TH 0xD5
    #define SSD1963_SET_PLL 0xE0
    #define SSD1963_SET_PLL_MN 0xE2
    #define SSD1963_GET_PLL_MN 0xE3
    #define SSD1963_GET_PLL_STATUS 0xE4
    #define SSD1963_SET_DEEP_SLEEP 0xE5
    #define SSD1963_SET_LSHIFT_FREQ 0xE6
    #define SSD1963_GET_LSHIFT_FREQ 0xE7
    #define SSD1963_SET_PIXEL_DATA_INTERFACE 0xF0
    #define SSD1963_PDI_8BIT 0
    #define SSD1963_PDI_12BIT 1
    #define SSD1963_PDI_16BIT 2
    #define SSD1963_PDI_16BIT565 3
    #define SSD1963_PDI_18BIT 4
    #define SSD1963_PDI_24BIT 5
    #define SSD1963_PDI_9BIT 6
    #define SSD1963_GET_PIXEL_DATA_INTERFACE 0xF1

    /*
    //-----------------color----------------------------------
    #define RED 0XF800
    #define GREEN 0xF81F //0X07E0
    #define GREEN1 0x07C0
    #define BLUE 0xFFE0 //0X001F
    #define BRED 0XF81F
    #define GRED 0XFFE0
    #define GBLUE 0X07FF
    #define WHITE 0XFFFF
    #define BLACK 0X0000
    #define BROWN 0XBC40
    #define BRRED 0XFC07
    #define GRAY 0X8430
    #define LGRAY 0XC618
    #define YELOW 0x07FF
    //----------------------------------------------------
    */


    // Translates a 24-bit RGB color to RGB565
    #define TRANSLATE24BIT_TO_RGB565(c) ((((c) & 0x00ff0000) >> 19) | \
    ((((c) & 0x0000ff00) >> 5) & 0x000007e0) | \
    ((((c) & 0x000000ff) << 8) & 0x0000f800))

    // Define a basic set of 24bit colors, based on the standard "websafe" set
    #define COLOR24_AQUA 0x00FFFF
    #define COLOR24_GREY 0x808080
    #define COLOR24_NAVY 0x000080
    #define COLOR24_SILVER 0xC0C0C0
    #define COLOR24_BLACK 0x000000
    #define COLOR24_GREEN 0x008000
    #define COLOR24_OLIVE 0x808000
    #define COLOR24_TEAL 0x008080
    #define COLOR24_BLUE 0x0000FF
    #define COLOR24_LIME 0x00FF00
    #define COLOR24_PURPLE 0x800080
    #define COLOR24_WHITE 0xFFFFFF
    #define COLOR24_FUCHSIA 0xFF00FF
    #define COLOR24_MAROON 0x800000
    #define COLOR24_RED 0xFF0000
    #define COLOR24_YELLOW 0xFFFF00

    // Create a set of RGB565 colors that can be used directly within code
    #define COLOR_AQUA TRANSLATE24BIT_TO_RGB565(COLOR24_AQUA)
    #define COLOR_GREY TRANSLATE24BIT_TO_RGB565(COLOR24_GREY)
    #define COLOR_NAVY TRANSLATE24BIT_TO_RGB565(COLOR24_NAVY)
    #define COLOR_SILVER TRANSLATE24BIT_TO_RGB565(COLOR24_SILVER)
    #define COLOR_BLACK TRANSLATE24BIT_TO_RGB565(COLOR24_BLACK)
    #define COLOR_GREEN TRANSLATE24BIT_TO_RGB565(COLOR24_GREEN)
    #define COLOR_OLIVE TRANSLATE24BIT_TO_RGB565(COLOR24_OLIVE)
    #define COLOR_TEAL TRANSLATE24BIT_TO_RGB565(COLOR24_TEAL)
    #define COLOR_BLUE TRANSLATE24BIT_TO_RGB565(COLOR24_BLUE)
    #define COLOR_LIME TRANSLATE24BIT_TO_RGB565(COLOR24_LIME)
    #define COLOR_PURPLE TRANSLATE24BIT_TO_RGB565(COLOR24_PURPLE)
    #define COLOR_WHITE TRANSLATE24BIT_TO_RGB565(COLOR24_WHITE)
    #define COLOR_FUCHSIA TRANSLATE24BIT_TO_RGB565(COLOR24_FUCHSIA)
    #define COLOR_MAROON TRANSLATE24BIT_TO_RGB565(COLOR24_MAROON)
    #define COLOR_RED TRANSLATE24BIT_TO_RGB565(COLOR24_RED)
    #define COLOR_YELLOW TRANSLATE24BIT_TO_RGB565(COLOR24_YELLOW)

    unsigned const short Char_Dot[760] =//744
    {
    0x0000,0x0000,0x0000,0x001C,0x0020,0x0040,0x0040,0x0040,/*" No used*/
    0x0040,0x0040,0x0020,0x001C,0x0000,0x0000,0x0000,0x0000,/*# No used*/
    0x0000,0x0000,0x0000,0xE000,0x1000,0x0800,0x0800,0x0800,/*$ No used*/
    0x0C30,0x0C60,0x00C0,0x0180,0x0300,0x0630,0x0C30,0x0000,/*% */
    0x0800,0x0800,0x1000,0xE000,0x0000,0x0000,0x0000,0x0000,/*& */
    0x2010,0x2010,0x2010,0x2010,0x2010,0x2010,0x3FF0,0x0000,/*' Empty bottom*/
    0x0000,0x0000,0x0FC0,0x1FE0,0x3030,0x2010,0x0000,0x0000,/*( */
    0x0000,0x0000,0x2010,0x3030,0x1FE0,0x0FC0,0x0000,0x0000,/*) */
    0x0000,0x18C0,0x0D80,0x0700,0x0700,0x0D80,0x18C0,0x0000,/** ،ء*/
    0x0000,0x0100,0x0100,0x07C0,0x07C0,0x0100,0x0100,0x0000,/*+ */
    0x0000,0x0000,0x0000,0xFFFC,0x0000,0x0000,0x0000,0x0000,/*, No used*/
    0x0000,0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0000,/*- */
    0x0000,0x0000,0x0000,0x0030,0x0030,0x0000,0x0000,0x0000,/*. */
    0x0030,0x0060,0x00C0,0x0180,0x0300,0x0600,0x0C00,0x0000,/*/ */
    0x1FE0,0x3FF0,0x2090,0x2310,0x2410,0x3FF0,0x1FE0,0x0000,/*0 */
    0x0000,0x0810,0x1810,0x3FF0,0x3FF0,0x0010,0x0010,0x0000,/*1 */
    0x1070,0x30F0,0x2190,0x2310,0x2610,0x3830,0x1830,0x0000,/*2 */
    0x1020,0x3030,0x2210,0x2210,0x2210,0x3FF0,0x1DE0,0x0000,/*3 */
    0x0300,0x0700,0x0D00,0x1910,0x3FF0,0x3FF0,0x0110,0x0000,/*4 */
    0x3E20,0x3E30,0x2210,0x2210,0x2310,0x23F0,0x21E0,0x0000,/*5 */
    0x0FE0,0x1FF0,0x3210,0x2210,0x2210,0x03F0,0x01E0,0x0000,/*6 */
    0x3000,0x3000,0x20F0,0x21F0,0x2300,0x3E00,0x3C00,0x0000,/*7 */
    0x1DE0,0x3FF0,0x2210,0x2210,0x2210,0x3FF0,0x1DE0,0x0000,/*8 */
    0x1C00,0x3E10,0x2210,0x2210,0x2230,0x3FE0,0x1FC0,0x0000,/*9 */
    0x0000,0x0000,0x0000,0x0C60,0x0C60,0x0000,0x0000,0x0000,/*: */
    0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,/*; No used*/
    0x0000,0x0100,0x0380,0x06C0,0x0C60,0x1830,0x1010,0x0000,/*< */
    0x0240,0x0240,0x0240,0x0240,0x0240,0x0240,0x0240,0x0000,/*= */
    0x0000,0x1010,0x1830,0x0C60,0x06C0,0x0380,0x0100,0x0000,/*> */
    0x1800,0x3800,0x2000,0x23B0,0x27B0,0x3C00,0x1800,0x0000,/*? */
    0x0FC0,0x1020,0x2790,0x2490,0x27D0,0x1050,0x0F80,0x0000,/*@ */
    0x07F0,0x0FF0,0x1900,0x3100,0x1900,0x0FF0,0x07F0,0x0000,/*A */
    0x2010,0x3FF0,0x3FF0,0x2210,0x2210,0x3FF0,0x1DE0,0x0000,/*B */
    0x0FC0,0x1FE0,0x3030,0x2010,0x2010,0x3030,0x1860,0x0000,/*C */
    0x2010,0x3FF0,0x3FF0,0x2010,0x3030,0x1FE0,0x0FC0,0x0000,/*D */
    0x2010,0x3FF0,0x3FF0,0x2210,0x2710,0x3030,0x3870,0x0000,/*E */
    0x2010,0x3FF0,0x3FF0,0x2210,0x2700,0x3000,0x3800,0x0000,/*F */
    0x0FC0,0x1FE0,0x3030,0x2110,0x2110,0x31E0,0x19F0,0x0000,/*G */
    0x3FF0,0x3FF0,0x0200,0x0200,0x0200,0x3FF0,0x3FF0,0x0000,/*H */
    0x0000,0x0000,0x2010,0x3FF0,0x3FF0,0x2010,0x0000,0x0000,/*I */
    0x00E0,0x00F0,0x0010,0x2010,0x3FF0,0x3FE0,0x2000,0x0000,/*J */
    0x2010,0x3FF0,0x3FF0,0x0300,0x0F00,0x3CF0,0x3070,0x0000,/*K */
    0x2010,0x3FF0,0x3FF0,0x2010,0x0010,0x0030,0x0030,0x0000,/*L */
    0x3FF0,0x3FF0,0x1C00,0x0E00,0x1C00,0x3FF0,0x3FF0,0x0000,/*M */
    0x3FF0,0x3FF0,0x1C00,0x0E00,0x0700,0x3FF0,0x3FF0,0x0000,/*N */
    0x0FC0,0x1FE0,0x3030,0x2010,0x3030,0x1FE0,0x0FC0,0x0000,/*O */
    0x2010,0x3FF0,0x3FF0,0x2210,0x2200,0x3E00,0x1C00,0x0000,/*P */
    0x1FE0,0x3FF0,0x2010,0x2070,0x2030,0x3FF8,0x1FE8,0x0000,/*Q */
    0x2010,0x3FF0,0x3FF0,0x2200,0x2300,0x3FF0,0x1CF0,0x0000,/*R */
    0x1860,0x3C70,0x2610,0x2210,0x2310,0x39F0,0x18E0,0x0000,/*S */
    0x0000,0x3800,0x3010,0x3FF0,0x3FF0,0x3010,0x3800,0x0000,/*T */
    0x3FE0,0x3FF0,0x0010,0x0010,0x0010,0x3FF0,0x3FE0,0x0000,/*U */
    0x3F80,0x3FC0,0x0060,0x0030,0x0060,0x3FC0,0x3F80,0x0000,/*V */
    0x3FC0,0x3FF0,0x0070,0x01C0,0x0070,0x3FF0,0x3FC0,0x0000,/*W */
    0x3030,0x3CF0,0x0FC0,0x0300,0x0FC0,0x3CF0,0x3030,0x0000,/*X */
    0x0000,0x3C00,0x3E10,0x03F0,0x03F0,0x3E10,0x3C00,0x0000,/*Y */
    0x3870,0x30F0,0x2190,0x2310,0x2610,0x3C30,0x3870,0x0000,/*Z */
    0x0010,0x0030,0x0050,0x0190,0x0310,0x0C10,0x3FF0,0x0000,/*[ Delta*/
    0x0800,0x0800,0x0800,0x0800,0x0800,0x0800,0x0800,0x0800,/*\ No used*/
    0x0000,0x0000,0x0000,0xFC7C,0x0280,0x0280,0x0100,0x0100,/*] No used*/
    0x0200,0x0400,0x0C00,0x1FF0,0x3FF0,0x0C00,0x0400,0x0200,/*^ rising edge*/
    0x0100,0x0080,0x00C0,0x3FE0,0x3FF0,0x00C0,0x0080,0x0100,/*_ falling edge*/
    0x2010,0x2010,0x2010,0x2010,0x2010,0x2010,0x2010,0x2010,/*` Empty body*/
    0x00E0,0x05F0,0x0510,0x0510,0x07E0,0x03F0,0x0010,0x0000,/*a */
    0x2010,0x3FF0,0x3FE0,0x0210,0x0210,0x03F0,0x01E0,0x0000,/*b */
    0x03E0,0x07F0,0x0410,0x0410,0x0410,0x0630,0x0220,0x0000,/*c */
    0x01E0,0x03F0,0x0610,0x2410,0x3FF0,0x3FF0,0x0010,0x0000,/*d */
    0x03E0,0x07F0,0x0510,0x0510,0x0510,0x0730,0x0320,0x0000,/*e */
    0x0000,0x0210,0x1FF0,0x3FF0,0x2210,0x3000,0x1800,0x0000,/*f */
    0x03C8,0x07EC,0x0424,0x0424,0x03FC,0x07F8,0x0400,0x0000,/*g */
    0x2010,0x3FF0,0x3FF0,0x0220,0x0400,0x07F0,0x03F0,0x0000,/*h */
    0x0000,0x0000,0x0410,0x37F0,0x37F0,0x0010,0x0000,0x0000,/*i */
    0x0000,0x0018,0x001C,0x0404,0x37FC,0x37F8,0x0400,0x0000,/*j */
    0x2010,0x3FF0,0x3FF0,0x2180,0x03C0,0x0670,0x0430,0x0000,/*k */
    0x0000,0x0000,0x2010,0x3FF0,0x3FF0,0x0010,0x0000,0x0000,/*l */
    0x07F0,0x07F0,0x0600,0x03F0,0x0600,0x07F0,0x07F0,0x0000,/*m */
    0x0400,0x07F0,0x03F0,0x0400,0x0400,0x07F0,0x03F0,0x0000,/*n */
    0x03E0,0x07F0,0x0410,0x0410,0x0410,0x07F0,0x03E0,0x0000,/*o */
    0x0404,0x07FC,0x03FC,0x0444,0x0440,0x07C0,0x0380,0x0000,/*p */
    0x0380,0x07C0,0x0440,0x0444,0x07FC,0x03FC,0x0404,0x0000,/*q */
    0x0410,0x07F0,0x03F0,0x0610,0x0400,0x0600,0x0300,0x0000,/*r */
    0x0000,0x0220,0x0730,0x0590,0x0490,0x06F0,0x0260,0x0000,/*s */
    0x0400,0x0400,0x1FE0,0x3FF0,0x0410,0x0430,0x0020,0x0000,/*t */
    0x07E0,0x07F0,0x0010,0x0010,0x07E0,0x07F0,0x0010,0x0000,/*u */
    0x0000,0x07C0,0x07E0,0x0030,0x0030,0x07E0,0x07C0,0x0000,/*v */
    0x07E0,0x07F0,0x0030,0x00E0,0x0030,0x07F0,0x07E0,0x0000,/*w */
    0x0410,0x0630,0x03E0,0x01C0,0x03E0,0x0630,0x0410,0x0000,/*x */
    0x0780,0x07C4,0x0044,0x0044,0x0044,0x07F8,0x07F0,0x0000,/*y */
    0x0630,0x0670,0x04D0,0x0590,0x0710,0x0630,0x0430,0x0000,/*z */
    0x0780,0x0480,0x3CF0,0x2010,0x2FD0,0x2FD0,0x2FD0,0x2FD0,/*{ Battery head*/
    0x2FD0,0x2FD0,0x2FD0,0x2FD0,0x2FD0,0x2FD0,0x2FD0,0x2FD0,/*| Battery body*/
    0x2FD0,0x2FD0,0x2FD0,0x2FD0,0x2FD0,0x2010,0x3FF0,0x0000,/*} Battery bottom*/
    0x0780,0x0480,0x3CF0,0x2010,0x2010,0x2010,0x2010,0x2010 /*~ Empty head*/
    };


    //=============================================================================
    // Write command to SSD1963
    //=============================================================================
    void SSD1963_WriteCommand(unsigned int commandToWrite)
    {
    volatile unsigned int dly;
    SSD1963_DATAPORT->ODR = commandToWrite;
    SSD1963_CTRLPORT->BSRR = PIN_RD;
    SSD1963_CTRLPORT->BRR = PIN_A0 | PIN_CS | PIN_WR;
    for(dly = 0; dly < 1; dly++);//asm("nop");
    SSD1963_CTRLPORT->BSRR = PIN_A0 | PIN_CS | PIN_WR;
    }
    //=============================================================================
    // Write data to SSD1963
    //=============================================================================
    void SSD1963_WriteData(unsigned long dataToWrite)
    {
    volatile unsigned int dly;
    SSD1963_DATAPORT->ODR = (dataToWrite & 0x00FFFF); //GPIOB
    SSD1963_DATAPORT_1->ODR = (dataToWrite & 0xFF0000)>>16; //GPIOC
    SSD1963_CTRLPORT->BSRR = PIN_RD | PIN_A0;
    SSD1963_CTRLPORT->BRR = PIN_CS | PIN_WR;
    //for(dly = 0; dly < 1; dly++);//asm("nop");
    SSD1963_CTRLPORT->BSRR = PIN_CS | PIN_WR;
    }
    //=============================================================================
    //
    //=============================================================================
    void SSD1963_Init (void)
    {
    volatile unsigned int dly;
    GPIOA->BRR = PIN_RST;
    for(dly = 0; dly < 1000; dly++);
    GPIOA->BSRR = PIN_RST;
    for(dly = 0; dly < 1000; dly++);

    SSD1963_WriteCommand(SSD1963_SOFT_RESET);

    // REFclk = crystal = 10MHz
    SSD1963_WriteCommand(SSD1963_SET_PLL_MN);
    SSD1963_WriteData(0x1D); // PLLclk = REFclk * 30 (300MHz)
    SSD1963_WriteData(0x02); // SYSclk = PLLclk / 3 (100MHz)
    SSD1963_WriteData(0x54); // dummy

    SSD1963_WriteCommand(SSD1963_SET_PLL);
    SSD1963_WriteData(0x01);

    for(dly = 0; dly < 100000; dly++);

    SSD1963_WriteCommand(SSD1963_SET_PLL);
    SSD1963_WriteData(0x03);

    SSD1963_WriteCommand(0x01); // soft reset

    //Set LSHIFT freq, i.e. the DCLK with PLL freq 120MHz set previously
    //Typical DCLK for TY430TFT480272 is 9MHz
    //9MHz = 100MHz*(LCDC_FPR+1)/2^20
    //LCDC_FPR = 94370 (0x170A2)
    SSD1963_WriteCommand(SSD1963_SET_LSHIFT_FREQ);
    SSD1963_WriteData(0x01);
    SSD1963_WriteData(0x70);
    SSD1963_WriteData(0xA2);

    //Set panel mode, varies from individual manufacturer
    SSD1963_WriteCommand(SSD1963_SET_LCD_MODE);
    SSD1963_WriteData(0x2C);//24-Bit //(0x0C); //18-Bit
    SSD1963_WriteData(0x00);
    SSD1963_WriteData((TFT_WIDTH-1)>>8);
    SSD1963_WriteData((TFT_WIDTH-1) & 0xFF);
    SSD1963_WriteData((TFT_HEIGHT-1)>>8);
    SSD1963_WriteData((TFT_HEIGHT-1) & 0xFF);
    SSD1963_WriteData(0x00);

    //Set horizontal period
    SSD1963_WriteCommand(SSD1963_SET_HORI_PERIOD);
    SSD1963_WriteData((TFT_HSYNC_PERIOD-1)>>8);
    SSD1963_WriteData((TFT_HSYNC_PERIOD-1) & 0xFF);
    SSD1963_WriteData((TFT_HSYNC_PULSE + TFT_HSYNC_BACK_PORCH-1)>>8);
    SSD1963_WriteData((TFT_HSYNC_PULSE + TFT_HSYNC_BACK_PORCH) & 0xFF);
    SSD1963_WriteData(TFT_HSYNC_PULSE-1);
    SSD1963_WriteData(0x00);
    SSD1963_WriteData(0x00);
    SSD1963_WriteData(0x00);

    //Set vertical period
    SSD1963_WriteCommand(SSD1963_SET_VERT_PERIOD);
    SSD1963_WriteData((TFT_VSYNC_PERIOD-1)>>8);
    SSD1963_WriteData((TFT_VSYNC_PERIOD-1) & 0xFF);
    SSD1963_WriteData((TFT_VSYNC_PULSE + TFT_VSYNC_BACK_PORCH-1)>>8);
    SSD1963_WriteData((TFT_VSYNC_PULSE + TFT_VSYNC_BACK_PORCH-1) & 0xFF);
    SSD1963_WriteData(TFT_VSYNC_PULSE-1);
    SSD1963_WriteData(0x00);
    SSD1963_WriteData(0x00);

    //Set pixel data interface
    SSD1963_WriteCommand(SSD1963_SET_PIXEL_DATA_INTERFACE);
    SSD1963_WriteData(SSD1963_PDI_24BIT);

    // set address mode
    SSD1963_WriteCommand(SSD1963_SET_ADDRESS_MODE);
    SSD1963_WriteData(0x45);

    // setting PWM for LED backlight
    SSD1963_WriteCommand(SSD1963_SET_PWM_CONF);
    SSD1963_WriteData(0x0E);
    SSD1963_WriteData(0xFF); // Set 0xFF for full and 0x00 for off
    SSD1963_WriteData(0x01);
    SSD1963_WriteData(0x00);
    SSD1963_WriteData(0x00);
    SSD1963_WriteData(0x00);

    // GPIO0,1,2,3 is output
    SSD1963_WriteCommand(SSD1963_SET_GPIO_CONF);
    SSD1963_WriteData(0x0F);
    SSD1963_WriteData(0x01);

    // set GPIO0 , 1 , 2, 3 = 1
    SSD1963_WriteCommand(SSD1963_SET_GPIO_VALUE);
    SSD1963_WriteData(0x0F);

    //SET display on
    SSD1963_WriteCommand(SSD1963_SET_DISPLAY_ON);

    // exit sleep mode
    SSD1963_WriteCommand(SSD1963_EXIT_SLEEP_MODE);
    }
    //=============================================================================
    //
    //=============================================================================
    void SSD1963_SetArea(unsigned int sx, unsigned int ex, unsigned int sy, unsigned int ey)
    {
    SSD1963_WriteCommand(SSD1963_SET_COLUMN_ADDRESS);
    SSD1963_WriteData((sx >> 8) & 0xFF);
    SSD1963_WriteData((sx >> 0) & 0xFF);
    SSD1963_WriteData((ex >> 8) & 0xFF);
    SSD1963_WriteData((ex >> 0) & 0xFF);

    SSD1963_WriteCommand(SSD1963_SET_PAGE_ADDRESS);
    SSD1963_WriteData((sy >> 8) & 0xFF);
    SSD1963_WriteData((sy >> 0) & 0xFF);
    SSD1963_WriteData((ey >> 8) & 0xFF);
    SSD1963_WriteData((ey >> 0) & 0xFF);
    }
    //=============================================================================
    // Fill area of specified color
    //=============================================================================
    /*void SSD1963_FillArea(unsigned int sx, unsigned int ex, unsigned int sy, unsigned int ey, int color)
    {
    int i;
    SSD1963_SetArea(sx, ex, sy, ey);
    SSD1963_WriteCommand(SSD1963_WRITE_MEMORY_START);
    for(i = 0; i < ((ex-sx+1)*(ey-sy+1)); i++)
    {
    SendData(color);
    }
    }*/
    //=============================================================================
    // Fills whole screen specified color
    //=============================================================================
    void SSD1963_ClearScreen(unsigned long color)
    {
    unsigned int x,y;
    SSD1963_SetArea(0, TFT_WIDTH-1 , 0, TFT_HEIGHT-1);
    SSD1963_WriteCommand(0x2c);
    for(x=0;x<TFT_WIDTH;x++)
    {
    for(y= 0;y<TFT_HEIGHT;y++)
    {
    SSD1963_WriteData(color);
    }
    }
    }
    //=============================================================================
    //
    //=============================================================================
    void GLCD_SetPixel(int x, int y, unsigned long color)
    {
    SSD1963_SetArea(x, x, y, y);
    SSD1963_WriteCommand(0x2c);
    SSD1963_WriteData(color);
    //SSD1963_WriteCommand(0x0);
    }
    //=============================================================================
    /*******************************************************************************
    Display_Str: Display String Input: X،Y, Color, Mode, String
    *******************************************************************************/
    void Display_Str(unsigned short x0, unsigned short y0, unsigned long Color, unsigned const char *s)
    {
    signed short i, j, b,ii=0;
    while (*s!=0) {
    unsigned const short *scanline=Char_Dot+((*s-0x22)*8);
    for(i=0;i<8;++i){
    if((*s==0x20)||(*s==0x21)) b=0x0000;
    else b=scanline[i];
    if((*s==0x21)&&(i==4)) break;
    for(j=0;j<14;++j){
    if(b&4) {
    GLCD_SetPixel(x0+i, y0+j,Color);
    } else {
    GLCD_SetPixel(x0+i, y0+j,COLOR_BLACK);
    }
    b>>=1;

    }
    ++ii;
    }
    if(*s==0x21) x0 +=4;
    else x0 += 8;
    ++s;
    }
    }

  6. #6
    2007/08/02
    1,297
    789

    پاسخ : وجود لرزش در یک طرف lcd 4.3 اینچ فروشگاه

    تشکر . راستی مشکل فارسی نویسی حل کردی ؟؟؟ من این تابع با ترکیب چند تا کد درست کردم که اندازه فونت هم تغییر میکنه
    فارسی هم میشه نوشت ولی توی کیل که فارسی تایپ میکنم روی ال سی دی حروف جدا جدا نوشته میشه . البته مشکل مال کیله و اگه توی نت پد تایپ کنم و کپی کنم مشکل حله فقط کار سخت میشه

    #include "stm32f1xx_hal.h"
    #include "font.h"
    #include "hardware.h"
    #include "ili932x.h"
    #include "delay.h"


    #define u32 long
    #define unit8_t char
    #define uint8_t char
    #define unit32_t long
    #define uint32_t long
    #define uint16_t int

    /*
    unsigned int HDP=479;
    unsigned int HT=531;
    unsigned int HPS=43;
    unsigned int LPS=8;
    unsigned char HPW=10;
    unsigned int VDP=271;


    unsigned int VT=288;
    unsigned int VPS=12;
    unsigned int FPS=4;
    unsigned char VPW=10;
    */


    #define HDP 479
    #define HT 531
    #define HPS 43
    #define LPS 8
    #define HPW 10
    #define VDP 271


    #define VT 288
    #define VPS 12
    #define FPS 4
    #define VPW 10


    uint16_t DeviceCode;




    void DataToWrite(int DATA){
    GPIOB->ODR = (GPIOB->ODR&0x00ff)|(DATA&0xff00);
    GPIOC->ODR = (GPIOC->ODR&0xff00)|(DATA&0x00ff);
    }


    //int DataToRead(void){
    // int i;
    // i=GPIO_ReadOutputData(GPIOE);
    // return i;
    //}


    //#define DataToRead() GPIO_ReadOutputData(GPIOE)




    void WriteOneCharF4(u8 x, u8 y, u8 num, u16 PenColor)
    {

    u16 size = 16;
    u16 temp;
    u16 pos,t;

    //num=num-' ';
    for(pos=0;pos<size;pos++)
    {
    //temp=asc2_1608[num][pos]; //temp=mmb_1808[num][pos];
    temp= image_code[num][pos];
    for(t=0;t<size;t++)
    {
    if(temp&0x01) //if(temp&0x01)
    {
    LCD_DrawPixel(x+t , y+pos , PenColor);
    }
    temp>>=1;
    }
    }
    }
    ////////////////////////////////////////////////////


    void WriteOneChar(u16 x, u16 y, u8 num, u16 PenColor, u16 BackColor)
    {
    u8 size = 16;
    u8 temp;
    u8 pos,t;
    num=num-' '; /*??????? */
    for(pos=0;pos<size;pos++)
    {
    if(size==12)
    temp=asc2_1206[num][pos];
    else
    temp=asc2_1608[num][pos];
    for(t=0;t<size/2;t++)
    {
    if(temp&0x01)
    {
    LCD_DrawPixel(x+t, y+pos, PenColor); /*????? ???*/
    }
    else
    LCD_DrawPixel(x+t, y+pos, BackColor); /*????? ???*/
    temp>>=1;
    }
    }
    }
    ////////////////////////////////////////////////////
    void LCD_WR_REG(uint16_t LCD_Reg)
    {
    LCD_RD(1); /*???*/
    LCD_CS(0); /*??*/
    LCD_RS(0); /*0????*/
    DataToWrite(LCD_Reg);
    LCD_WR(0);
    LCD_WR(1); /*?????*/
    LCD_CS(1);
    }
    ////////////////////////////////////////////////////
    void LCD_WR_DATA(uint16_t LCD_Data)
    {
    LCD_RD(1); /*???*/
    LCD_CS(0);
    LCD_RS(1); /*1????*/
    DataToWrite(LCD_Data);
    LCD_WR(0);
    LCD_WR(1); /*?????*/
    LCD_CS(1);
    }


    ////////////////////////////////////////////////////


    uint16_t LCD_ReadReg(uint16_t LCD_Reg)
    {
    uint16_t temp;
    GPIOE->CRL=0x88888888;
    GPIOE->CRH=0x88888888;


    LCD_RD(1); /*???*/
    LCD_CS(0); /*??*/
    LCD_RS(0); /*0????*/
    DataToWrite(LCD_Reg);
    LCD_WR(0);
    LCD_WR(1); /*?????*/


    LCD_WR(1); /*???*/
    LCD_RS(1); /*1????*/
    // temp=GPIO_ReadOutputData(GPIOE) ; //DataToRead();
    LCD_RD(0);
    LCD_RD(1); /*?????*/
    LCD_CS(1);


    GPIOE->CRL=0x33333333;
    GPIOE->CRH=0x33333333;
    return temp;
    }
    ////////////////////////////////////////////////////
    void LCD_WriteReg(uint16_t LCD_Reg ,uint16_t LCD_RegValue)
    {
    LCD_RD(1); /*???*/
    LCD_CS(0); /*??*/
    LCD_RS(0); /*0????*/
    DataToWrite(LCD_Reg);
    LCD_WR(0);
    LCD_WR(1); /*?????*/


    LCD_RS(1); /*1????*/
    DataToWrite(LCD_RegValue);
    LCD_WR(0);
    LCD_WR(1); /*?????*/
    LCD_CS(1);
    }
    ////////////////////////////////////////////////////
    void LCD_WR_DATA_Prepare(void)
    {
    LCD_WR_REG(0x002C);
    }
    ////////////////////////////////////////////////////
    void LCD_SetCursor(u16 Xpos, u16 Ypos)
    {
    LCD_WR_REG(0x002A);
    LCD_WR_DATA(Xpos>>8);
    LCD_WR_DATA(Xpos&0x00ff);
    LCD_WR_DATA(800>>8);
    LCD_WR_DATA(800&0x00ff);


    LCD_WR_REG(0x002b);
    LCD_WR_DATA(Ypos>>8);
    LCD_WR_DATA(Ypos&0x00ff);
    LCD_WR_DATA(480>>8);
    LCD_WR_DATA(480&0x00ff);
    }
    ////////////////////////////////////////////////////
    void LCD_Clear(uint16_t Color)
    {
    unsigned int l=480,w,f;


    LCD_WR_REG(0X002A);
    LCD_WR_DATA(0);
    LCD_WR_DATA(0);
    LCD_WR_DATA(HDP>>8);
    LCD_WR_DATA(HDP&0XFF);


    /* Y? */
    LCD_WR_REG(0X002B);
    LCD_WR_DATA(0);
    LCD_WR_DATA(0);
    LCD_WR_DATA(VDP>>8);
    LCD_WR_DATA(VDP&0X00FF);


    LCD_WR_REG(0X002C);
    while(l--) /* 480? */
    {
    for(w = 0; w < HDP+1; w++) /* ??800???? */
    {
    f = 50;
    LCD_WR_DATA(Color);
    }

    }
    }
    ////////////////////////////////////////////////////
    void LCD_DrawPixel(uint16_t xsta, uint16_t ysta, uint16_t color)
    {
    LCD_SetCursor(xsta, ysta); /*?????? */
    LCD_WR_DATA_Prepare(); /*????GRAM */
    LCD_WR_DATA(color);


    }
    ////////////////////////////////////////////////////


    void LCD_WindowMax (unsigned int xsta,unsigned int ysta,unsigned int xend,unsigned int yend)
    {
    LCD_WR_REG(0X002A);
    LCD_WR_DATA(xsta>>8);
    LCD_WR_DATA(xsta&0X00FF);
    LCD_WR_DATA(xend>>8);
    LCD_WR_DATA(xend&0X00FF);

    LCD_WR_REG(0X002B);
    LCD_WR_DATA(ysta>>8);
    LCD_WR_DATA(ysta&0X00FF);
    LCD_WR_DATA(yend>>8);
    LCD_WR_DATA(yend&0X00FF);
    }
    ////////////////////////////////////////////////////
    void LCD_Fill(uint8_t xsta, uint16_t ysta, uint8_t xend, uint16_t yend, uint16_t colour)
    {
    u32 n;
    LCD_WindowMax (xsta, ysta, xend, yend);
    LCD_WR_DATA_Prepare();
    n=(u32)(yend-ysta+1)*(xend-xsta+1);
    while(n--){LCD_WR_DATA(colour);}
    }
    ////////////////////////////////////////////////////
    void LCD_DrawLine(uint16_t xsta, uint16_t ysta, uint16_t xend, uint16_t yend, uint16_t color)
    {
    u16 x, y, t;
    if((xsta==xend)&&(ysta==yend))
    LCD_DrawPixel(xsta, ysta, color);
    else
    if(abs(yend-ysta)>abs(xend-xsta))
    {
    if(ysta>yend)
    {
    t=ysta;
    ysta=yend;
    yend=t;
    t=xsta;
    xsta=xend;
    xend=t;
    }
    for(y=ysta;y<yend;y++)
    {
    x=(u32)(y-ysta)*(xend-xsta)/(yend-ysta)+xsta;
    LCD_DrawPixel(x, y, color);
    }
    }
    else
    {
    if(xsta>xend)
    {
    t=ysta;
    ysta=yend;
    yend=t;
    t=xsta;
    xsta=xend;
    xend=t;
    }
    for(x=xsta;x<=xend;x++)
    {
    y =(u32)(x-xsta)*(yend-ysta)/(xend-xsta)+ysta;
    LCD_DrawPixel(x, y, color);
    }
    }
    }
    ////////////////////////////////////////////////////
    void Draw_Circle(uint16_t x0, uint16_t y0, uint8_t r, uint16_t color)
    {
    int a,b;
    int di;
    a=0;b=r;

    di=3-(r<<1);
    while(a<=b)
    {
    LCD_DrawPixel(x0-b, y0-a, color); //3
    LCD_DrawPixel(x0+b, y0-a, color); //0
    LCD_DrawPixel(x0-a, y0+b, color); //1
    LCD_DrawPixel(x0-b, y0-a, color); //7
    LCD_DrawPixel(x0-a, y0-b, color); //2
    LCD_DrawPixel(x0+b, y0+a, color); //4
    LCD_DrawPixel(x0+a, y0-b, color); //5
    LCD_DrawPixel(x0+a, y0+b, color); //6
    LCD_DrawPixel(x0-b, y0+a, color);
    a++;



    if(di<0)di +=4*a+6;
    else
    {
    di+=10+4*(a-b);
    b--;
    }
    LCD_DrawPixel(x0+a, y0+b, color);
    }
    }
    ////////////////////////////////////////////////////
    void LCD_DrawRectangle(uint16_t xsta, uint16_t ysta, uint16_t xend, uint16_t yend, uint16_t color)
    {
    LCD_DrawLine(xsta, ysta, xend, ysta, color);
    LCD_DrawLine(xsta, ysta, xsta, yend, color);
    LCD_DrawLine(xsta, yend, xend, yend, color);
    LCD_DrawLine(xend, ysta, xend, yend, color);
    }
    ////////////////////////////////////////////////////
    u32 mypow(u8 m,u8 n)
    {
    u32 result=1;
    while(n--)result*=m;
    return result;
    }
    ////////////////////////////////////////////////////
    void LCD_ShowNum(uint16_t x,uint16_t y,u32 num,u8 len, u16 PenColor, u16 BackColor)
    {
    u8 size = 16;
    u8 t,temp;
    u8 enshow=0;
    for(t=0;t<len;t++)
    {
    temp=(num/mypow(10,len-t-1))%10;
    if(enshow==0&&t<(len-1))
    {
    if(temp==0)
    {
    WriteOneChar(x+(size/2)*t,y, ' ', PenColor, BackColor);
    continue;
    }else enshow=1;

    }
    WriteOneChar(x+(size/2)*t,y,temp+'0', PenColor, BackColor);
    }
    }
    ////////////////////////////////////////////////////
    u16 findHzIndex(u8 *hz)

    {
    u16 i=0;
    FNT_GB16 *ptGb16 = (FNT_GB16 *)GBHZ_16;
    while(ptGb16[i].Index[0] > 0x80)
    {
    if ((*hz == ptGb16[i].Index[0]) && (*(hz+1) == ptGb16[i].Index[1]))
    {
    return i;
    }
    i++;
    if(i > (sizeof((FNT_GB16 *)GBHZ_16) / sizeof(FNT_GB16) - 1))
    {
    break;
    }
    }
    return 0;
    }
    ////////////////////////////////////////////////////
    uint8_t WriteOneHz(u16 x0, u16 y0, u8 *pucMsk, u16 PenColor, u16 BackColor)
    {
    u16 i,j;
    u16 mod[16];
    u16 *pusMsk;
    u16 y;


    u16 size = 16;


    pusMsk = (u16 *)pucMsk;




    for(i=0; i<16; i++)
    {
    mod[i] = *pusMsk;
    mod[i] = ((mod[i] & 0xff00) >> 8) | ((mod[i] & 0x00ff) << 8);
    pusMsk = pusMsk+1;
    }
    y = y0;
    for(i=0; i<16; i++)
    {
    for(j=0; j<16; j++)
    {
    if((mod[i] << j) & 0x8000)
    {
    LCD_DrawPixel(x0+j, y0+i, PenColor);
    }
    else
    {
    LCD_DrawPixel(x0+j, y0+i, BackColor);
    }
    }
    y++;
    }
    return (16);
    }
    ////////////////////////////////////////////////////
    void LCD_ShowString(u16 x0, u16 y0, u8 *pcStr, u16 PenColor, u16 BackColor)
    {
    u16 usIndex;
    u16 usWidth = 0;
    FNT_GB16 *ptGb16 = 0;

    ptGb16 = (FNT_GB16 *)GBHZ_16;
    while(1)
    {
    if(*pcStr == 0)
    {
    break;
    }
    x0 = x0 + (usWidth);


    if(*pcStr > 0x80)
    {
    if((x0 + 16) > LCD_W)
    {
    x0 = 0;
    y0 = y0 + 16;
    if(y0 > LCD_H)
    {
    y0 = 0;
    }
    }
    usIndex = findHzIndex(pcStr);
    usWidth = WriteOneHz(x0, y0, (u8 *)&(ptGb16[usIndex].Msk[0]), PenColor, BackColor);
    /* ???? */
    pcStr += 2;
    }


    else
    { /* ?????? */
    if (*pcStr == '\r') /* ?? */
    {
    y0 = y0 + 16; /* ?????? */
    if(y0 > LCD_H) /* ????? */
    {
    y0 = 0;
    }
    pcStr++;
    usWidth = 0;
    continue;
    }
    else if (*pcStr == '\n') /* ????? */
    {
    x0 = 0;
    pcStr++;
    usWidth = 0;
    continue;
    }
    else
    {
    if((x0 + 8) > LCD_W) /* ?????????? */
    {
    x0 = 0;
    y0 = y0 + 16; /* ?????? */
    if(y0 > LCD_H) /* ????? */
    {
    y0 = 0;
    }
    }
    WriteOneChar(x0, y0, *pcStr, PenColor, BackColor);
    usWidth = 8;
    /* ASCII??21H???????3?*/
    pcStr += 1;
    }
    }
    }
    }
    ////////////////////////////////////////////////////
    u16 LCD_RGBtoBGR(u16 Color)
    {
    u16 r, g, b, bgr;


    b = (Color>>0) & 0x1f; /* ??B */
    g = (Color>>5) & 0x3f; /* ???? */
    r = (Color>>11) & 0x1f; /* ??R */

    bgr = (b<<11) + (g<<5) + (r<<0);


    return( bgr );
    }
    ////////////////////////////////////////////////////
    void LCD_DrawPicture(u16 StartX,u16 StartY,u16 Xend,u16 Yend,u8 *pic)
    {
    static u16 i=0,j=0;
    u16 *bitmap = (u16 *)pic;
    for(j=0; j<Yend-StartY; j++)
    {
    for(i=0; i<Xend-StartX; i++)
    LCD_DrawPixel(StartX+i, StartY+j, *bitmap++);
    }
    }
    ////////////////////////////////////////////////////


    ////////////////////////////////////////////////////


    void LCD_Configuration()
    {

    GPIO_InitTypeDef GPIO_InitStruct;


    /* GPIO Ports Clock Enable */
    __HAL_RCC_GPIOC_CLK_ENABLE();
    __HAL_RCC_GPIOB_CLK_ENABLE();
    //__HAL_RCC_GPIOA_CLK_ENABLE();


    /*Configure GPIO pin Output Level */
    HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
    |GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7
    |GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
    |GPIO_PIN_12|GPIO_PIN_13
    , GPIO_PIN_SET);


    /*Configure GPIO pin Output Level */
    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8
    |GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12
    |GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15
    , GPIO_PIN_SET);


    /*Configure GPIO pins : PC13 PC0 PC1 PC2
    PC3 PC4 PC5 PC6
    PC7 PC8 PC9 PC10
    PC11 PC12 */
    GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
    |GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7
    |GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
    |GPIO_PIN_12|GPIO_PIN_13;
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
    HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);


    /*Configure GPIO pins : PB10 PB11 PB12 PB13
    PB14 PB15 PB5 PB6
    PB7 PB8 PB9 */
    GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
    |GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15;
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
    }




    void LCD_Init(void)
    {
    LCD_Configuration();
    #define LCD_WriteCom LCD_WR_REG
    #define LCD_WriteRAM LCD_WR_DATA
    #define TimeDelay(x) Delay_10ms(x/2)
    /*ssd1963?????*/
    LCD_WriteCom(0x00E2);
    LCD_WriteRAM(0x0023);
    // Set PLL with OSC = 10MHz (hardware)
    // Multiplier N = 35, VCO (>250MHz)= OSC*(N+1), VCO = 360MHz
    LCD_WriteRAM(0x0001);
    // Divider M = 2, PLL = 360/(M+1) = 120MHz
    LCD_WriteRAM(0x0004);
    // Validate M and N values
    TimeDelay(40);
    LCD_WriteCom(0x00E0); // PLL enable
    LCD_WriteRAM(0x0001);
    TimeDelay(40);
    LCD_WriteCom(0x00E0);
    LCD_WriteRAM(0x0003);
    TimeDelay(50);
    LCD_WriteCom(0x0001); // software reset
    TimeDelay(50);
    LCD_WriteCom(0x00E6);
    LCD_WriteRAM(0x0004);
    LCD_WriteRAM(0x0093);
    LCD_WriteRAM(0x00e0);


    LCD_WriteCom(0x00B0); //LCD SPECIFICATION
    LCD_WriteRAM(0x0000);
    LCD_WriteRAM(0x0000);
    LCD_WriteRAM((HDP>>8)&0X00FF); //Set HDP
    LCD_WriteRAM(HDP&0X00FF);
    LCD_WriteRAM((VDP>>8)&0X00FF); //Set VDP
    LCD_WriteRAM(VDP&0X00FF);
    LCD_WriteRAM(0x0000);
    TimeDelay(50);


    LCD_WriteCom(0x00B4); //HSYNC
    LCD_WriteRAM((HT>>8)&0X00FF); //Set HT
    LCD_WriteRAM(HT&0X00FF);
    LCD_WriteRAM((HPS>>8)&0X00FF); //Set HPS
    LCD_WriteRAM(HPS&0X00FF);
    LCD_WriteRAM(HPW); //Set HPW
    LCD_WriteRAM((LPS>>8)&0X00FF); //Set HPS
    LCD_WriteRAM(LPS&0X00FF);
    LCD_WriteRAM(0x0000);
    TimeDelay(50);


    LCD_WriteCom(0x00B6); //VSYNC
    LCD_WriteRAM((VT>>8)&0X00FF); //Set VT
    LCD_WriteRAM(VT&0X00FF);
    LCD_WriteRAM((VPS>>8)&0X00FF); //Set VPS
    LCD_WriteRAM(VPS&0X00FF);
    LCD_WriteRAM(VPW); //Set VPW
    LCD_WriteRAM((FPS>>8)&0X00FF); //Set FPS
    LCD_WriteRAM(FPS&0X00FF);
    TimeDelay(50);


    LCD_WriteCom(0x00BA);
    LCD_WriteRAM(0x0005);//0x000F); //GPIO[3:0] out 1
    TimeDelay(50);


    LCD_WriteCom(0x00B8);
    LCD_WriteRAM(0x0007); //GPIO3=input, GPIO[2:0]=output
    LCD_WriteRAM(0x0001); //GPIO0 normal
    TimeDelay(50);


    LCD_WriteCom(0x0036); //rotation
    LCD_WriteRAM(0x0008);
    TimeDelay(50);


    LCD_WriteCom(0x00F0); //pixel data interface
    LCD_WriteRAM(0x0003);
    TimeDelay(50);




    TimeDelay(50);
    LCD_WriteCom(0x0029); //display on
    TimeDelay(50);


    LCD_WriteCom(0x00BE); //set PWM for B/L
    LCD_WriteRAM(0x0006);
    LCD_WriteRAM(0x0080);
    TimeDelay(50);

    LCD_WriteRAM(0x0001);
    LCD_WriteRAM(0x00f0);
    LCD_WriteRAM(0x0000);
    LCD_WriteRAM(0x0000);
    TimeDelay(50);


    LCD_WriteCom(0x00d0);//??????????
    LCD_WriteRAM(0x000d);
    TimeDelay(50);
    LCD_Clear(BLACK);
    }
    //*****************************************************************************
    //*****************************************************************************
    //----------------------------------------------------------------------------------------------------
    // Show a farsi-englisg string on the LCD with specific size
    // size : Scale factor size:1,2,3,...
    //----------------------------------------------------------------------------------------------------




    int font_color,x_font,y_font;
    char highlight,fa_num;
    char effect = 0 , italic = 0;
    unsigned int highlight_color;
    /* Global Variables */
    int x_base=0;


    unsigned char x_text=0,y_text=0;


    void lcd_write_pixel(int x,int y,int color)
    {
    LCD_DrawPixel(x,y,color);
    }

    //_______________________________________________


    void lcd_put_bold_char(char character , int size)
    {
    int counter_x,counter_y,i,j;
    char letter_length,flag_p;



    letter_length = font12x16[character][0]>>12;
    for(counter_y=0;counter_y<16;counter_y++)
    for(counter_x=0;counter_x<letter_length;counter_x++)
    {
    flag_p = font12x16[character][counter_y]>>(counter_x);
    flag_p = flag_p&0x01;


    if(flag_p)
    {

    if(effect == 0)
    for(i=0;i<size;i++)
    for(j=0;j<size;j++)
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + i -(x_font+(size*counter_x)),y_font+size*counter_y + j,font_color);
    // Very good effect (1)
    else if(effect == 1)
    {
    // good for size = 2
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y - 1,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y + 1,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) - 1 -(x_font+(size*counter_x)),y_font+size*counter_y,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y,font_color);
    }
    else if(effect == 2)
    {
    // good for size = 2
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y - 1,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y + 1,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) - 1 -(x_font+(size*counter_x)),y_font+size*counter_y + 1,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y + 1,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) - 1 -(x_font+(size*counter_x)),y_font+size*counter_y,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y + 2,font_color);
    }
    else if(effect == 3)
    {
    // good for size = 3
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y - 1,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y - 1,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) - 1 -(x_font+(size*counter_x)),y_font+size*counter_y,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 2 -(x_font+(size*counter_x)),y_font+size*counter_y,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y + 1,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y + 1,font_color);
    }
    else if(effect == 4)
    {
    // good for size = 3
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y - 1,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y - 1,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y + 1,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) - 1 -(x_font+(size*counter_x)),y_font+size*counter_y + 1,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y + 1,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 2 -(x_font+(size*counter_x)),y_font+size*counter_y + 1,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) - 1 -(x_font+(size*counter_x)),y_font+size*counter_y,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 2 -(x_font+(size*counter_x)),y_font+size*counter_y,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y + 2,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y + 2,font_color);
    }
    else if(effect == 5)
    {
    // good for size = 1,3
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y + 1,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y + 1,font_color);
    }

    //lcd_draw_circle(TS_SIZE_X - 3 -(x_font+(size*counter_x)),y_font+size*counter_y,size,1,font_color);

    }
    else if(highlight)
    {


    if(effect == 0)
    for(i=0;i<size;i++)
    for(j=0;j<size;j++)
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + i -(x_font+(size*counter_x)),y_font+size*counter_y + j,highlight_color);
    // Very good effect (1)
    else if(effect == 1)
    {
    // good for size = 2
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y,font_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y - 1,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y + 1,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) - 1 -(x_font+(size*counter_x)),y_font+size*counter_y,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y,highlight_color);
    }
    else if(effect == 2)
    {
    // good for size = 2
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y - 1,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y + 1,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) - 1 -(x_font+(size*counter_x)),y_font+size*counter_y + 1,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y + 1,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) - 1 -(x_font+(size*counter_x)),y_font+size*counter_y,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y + 2,highlight_color);
    }
    else if(effect == 3)
    {
    // good for size = 3
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y - 1,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y - 1,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) - 1 -(x_font+(size*counter_x)),y_font+size*counter_y,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 2 -(x_font+(size*counter_x)),y_font+size*counter_y,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y + 1,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y + 1,highlight_color);
    }
    else if(effect == 4)
    {
    // good for size = 3
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y - 1,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y - 1,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y + 1,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) - 1 -(x_font+(size*counter_x)),y_font+size*counter_y + 1,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y + 1,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 2 -(x_font+(size*counter_x)),y_font+size*counter_y + 1,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) - 1 -(x_font+(size*counter_x)),y_font+size*counter_y,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 2 -(x_font+(size*counter_x)),y_font+size*counter_y,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y + 2,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y + 2,highlight_color);
    }
    else if(effect == 5)
    {
    // good for size = 1,3
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y + 1,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y,highlight_color);
    lcd_write_pixel(TS_SIZE_X - 3 + italic*(-counter_y+7) + 1 -(x_font+(size*counter_x)),y_font+size*counter_y + 1,highlight_color);
    }



    //lcd_draw_circle(TS_SIZE_X - 3 + italic*(-counter_y+7) -(x_font+(size*counter_x)),y_font+size*counter_y,size,1,highlight_color);


    }
    }


    x_font += size*letter_length;
    if(x_font > TS_SIZE_X - 1)
    {
    x_font = x_base;
    y_font += size*16;
    if(y_font > TS_SIZE_Y-0)
    y_font = 0;
    }

    }


    //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
    void lcd_putsf_mix(const unsigned char *string , int size, int color)
    {
    unsigned char letter,nt_letter,pr_letter;
    unsigned char CN=0,CP=0,pr_CN=0,nt_CP=0,place=0,flag1=0;
    unsigned char letter_counter=0,letter_count=0,length=0,enter=0;
    unsigned char text_buffer[32];


    font_color = color;
    flag1 = 0;


    while(*string)
    {
    if(*string > 0x80)
    {
    while(*string > 0x80)
    {
    if (flag1 == 0)
    pr_letter = 0x20;
    else
    pr_letter = *(string - 1);


    letter = *string++;


    if (*string == 0)
    nt_letter = 0x20;
    else
    nt_letter = *string;

    flag1 = 1;


    if(letter > 0x98) letter = letter;
    else if(letter == 0x98) letter = 0xBC;
    else if(letter == 0x90) letter = 0xC0;
    else if(letter == 0x8D) letter = 0xBE;
    else if(letter == 0x81) letter = 0xBD;
    else if(letter == 0x8E) letter = 0xBF;


    if(pr_letter > 0x98) pr_letter = pr_letter;
    else if(pr_letter == 0x98) pr_letter = 0xBC;
    else if(pr_letter == 0x90) pr_letter = 0xC0;
    else if(pr_letter == 0x8D) pr_letter = 0xBE;
    else if(pr_letter == 0x81) pr_letter = 0xBD;
    else if(pr_letter == 0x8E) pr_letter = 0xBF;


    if(nt_letter > 0x98) nt_letter = nt_letter;
    else if(nt_letter == 0x98) nt_letter=0xBC;
    else if(nt_letter == 0x90) nt_letter=0xC0;
    else if(nt_letter == 0x8D) nt_letter=0xBE;
    else if(nt_letter == 0x81) nt_letter=0xBD;
    else if(nt_letter == 0x8E) nt_letter=0xBF;





    if(pr_letter > 0x80)
    pr_CN = ((FAmap[(pr_letter - 0xBC)][5]) == 1);
    else
    pr_CN = 0;

    if(nt_letter > 0x80)
    nt_CP = ((FAmap[(nt_letter - 0xBC)][4]) == 1);
    else
    nt_CP = 0;

    if(letter > 0x80)
    CP = ((FAmap[(letter - 0xBC)][4]) == 1);
    else
    CP = 0;

    if(letter > 0x80)
    CN = ((FAmap[(letter-0xBC)][5]) == 1);
    else
    CN = 0;


    CP = pr_CN && CP;
    CN = CN && nt_CP;
    place = (CP << 1) | CN;

    text_buffer[letter_counter++] = FAmap[(letter - 0xBC)][place];


    length += size*(font12x16 [FAmap[(letter - 0xBC)][place]][1]>>12);
    }




    if(length < TS_SIZE_X - x_font - 3)
    for(letter_count=0;letter_count<letter_counter;letter_count++)
    lcd_put_bold_char(text_buffer[letter_count],size);
    else
    {

    x_font = x_base;
    y_font += size*16;
    if(y_font > TS_SIZE_Y - size*16)
    y_font = 0;

    for(letter_count=0;letter_count<letter_counter;letter_count++)
    lcd_put_bold_char(text_buffer[letter_count],size);
    }
    letter_counter = 0;
    length = 0;
    }
    else if(*string == 0x20) //Space detect
    lcd_put_bold_char(*string++,size);
    else //English letter & Number & Enter detect
    {
    if(*string == 0x0D) //Enter detect
    {
    x_font = x_base;
    y_font += size*16;
    if(y_font > TS_SIZE_Y - size*16)
    y_font = 0;

    string += 2;
    goto p1;
    }
    //letter_counter = 0;
    while((*string < 0x81) && (*(string+1) < 0x81) && (*string != 0x00))
    {


    if(fa_num)
    {
    if((*string > 0x2F) && (*string < 0x3A) && (*string != 0x00))
    {
    letter = (*string) - 0x20;
    text_buffer[letter_counter++] = letter;
    string++;
    goto P2;
    }
    }
    text_buffer[letter_counter++] = *string++;
    P2:
    if((*string == 0x20) && ((letter_counter * size*8) < (TS_SIZE_X - x_font - 1)))
    flag1 = letter_counter;

    if((letter_counter * size*8) > (TS_SIZE_X - x_font - 1))
    {
    string -= (letter_counter - flag1 + 1);
    letter_counter = flag1 - 1;
    enter = 1;


    break;
    }

    }
    if((letter_counter * size*8) < (TS_SIZE_X - x_font - 1))
    {
    for(letter_count=(letter_counter);letter_count>0;letter_count--)
    lcd_put_bold_char(text_buffer[letter_count - 1],size);

    if(enter)
    {
    enter = 0;
    x_font = x_base;
    y_font += size*16;
    if(y_font > TS_SIZE_Y - size*16)
    y_font = 0;
    }
    }
    p1:
    letter_counter = 0;
    flag1 = 0;


    }
    }
    flag1 = 0;


    }


    ویرایش توسط sepehr63 : 2017/01/01 در ساعت 22:18
  7. #7
    2014/01/25
    شهرکرد
    247
    267

    پاسخ : وجود لرزش در یک طرف lcd 4.3 اینچ فروشگاه

    نقل قول نوشته اصلی توسط sepehr63

    مهمان عزیز شما حق دیدن لینک ها را ندارید

    عضویت

    تشکر . راستی مشکل فارسی نویسی حل کردی ؟؟؟ من این تابع با ترکیب چند تا کد درست کردم که اندازه فونت هم تغییر میکنه
    فارسی هم میشه نوشت ولی توی کیل که فارسی تایپ میکنم روی ال سی دی حروف جدا جدا نوشته میشه . البته مشکل مال کیله و اگه توی نت پد تایپ کنم و کپی کنم مشکل حله فقط کار سخت میشه
    برای فارسی نویسی در کیل ابتدا سیستم لوکال ویندوز رو روی ایران بذارین، سپس در تنظیمات کیل configuration اینکدینگل رو روی UTF-8 ست کنین. فروم ایران میکرو هم عکسشو گذاشتم. برا تایمینگ هم از کد بالا استفاده کنین تا حدودی جواب میده.
  8. #8
    2007/08/02
    1,297
    789

    پاسخ : وجود لرزش در یک طرف lcd 4.3 اینچ فروشگاه

    درسته اونو دیده بودم . مشکل فارسی نویسی نمیگم . مشکلی که من میگم همون مشکلیه که ظاهرا شما هم داشتید یعنی توی کیل فارسی تایپ میکنیم ولی روی ال سی دی حروف جدا جدا میشه مسلا کلمه سلام مینویسه س ل ا م که شما هم ظاهرا همین مشکل داشتید . از بابت کتابخانه مطمئن هستم که درسته
  9. #9
    2014/01/25
    شهرکرد
    247
    267

    پاسخ : وجود لرزش در یک طرف lcd 4.3 اینچ فروشگاه

    نقل قول نوشته اصلی توسط sepehr63

    مهمان عزیز شما حق دیدن لینک ها را ندارید

    عضویت

    درسته اونو دیده بودم . مشکل فارسی نویسی نمیگم . مشکلی که من میگم همون مشکلیه که ظاهرا شما هم داشتید یعنی توی کیل فارسی تایپ میکنیم ولی روی ال سی دی حروف جدا جدا میشه مسلا کلمه سلام مینویسه س ل ا م که شما هم ظاهرا همین مشکل داشتید . از بابت کتابخانه مطمئن هستم که درسته
    این بخاطر کتابخونه هست. دوباره بررسی کنین. چون کیل داره حروف فارسی رو با کدینگ UTF-8 کامپایل میکنه و به صورت متغییر در برنامه ذخیره میکنه، اگر ایراد از کیل بود اون حروف اصلا به صورت س ل ا م هم نمایش داده نمیشدن، مشکل از برنامه که نمیتونه تشخیص بده فاصله ای بین حروف نیست و باید از شکل به هم چسبیده حروف استفاده کنه.
نمایش نتایج: از 1 به 9 از 9

موضوعات مشابه

  1. پاسخ: 25
    آخرين نوشته: 2014/09/24, 14:19
  2. تفاوت ال سی دی 2.8 اینچ با ال سی دی 3.2 اینچ فروشگاه eca
    توسط elec200 در انجمن میکروکنترلرهای AVR
    پاسخ: 35
    آخرين نوشته: 2014/04/11, 23:55
  3. چگونگي تشخيص وجود يا عدم وجود ولتاژ 220 ولت با ميکرو
    توسط دلارام22 در انجمن میکروکنترلرهای AVR
    پاسخ: 4
    آخرين نوشته: 2013/10/06, 19:43
  4. کی PCB واسه LCD 2.8 اینچ فروشگاه رو داره؟
    توسط روح الامین در انجمن مدار چاپی (PCB)
    پاسخ: 0
    آخرين نوشته: 2013/04/02, 21:07
  5. تشخیص وجود یا عدم وجود جسمی در محدوده یک متری
    توسط ssaj در انجمن سایر مطالب مرتبط با ميکرو ها و پروسسورها
    پاسخ: 17
    آخرين نوشته: 2008/07/29, 16:34

کلمات کلیدی این موضوع

علاقه مندي ها (Bookmarks)

علاقه مندي ها (Bookmarks)

مجوز های ارسال و ویرایش

  • شما نمیتوانید موضوع جدیدی ارسال کنید
  • شما امکان ارسال پاسخ را ندارید
  • شما نمیتوانید فایل پیوست کنید.
  • شما نمیتوانید پست های خود را ویرایش کنید
  •