اطلاعیه

Collapse
No announcement yet.

96 LCD N

Collapse
X
 
  • فیلتر
  • زمان
  • Show
Clear All
new posts

    96 LCD N

    دوستان برای همه میکرو ها مثل AVR و ARM کتابخونه راه اندازی LCD N96 و کتابخونه تاچ اون هست ولی برای PIC نیست :sad: :sad:
    دوستان خواهش میکنم اگه کسی میتونه این کار رو انجام بده یا راهنمایی کنه باید چی کار کنیم :rolleyes:

    البته کتابخونه ای که بشه تو CCS ازش استفاده کرد

    #2
    پاسخ : 96 LCD N

    سلام دوست عزیز من هم یه چند وقتی دنبال همین پروژه رفته بودم ولی pic واقعا مظلوم واقع شده یا با کم لطفی برخی از دوستان مواجه شده که دانستها شون رو در اختیار دیگران قرار نمی دهند .... بهترین جمله برای این دوست اینه : زکات علم نشر ان است .
    شما اگر تمایل و علاقه داشته باشید می تونیم با همکاری دوطرفه یه فایل هدر برای n96 بسازیم ...... مطمعنا افراد زیادی علاقه مند به راه اندازی با pic هستند .....

    دیدگاه


      #3
      پاسخ : 96 LCD N

      خوب لابد برای pic زیاد بکار نمیاد و در اینصورت احتمالا نتیجه کار شما زیاد مورد استفاده واقع نمیشود
      اگر مشکلتون کمبود منابع هس باید زبان انگلیسیتون رو تقویت کنید
      *یادگیری علم زمانی مشکل است که قبل از یادگیری آن را پیچیده تصور کنیم.
      *چرا فکر میکنیم مباحث مهم و پیشرفته و سطح بالا باید پیچیده باشند.

      دیدگاه


        #4
        پاسخ : 96 LCD N

        نوشته اصلی توسط microjo
        خوب لابد برای pic زیاد بکار نمیاد و در اینصورت احتمالا نتیجه کار شما زیاد مورد استفاده واقع نمیشود
        اگر مشکلتون کمبود منابع هس باید زبان انگلیسیتون رو تقویت کنید
        این حرف اصلا با عقل جور در نمیاد چه ربطی داره
        بعد هم کمبود منیع نداریم و تو زبان هم مشکلی نداریم
        راه انداختن همچین کتابخونه ای وقت میبره که ما میخواستیم اگه کسی قبلا این کار رو کرده الکی وقت نزاریم

        نوشته اصلی توسط Meysamhl
        سلام دوست عزیز من هم یه چند وقتی دنبال همین پروژه رفته بودم ولی pic واقعا مظلوم واقع شده یا با کم لطفی برخی از دوستان مواجه شده که دانستها شون رو در اختیار دیگران قرار نمی دهند .... بهترین جمله برای این دوست اینه : زکات علم نشر ان است .
        شما اگر تمایل و علاقه داشته باشید می تونیم با همکاری دوطرفه یه فایل هدر برای n96 بسازیم ...... مطمعنا افراد زیادی علاقه مند به راه اندازی با pic هستند .....
        من موافقم که برای PIC درست کنیم


        دیدگاه


          #5
          پاسخ : 96 LCD N

          salam

          in hedyeh ma be pic dostha


          // In The Name Of GOD
          // lcd pin configuration ba name gln96.h save ****d

          //#define led1 PIN_a5 // pin5



          #define tryac PIN_e0
          #define up_ti PIN_e1
          #define dow_ti PIN_e2

          #define LCD_CS PIN_b3
          #define LCD_RS PIN_b4
          #define LCD_WR PIN_b5
          #define LCD_RD PIN_b6
          #define LCD_RST PIN_b7


          #BYTE port_a = 5
          #BYTE port_b = 6
          #BYTE port_c = 7
          #BYTE port_d = 8
          #BYTE port_E = 9

          #define HIGH 1
          #define LOW 0


          #define TS_INS_START_OSC 0x00
          #define TS_INS_DRIV_OUT_CTRL 0x01
          #define TS_INS_DRIV_WAV_CTRL 0x02
          #define TS_INS_ENTRY_MOD 0x03
          #define TS_INS_RESIZE_CTRL 0x04
          #define TS_INS_DISP_CTRL1 0x07
          #define TS_INS_DISP_CTRL2 0x08
          #define TS_INS_DISP_CTRL3 0x09
          #define TS_INS_DISP_CTRL4 0x0A
          #define TS_INS_RGB_DISP_IF_CTRL1 0x0C
          #define TS_INS_FRM_MARKER_POS 0x0D
          #define TS_INS_RGB_DISP_IF_CTRL2 0x0F
          #define TS_INS_POW_CTRL1 0x10
          #define TS_INS_POW_CTRL2 0x11
          #define TS_INS_POW_CTRL3 0x12
          #define TS_INS_POW_CTRL4 0x13
          #define TS_INS_GRAM_HOR_AD 0x20
          #define TS_INS_GRAM_VER_AD 0x21
          #define TS_INS_RW_GRAM 0x22
          #define TS_INS_POW_CTRL7 0x29
          #define TS_INS_FRM_RATE_COL_CTRL 0x2B
          #define TS_INS_GAMMA_CTRL1 0x30
          #define TS_INS_GAMMA_CTRL2 0x31
          #define TS_INS_GAMMA_CTRL3 0x32
          #define TS_INS_GAMMA_CTRL4 0x35
          #define TS_INS_GAMMA_CTRL5 0x36
          #define TS_INS_GAMMA_CTRL6 0x37
          #define TS_INS_GAMMA_CTRL7 0x38
          #define TS_INS_GAMMA_CTRL8 0x39
          #define TS_INS_GAMMA_CTRL9 0x3C
          #define TS_INS_GAMMA_CTRL10 0x3D
          #define TS_INS_HOR_START_AD 0x50
          #define TS_INS_HOR_END_AD 0x51
          #define TS_INS_VER_START_AD 0x52
          #define TS_INS_VER_END_AD 0x53
          #define TS_INS_GATE_SCAN_CTRL1 0x60
          #define TS_INS_GATE_SCAN_CTRL2 0x61
          #define TS_INS_GATE_SCAN_CTRL3 0x6A
          #define TS_INS_PART_IMG1_DISP_POS 0x80
          #define TS_INS_PART_IMG1_START_AD 0x81
          #define TS_INS_PART_IMG1_END_AD 0x82
          #define TS_INS_PART_IMG2_DISP_POS 0x83
          #define TS_INS_PART_IMG2_START_AD 0x84
          #define TS_INS_PART_IMG2_END_AD 0x85
          #define TS_INS_PANEL_IF_CTRL1 0x90
          #define TS_INS_PANEL_IF_CTRL2 0x92
          #define TS_INS_PANEL_IF_CTRL3 0x93
          #define TS_INS_PANEL_IF_CTRL4 0x95
          #define TS_INS_PANEL_IF_CTRL5 0x97
          #define TS_INS_PANEL_IF_CTRL6 0x98

          #ifdef PORTRAIT
          #define TS_SIZE_X 240
          #define TS_SIZE_Y 320
          #define TS_VAL_ENTRY_MOD 0x0030
          #define TS_INS_GRAM_ADX 0x20
          #define TS_INS_GRAM_ADY TS_INS_GRAM_VER_AD
          #define TS_INS_START_ADX TS_INS_HOR_START_AD
          #define TS_INS_END_ADX TS_INS_HOR_END_AD
          #define TS_INS_START_ADY TS_INS_VER_START_AD
          #define TS_INS_END_ADY TS_INS_VER_END_AD
          #endif

          #ifdef LANDSCAPE
          #define TS_SIZE_X 320
          #define TS_SIZE_Y 240
          #define TS_VAL_ENTRY_MOD 0x0028
          #define TS_INS_GRAM_ADX TS_INS_GRAM_VER_AD
          #define TS_INS_GRAM_ADY TS_INS_GRAM_HOR_AD
          #define TS_INS_START_ADX TS_INS_VER_START_AD
          #define TS_INS_END_ADX TS_INS_VER_END_AD
          #define TS_INS_START_ADY TS_INS_HOR_START_AD
          #define TS_INS_END_ADY TS_INS_HOR_END_AD
          #endif




          //#define RGB(b,g,r) ( b <<11)+(g<<5)+ r

          #define RED 0x001F
          #define GREEN 0x07E0
          #define BLUE 0xF800
          #define YELLOW 0x07FF
          #define volit 0xb81F
          #define brown 0x801F
          #define orang 0x441f
          #define PURPLE 0xF81F
          #define BLACK 0x0000
          #define WHITE 0xFFFF
          #define grand 0x4184


          //RRRRRGGGGGGBBBBB

          //#define Black 0x0000 /* 0, 0, 0 */
          //#define Navy 0x000F /* 0, 0, 128 */
          //#define DarkGreen 0x03E0 /* 0, 128, 0 */
          //#define DarkCyan 0x03EF /* 0, 128, 128 */
          //#define Maroon 0x7800 /* 128, 0, 0 */
          //#define Purple 0x780F /* 128, 0, 128 */
          //#define Olive 0x7BE0 /* 128, 128, 0 */
          //#define LightGrey 0xC618 /* 192, 192, 192 */
          //#define DarkGrey 0x7BEF /* 128, 128, 128 */
          //#define Blue 0x001F /* 0, 0, 255 */
          //#define Green 0x07E0 /* 0, 255, 0 */
          //#define Cyan 0x07FF /* 0, 255, 255 */
          //#define Red 0xF800 /* 255, 0, 0 */
          //#define Magenta 0xF81F /* 255, 0, 255 */
          //#define Yellow 0xFFE0 /* 255, 255, 0 */
          //#define White 0xFFFF

          #define Line0 0
          #define Line1 24
          #define Line2 48
          #define Line3 72
          #define Line4 96
          #define Line5 120
          #define Line6 144
          #define Line7 168
          #define Line8 192
          #define Line9 216







          #define RST_LOW output_low (LCD_RST)
          #define RST_HIGH output_high (LCD_RST)
          #define RS_LOW output_low (LCD_RS)
          #define RS_HIGH output_high (LCD_RS)
          #define CS_LOW output_low (LCD_CS)
          #define CS_HIGH output_high (LCD_CS)
          #define RD_LOW output_low (LCD_RD)
          #define RD_HIGH output_high (LCD_RD)
          #define WR_LOW output_low (LCD_WR)
          #define WR_HIGH output_high (LCD_WR)


          // LCD functions:
          // write into the index register of LCD
          void LCD_DATAPORT (int16 data)

          {
          int8 t;
          t=data & 0xff;
          OUTPUT_c(t);
          t= data >> 8;
          OUTPUT_d( t);
          }


          void lcd_write_index_register (int8 command)
          {
          CS_LOW;
          RS_LOW;
          LCD_DATAPORT(0xffff); //LCD_DATAPORT_CLEAR
          OUTPUT_c(command);
          WR_LOW;
          WR_HIGH;
          CS_HIGH;
          }

          // write into the WDR register
          void lcd_write_wdr(int16 data)
          {
          CS_LOW;
          RS_HIGH;
          LCD_DATAPORT(0xffff); //LCD_DATAPORT_CLEAR
          LCD_DATAPORT(data);
          WR_LOW;
          WR_HIGH;
          CS_HIGH;
          }

          // send a command
          void lcd_write_command(int index,int argument)
          {
          lcd_write_index_register(index);
          lcd_write_wdr(argument);
          }


          int16 RGB(int8 b,int8 g,int8 r){
          int16 i,j;
          i=b;
          i=( i<<11);
          j=g;
          j=(j<<5);
          i= i+j;
          i=i+r ;
          return i;

          }


          void lcd_clear(void)
          {
          int32 counter;


          lcd_write_index_register(TS_INS_GRAM_ADX);
          lcd_write_wdr(0);
          lcd_write_index_register(TS_INS_GRAM_ADY);
          lcd_write_wdr(0);
          lcd_write_index_register(TS_INS_START_ADX);
          lcd_write_wdr(0);
          lcd_write_index_register(TS_INS_END_ADX);
          #ifdef PORTRAIT
          lcd_write_wdr(239);
          #else
          lcd_write_wdr(319);
          #endif
          lcd_write_index_register(TS_INS_START_ADY);
          lcd_write_wdr(0);
          lcd_write_index_register(TS_INS_END_ADY);
          #ifdef PORTRAIT
          lcd_write_wdr(319);
          #else
          lcd_write_wdr(239);
          #endif
          lcd_write_index_register(TS_INS_RW_GRAM);
          for(counter=0 ; counter<76790 ; ++ counter)
          lcd_write_wdr(0xFFFF);
          }

          // LCD initialization
          void InitLcd(void)
          {
          LCD_DATAPORT(0xffff); //LCD_DATAPORT_set

          // reset lcd chipset
          RST_LOW;
          delay_ms(50);
          RST_HIGH;

          lcd_write_index_register(0x00E3);
          lcd_write_wdr(0x3008); //set the internal timing
          lcd_write_index_register(0x00E7);
          lcd_write_wdr(0x0012); //set the internal timing
          lcd_write_index_register(0x00EF);

          lcd_write_wdr(0x1231); //set the internal timing
          lcd_write_index_register(TS_INS_START_OSC);
          lcd_write_wdr(0x0001); //start oscillator
          delay_ms(50);

          lcd_write_index_register(TS_INS_DRIV_OUT_CTRL);
          lcd_write_wdr(0x0100); //set SS, SM
          lcd_write_index_register(TS_INS_DRIV_WAV_CTRL);
          lcd_write_wdr(0x0700); //set 1 line inversion

          lcd_write_index_register(TS_INS_ENTRY_MOD);
          lcd_write_wdr(TS_VAL_ENTRY_MOD); //set GRAM write direction, BGR=0

          lcd_write_index_register(TS_INS_RESIZE_CTRL);
          lcd_write_wdr(0x0000); //no resizing

          lcd_write_index_register(TS_INS_DISP_CTRL2);
          lcd_write_wdr(0x0202); //front & back porch periods = 2
          lcd_write_index_register(TS_INS_DISP_CTRL3);
          lcd_write_wdr(0x0000);
          lcd_write_index_register(TS_INS_DISP_CTRL4);
          lcd_write_wdr(0x0000);
          lcd_write_index_register(TS_INS_RGB_DISP_IF_CTRL1) ;
          lcd_write_wdr(0x0000); //select system interface
          lcd_write_index_register(TS_INS_FRM_MARKER_POS);
          lcd_write_wdr(0x0000);
          lcd_write_index_register(TS_INS_RGB_DISP_IF_CTRL2) ;
          lcd_write_wdr(0x0000);

          lcd_write_index_register(TS_INS_POW_CTRL1);
          lcd_write_wdr(0x0000);
          lcd_write_index_register(TS_INS_POW_CTRL2);
          lcd_write_wdr(0x0007);
          lcd_write_index_register(TS_INS_POW_CTRL3);
          lcd_write_wdr(0x0000);
          lcd_write_index_register(TS_INS_POW_CTRL4);
          lcd_write_wdr(0x0000);
          delay_ms(200);

          lcd_write_index_register(TS_INS_POW_CTRL1);
          lcd_write_wdr(0x1690);
          lcd_write_index_register(TS_INS_POW_CTRL2);
          lcd_write_wdr(0x0007); //lcd_write_wdr(0x0137);
          delay_ms(50);

          lcd_write_index_register(TS_INS_POW_CTRL3);
          lcd_write_wdr(0x001A); //lcd_write_wdr(0x013C);
          delay_ms(50);

          lcd_write_index_register(TS_INS_POW_CTRL4);
          lcd_write_wdr(0x1800); //lcd_write_wdr(0x1400);
          lcd_write_index_register(TS_INS_POW_CTRL7);
          lcd_write_wdr(0x002A); //lcd_write_wdr(0x0007);
          delay_ms(50);

          lcd_write_index_register(TS_INS_GRAM_HOR_AD);
          lcd_write_wdr(0x0000);
          lcd_write_index_register(TS_INS_GRAM_VER_AD);
          lcd_write_wdr(0x0000);

          lcd_write_index_register(TS_INS_GAMMA_CTRL1);
          lcd_write_wdr(0x0707);
          lcd_write_index_register(TS_INS_GAMMA_CTRL2);
          lcd_write_wdr(0x0707);
          lcd_write_index_register(TS_INS_GAMMA_CTRL3);
          lcd_write_wdr(0x0707);
          lcd_write_index_register(TS_INS_GAMMA_CTRL4);
          lcd_write_wdr(0x0007);
          lcd_write_index_register(TS_INS_GAMMA_CTRL5);
          lcd_write_wdr(0x0F0F);
          lcd_write_index_register(TS_INS_GAMMA_CTRL6);
          lcd_write_wdr(0x0707);
          lcd_write_index_register(TS_INS_GAMMA_CTRL7);
          lcd_write_wdr(0x0707);
          lcd_write_index_register(TS_INS_GAMMA_CTRL8);
          lcd_write_wdr(0x0707);
          lcd_write_index_register(TS_INS_GAMMA_CTRL9);
          lcd_write_wdr(0x0007);
          lcd_write_index_register(TS_INS_GAMMA_CTRL10);
          lcd_write_wdr(0x0F0F);

          lcd_write_index_register(TS_INS_HOR_START_AD);
          lcd_write_wdr(0x0000);
          lcd_write_index_register(TS_INS_HOR_END_AD);
          lcd_write_wdr(0x00EF);
          lcd_write_index_register(TS_INS_VER_START_AD);
          lcd_write_wdr(0x0000);
          lcd_write_index_register(TS_INS_VER_END_AD);
          lcd_write_wdr(0x013F);
          lcd_write_index_register(TS_INS_GATE_SCAN_CTRL1);
          lcd_write_wdr(0xA700);
          lcd_write_index_register(TS_INS_GATE_SCAN_CTRL2);
          lcd_write_wdr(0x0001);
          lcd_write_index_register(TS_INS_GATE_SCAN_CTRL3);
          lcd_write_wdr(0x0000);

          lcd_write_index_register(TS_INS_PART_IMG1_DISP_POS );
          lcd_write_wdr(0x0000);
          lcd_write_index_register(TS_INS_PART_IMG1_START_AD );
          lcd_write_wdr(0x0000);
          lcd_write_index_register(TS_INS_PART_IMG1_END_AD);
          lcd_write_wdr(0x0000);
          lcd_write_index_register(TS_INS_PART_IMG2_DISP_POS );
          lcd_write_wdr(0x0000);
          lcd_write_index_register(TS_INS_PART_IMG2_START_AD );
          lcd_write_wdr(0x0000);
          lcd_write_index_register(TS_INS_PART_IMG2_END_AD);
          lcd_write_wdr(0x0000);

          lcd_write_index_register(TS_INS_PANEL_IF_CTRL1);
          lcd_write_wdr(0x0010);
          lcd_write_index_register(TS_INS_PANEL_IF_CTRL2);
          lcd_write_wdr(0x0000);
          lcd_write_index_register(TS_INS_PANEL_IF_CTRL3);
          lcd_write_wdr(0x0003);
          lcd_write_index_register(TS_INS_PANEL_IF_CTRL4);
          lcd_write_wdr(0x0110);
          lcd_write_index_register(TS_INS_PANEL_IF_CTRL5);
          lcd_write_wdr(0x0000);
          lcd_write_index_register(TS_INS_PANEL_IF_CTRL6);
          lcd_write_wdr(0x0000);

          lcd_write_index_register(TS_INS_DISP_CTRL1);
          lcd_write_wdr(0x0133);

          lcd_write_index_register(TS_INS_FRM_RATE_COL_CTRL) ;
          lcd_write_wdr(0x000D);

          //

          دیدگاه


            #6
            پاسخ : 96 LCD N

            lcd_clear();
            }


            // turn on a pixel on the lcd screen
            void lcd_write_pixel(int16 x,int16 y,int16 color)
            {
            #ifdef LANDSCAPE
            y=239-y;
            #endif
            lcd_write_index_register(TS_INS_GRAM_ADX);
            lcd_write_wdr(x);
            lcd_write_index_register(TS_INS_GRAM_ADY);
            lcd_write_wdr(y);
            lcd_write_index_register(TS_INS_START_ADX);
            lcd_write_wdr(x);
            lcd_write_index_register(TS_INS_END_ADX);
            lcd_write_wdr(x);
            lcd_write_index_register(TS_INS_START_ADY);
            lcd_write_wdr(y);
            lcd_write_index_register(TS_INS_END_ADY);
            lcd_write_wdr(y);
            lcd_write_index_register(TS_INS_RW_GRAM);
            lcd_write_wdr(color);
            }



            void lcd_draw_line (int16 x1, int16 y1, int16 x2, int16 y2, int16 color)
            {
            signed int16 x, y, addx, addy, dx, dy;
            signed long P;
            int16 i ;

            dx = abs((signed int16)(x2 - x1));
            dy = abs((signed int16)(y2 - y1));
            x = x1;
            y = y1;

            if(x1 > x2)
            addx = -1;
            else
            addx = 1;
            if(y1 > y2)
            addy = -1;
            else
            addy = 1;

            if(dx >= dy)
            {
            P = 2*dy - dx;

            for(i=0; i<=dx; ++i)
            {
            lcd_write_pixel(x, y, color);

            if(P < 0)
            {
            P += 2*dy;
            x += addx;
            }
            else
            {
            P += 2*dy - 2*dx;
            x += addx;
            y += addy;
            }
            }
            }
            else
            {
            P = 2*dx - dy;

            for(i=0; i<=dy; ++i)
            {
            lcd_write_pixel(x, y, color);

            if(P < 0)
            {
            P += 2*dx;
            y += addy;
            }
            else
            {
            P += 2*dx - 2*dy;
            x += addx;
            y += addy;
            }
            }
            }
            }


            // draw a fill(1) or no fill(0) rectangular with specified color
            void lcd_draw_rectangle(int16 x0,int16 y0,int16 x1,int16 y1,char fill,int16 color)
            {
            if(fill)
            {
            int16 counter_x;
            int16 counter_y;

            lcd_write_index_register(TS_INS_GRAM_ADX);
            lcd_write_wdr(x0);
            lcd_write_index_register(TS_INS_GRAM_ADY);
            lcd_write_wdr(y0);
            lcd_write_index_register(TS_INS_START_ADX);
            lcd_write_wdr(x0);
            lcd_write_index_register(TS_INS_END_ADX);
            lcd_write_wdr(x1);
            #ifdef PORTRAIT
            lcd_write_index_register(TS_INS_START_ADY);
            lcd_write_wdr(y0);
            lcd_write_index_register(TS_INS_END_ADY);
            lcd_write_wdr(y1);
            #else
            lcd_write_index_register(TS_INS_START_ADY);
            lcd_write_wdr(239-y1);
            lcd_write_index_register(TS_INS_END_ADY);
            lcd_write_wdr(239-y0);
            #endif
            lcd_write_index_register(TS_INS_RW_GRAM);
            for(counter_y=y0;counter_y<=y1;counter_y++)
            {
            for(counter_x=x0;counter_x<=x1;counter_x++)
            lcd_write_wdr(color);
            }
            }
            else
            {
            lcd_draw_line(x0, y0, x1, y0, color);
            lcd_draw_line(x0, y1, x1, y1, color);
            lcd_draw_line(x0, y0, x0, y1, color);
            lcd_draw_line(x1, y0, x1, y1, color);
            }
            }




            // Purpose: Draw a circle on a graphic LCD
            // Inputs: (x,y) - the center of the circle
            // radius - the radius of the circle
            // fill - YES or NO
            // color - ON or OFF
            void lcd_draw_circle(int16 x, int16 y, int16 radius, int1 fill, int16 color)
            {
            signed int16 a, b, P;
            a = 0;
            b = radius;
            P = 1 - radius;

            do
            {
            if(fill)
            {
            lcd_draw_line(x-a, y+b, x+a, y+b, color);
            lcd_draw_line(x-a, y-b, x+a, y-b, color);
            lcd_draw_line(x-b, y+a, x+b, y+a, color);
            lcd_draw_line(x-b, y-a, x+b, y-a, color);
            }
            else
            {
            lcd_write_pixel(a+x, b+y, color);
            lcd_write_pixel(b+x, a+y, color);
            lcd_write_pixel(x-a, b+y, color);
            lcd_write_pixel(x-b, a+y, color);
            lcd_write_pixel(b+x, y-a, color);
            lcd_write_pixel(a+x, y-b, color);
            lcd_write_pixel(x-a, y-b, color);
            lcd_write_pixel(x-b, y-a, color);
            }

            if(P < 0)
            P+= 3 + 2*a++;
            else
            P+= 5 + 2*(a++ - b--);
            } while(a <= b);
            }

            // Purpose: Draw a baar a graphic LCD
            // Inputs:
            // color - ON or OFF


            void glcd_bar(int16 x1, int16 y1, int16 x2, int16 y2, int16 width, int16 color)
            {
            signed int16 x, y, addx, addy, j;
            signed long P, dx, dy, c1, c2;
            int i;
            dx = abs((signed int)(x2 - x1));
            dy = abs((signed int)(y2 - y1));
            x = x1;
            y = y1;
            c1 = -dx*x1 - dy*y1;
            c2 = -dx*x2 - dy*y2;

            if(x1 > x2)
            {
            addx = -1;
            c1 = -dx*x2 - dy*y2;
            c2 = -dx*x1 - dy*y1;
            }
            else
            addx = 1;
            if(y1 > y2)
            {
            addy = -1;
            c1 = -dx*x2 - dy*y2;
            c2 = -dx*x1 - dy*y1;
            }
            else
            addy = 1;

            if(dx >= dy)
            {
            P = 2*dy - dx;

            for(i=0; i<=dx; ++i)
            {
            for(j=-(width/2); j<width/2+width%2; ++j)
            {
            if(dx*x+dy*(y+j)+c1 >= 0 && dx*x+dy*(y+j)+c2 <=0)
            lcd_write_pixel(x, y+j, color);
            }
            if(P < 0)
            {
            P += 2*dy;
            x += addx;
            }
            else
            {
            P += 2*dy - 2*dx;
            x += addx;
            y += addy;
            }
            }
            }
            else
            {
            P = 2*dx - dy;

            for(i=0; i<=dy; ++i)
            {
            if(P < 0)
            {
            P += 2*dx;
            y += addy;
            }
            else
            {
            P += 2*dx - 2*dy;
            x += addx;
            y += addy;
            }
            for(j=-(width/2); j<width/2+width%2; ++j)
            {
            if(dx*x+dy*(y+j)+c1 >= 0 && dx*x+dy*(y+j)+c2 <=0)
            lcd_write_pixel(x+j, y, color);
            }
            }
            }
            }

            /*
            void LCD_Write_Icon(int16 p, int16 k, int16 *pointer)
            {
            int16 i,j,l;
            int16 f;
            // LCDSetXY(0, 0);
            f=0,l=0;
            // l=p+p/2;


            for (j=p; j<p+na[0]; j++){ //105 113

            for (i=k; i<k+na[1]; i++) { // 105 85

            lcd_write_pixel(i,j,na[f++]);

            }
            }

            }

            */

            void lcd_write_pic(int x,int y, int16 *pointer)
            {
            int32 counter,compare_value;

            // compare_value=pointer[0]* pointer[1];
            compare_value=1200;
            lcd_write_index_register(TS_INS_GRAM_ADX);
            lcd_write_wdr(x);
            lcd_write_index_register(TS_INS_START_ADX);
            lcd_write_wdr(x);
            lcd_write_index_register(TS_INS_END_ADX);
            lcd_write_wdr(x+pointer[0]-1);
            #ifdef PORTRAIT
            lcd_write_index_register(TS_INS_GRAM_ADY);
            lcd_write_wdr(y);
            lcd_write_index_register(TS_INS_START_ADY);
            lcd_write_wdr(y);
            lcd_write_index_register(TS_INS_END_ADY);
            lcd_write_wdr(y+pointer[1]-1);
            #else
            lcd_write_index_register(TS_INS_GRAM_ADY);
            lcd_write_wdr(239-y);
            lcd_write_index_register(TS_INS_START_ADY);
            lcd_write_wdr(239-(y+pointer[1]));
            lcd_write_index_register(TS_INS_END_ADY);
            lcd_write_wdr(239-y);
            #endif
            lcd_write_index_register(TS_INS_RW_GRAM);
            for(counter=0,pointer+=2;counter<compare_value; ++counter,++pointer)
            lcd_write_wdr(*pointer);
            // for(counter=2 ; counter<76790 ; ++ counter,++pointer)
            //lcd_write_wdr( hadi[counter]);

            }


            دیدگاه


              #7
              پاسخ : 96 LCD N

              inam taregeh kar ba on


              #if defined(__PCB__)
              #include <16C56.h>
              #fuses HS,NOWDT,NOPROTECT
              #use delay(clock=12000000)

              #elif defined(__PCM__)
              #include <16F877.h>
              #device adc=10
              #fuses HS,NOWDT,NOPROTECT,NOLVP
              #use delay(clock=12000000)


              #elif defined(__PCH__)
              #include <18F452.h>
              #fuses Hs,NOWDT,NOPROTECT,NOLVP
              #use delay(clock=20000000)
              #endif



              //#define TONE_PIN PIN_a3

              //#define LANDSCAPE
              #define PORTRAIT


              #include "GLn96.h"
              //#include "touch.h"
              //#include "iso_obdi.h"
              //#include "txt_farsi.h"


              #include <string.h>
              #include <STDLIB.H>
              #include <math.h>
              #include <time.h> //standard C time library







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


              void main()
              {

              int8 cmd , com ;
              unsigned int8 speed , temper, oxsi,load ,tspeed , ttemper, toxsi,tload ;
              unsigned int16 rpm ,trpm;
              char string[100];

              InitLcd();
              lcd_clear();
              lcd_draw_rectangle(0,0,239,319,1,0xedf1);


              // strcpy(string," بسم الله الرحمان الرحیم "



              output_high(LED1_init );

              delay_ms(900);
              output_low(LED1_init );

              delay_ms(400);


              // fprintf(COM_b," \n\r start iso_5_baud_init " );
              //sprintf(string," start iso_init ! "
              // LCDPutChar( string,0,12,2, brown ,red );

              }



              tashkor ha 100 besheh ye source talaye deghe mizaram

              دیدگاه


                #8
                پاسخ : 96 LCD N


                #if defined(__PCB__)
                #include <16C56.h>
                #fuses HS,NOWDT,NOPROTECT
                #use delay(clock=12000000)

                #elif defined(__PCM__)
                #include <16F877.h>
                #device adc=10
                #fuses HS,NOWDT,NOPROTECT,NOLVP
                #use delay(clock=12000000)


                #elif defined(__PCH__)
                #include <18F452.h>
                #fuses Hs,NOWDT,NOPROTECT,NOLVP
                #use delay(clock=20000000)
                #endif



                //#define TONE_PIN PIN_a3

                //#define LANDSCAPE
                #define PORTRAIT


                #include "GLn96.h"
                //#include "touch.h"
                //#include "iso_obdi.h"
                //#include "txt_farsi.h"


                #include <string.h>
                #include <STDLIB.H>
                #include <math.h>
                #include <time.h> //standard C time library







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


                void main()
                {

                int8 cmd , com ;
                unsigned int8 speed , temper, oxsi,load ,tspeed , ttemper, toxsi,tload ;
                unsigned int16 rpm ,trpm;
                char string[100];

                InitLcd();
                lcd_clear();
                lcd_draw_rectangle(0,0,239,319,1,0xedf1);


                // strcpy(string," بسم الله الرحمان الرحیم "



                output_high(LED1_init );

                delay_ms(900);
                output_low(LED1_init );

                delay_ms(400);


                // fprintf(COM_b," \n\r start iso_5_baud_init " );
                //sprintf(string," start iso_init ! "
                // LCDPutChar( string,0,12,2, brown ,red );

                }

                دیدگاه


                  #9
                  پاسخ : 96 LCD N

                  salam
                  bayad begam chon hajm kodha zyad bod
                  nashod to ye post benvisamesh
                  majbor shodam 3 ghesmatesh kardam do ghesmat post aval dar ye file be name
                  gl96.h save ****d va on ro be projaton ezafeh ****d
                  post sevom ham taregheh kar ba on ast
                  on ghesmat haye ezafesh hazf ****d


                  in dastorat ezafeh marbot be ketabkhonehaye digam ast

                  ketabkonehaye ccs man be sharh zir ast



                  1- ketabkhone farsi nevisi lcd ke shamel font va adad farsi va english ast
                  2- driver lcd n96 kamel ke braton gozashtam
                  3-driver lcd 3310
                  4-driver lcd nokia 6610 ba chip psf
                  5-driver lcd 240p320 chip sumsung
                  6 -driver mmc card fat16 va 32 hata braye pic16f876
                  7-driver chip tdmf mt
                  8-drive toche lcd
                  9-driver majol sim 300 va sim 900
                  10-driver majol rfm12
                  11-driver tabdil va zakihreh voice be roye mmc va ic flashe 29f160
                  12-driver pal signal video dar ccs
                  13-rah andazi steper dot matris va seven segment hamegi dar yek driver
                  14-driver ir remote control hameh sistemha ba khorojeh estandard shamel sony rc5 nec samsung va kontrolhaye dasgahaye chini
                  15-driver mp3 vs1001

                  16-shakar akhar driver ecu mashinhaye ba protcol iso9341
                  tamami driverha va filhaye include neveshteh khodam ast in filha costmiz shodeh ast

                  goli ke dadam sar jash ast
                  har 100 tashakor az har user ye sorce kode braye on user

                  :bye :bye

                  دیدگاه


                    #10
                    پاسخ : 96 LCD N

                    اول تشکر میکنم از دوست عزیز که اینا رو اینجا گذاشتید

                    و اینجوری نمیشه ازش استفاده کرد اگه لطف کنید همه فایل ها رو بزارید تو یه فایل RAR بعد تو این سایت خیلی راحت و مجانی پلودش کنید و لینکش رو بزارید اینجا که همه دانلود کنیم خیلی عالی میشه

                    http://ifile.it/

                    با تشکر فراوان

                    دیدگاه


                      #11
                      پاسخ : 96 LCD N

                      این لینک همه رو داره
                      http://www.thaieasyelec.net/index.php/display-module/breakout-board/breakout-board-2-8-inch-qvga-tft-lcd-with-touch-screen/p_3.html

                      دیدگاه

                      لطفا صبر کنید...
                      X