Forum: Mikrocontroller und Digitale Elektronik Suche LCD Treiber SSD1289


von Werner (Gast)


Lesenswert?

Habe hier ein Display mit dem SSD1289 auch das Datenblatt aber noch 0 
Plan wie ich da ran gehen soll.

Kleine Tipps wären eventuell hilfreich. Hätte da ein User etwas für 
mich?

von ich (Gast)


Lesenswert?

Es wäre hilfreich, wenn du uns verrätst, was du damit vorhast und was 
genau dein Problem ist?

von Werner (Gast)


Lesenswert?

Nun ich möchte das Display ansteuern mit einem µc. Habe aber wie getippt 
noch kein Plan.

Zum einen nicht wie ich es Hardwaretechnisch anbinde.
Zum anderen wie ich ran gehe Softwaretechnisch etwas darzustellen.

Klar benötigt Ihr mit sicherheit noch einige Dinge. Nur was???

Sagt es mir und ich zeige euch auf was ich davon habe.

Also vorhanden Display mit SDD1289 treiber
Datenblatt
und STK500

von ich (Gast)


Lesenswert?

Ganz ohne Plan wird das sicher nichts und selbst mit Plan ist das eine 
größere Aktion.
Im Datenblatt Kap. 15 INTERFACE MAPPING sind die Möglichkeiten für das 
Hardware-Interface zu deinem Controller beschrieben (Überblick in 
Tabelle 15-1)

von Werner (Gast)


Lesenswert?

So habe mich nochmal durch das Datenblatt gelesen und gerade auch Kap. 
15

Werde aber nich so richtig schlau daraus.

Ich habe an meinem Display

3.3V
GND
D0-D15
CS
RS
WR
RD
BL_CNT
Reset

Diese kann ich im Datenblatt aber nicht finden

von Werner (Gast)


Lesenswert?

Kennt sich keiner aus?

von Fabrice (Gast)


Lesenswert?

Hallo ,

erst sorry for meine Deutch ;)
Ich haben eine SSD1289 Treiber geschriben in CCS C für microchip CPU.
Muss einfach sein für andere CPU zu konvertieren.
Hier ist das source code.

ssd1289.c // das haubt treiber.
1
/*
2
*************************************************************************************************
3
*     TFT LCD 262k Couleur , Controlleur Solomon system's SSD1289
4
*                              Tout droits réservé
5
* On va utiliser 65k couleur (16bits pour la rapidité)
6
* Nom fichier    : SSD1289.c
7
* Programmeur    : Muller F. , conversion en CCS C , ajout des fonctions graphiques.
8
*                              reprise et convertion de LCD_Init de Techtoys
9
* Note           : v2.1 (LCD_Rect modifié , INT8U et INT16U remplacé)
10
* Matériel       : PIC18F4685 , 32Mhz (Int_Osc 8Mhz , PLL X4)
11
* Date           : 08 Mai 2011
12
*************************************************************************************************
13
*                              DESCRIPTION
14
*
15
* Ce module est une interface pour l'ecran TFT 262k Couleur de 240 x 320 points
16
* Controllé par SSD1289
17
* L'ecran est alimenté en 3.3V, La LED d'eclairage de l'ecran consome 15mA
18
* La LED d'eclairage est alimenté par le CAT32 pour 15mA constant (FG020214_BO)
19
* <PS3:PS1:PS0> configuré en  <1:0:0> pour un bus de données de 8 bits en mode 8080
20
*
21
* Fonctions des broches du LCD sur la carte FG020214_BO (www.TechToys.com.hk)
22
* ---------   LCD              PIC -----------------
23
* pin 2      SHDN_BL  - Non utilisé ici, connecter à VCC avec une resistance de 100k
24
* pin 4       GND     - GND
25
* pin 6       VCC     - Alim 3.3V
26
* pin 10      WR      - RC0
27
* pin 12      RD      - RC1
28
* pin 14      CS      - RC2
29
* pin 16      CD      - RC6
30
* pin 18      RST     - Vers reset du CPU (MCLR du PIC)
31
* pin 20:34   D1:D8   - Port de données de l'ecran connecté à RD0:RD7
32
*
33
* Remarques : Les broches de nombre impair ne sont pas connectées en mode de données 8 bits
34
*
35
***********************************************************************************************
36
*/
37
38
39
/*
40
*************************************************************************************************
41
*                                 Definitions Locale
42
*************************************************************************************************
43
*/
44
45
#include <FONT57.c>
46
//#include <image.c>
47
48
/*
49
*************************************************************************************************
50
*        Definition du Délais entre les pulses Haut et Bas sur les broches de l'écran
51
*        A 40Mhz 1 cycle = 100ns (10Mips) (Enlever les comments dans LCD_Cmd,LCD_Read et LCD_Data
52
*        Inutile à 32Mhz et inférieur
53
*************************************************************************************************
54
*/
55
56
#define  att1           1
57
58
/*
59
*************************************************************************************************
60
*                                 Taille de l'ecran
61
*************************************************************************************************
62
*/
63
#define  GCLCDX         239
64
#define  GCLCDY         319
65
#define  X_START        0
66
#define  Y_START        0
67
#define  X_END          GCLCDX + 1
68
#define  Y_END          GCLCDY + 1
69
70
/*
71
*************************************************************************************************
72
*                                 Les Commandes du SSD1289
73
*************************************************************************************************
74
*/
75
76
// Utilisé dans init
77
#define OSC_START            0x00
78
#define DRIVER_OUT           0x01
79
#define LCD_DRIVE_AC         0x02
80
#define POWER_CONTROL1       0x03
81
#define POWER_CONTROL2       0x0C
82
#define POWER_CONTROL3       0x0D
83
#define POWER_CONTROL4       0x0E
84
#define POWER_CONTROL5       0x1E
85
#define DISPLAY_CONTROL      0x07
86
#define ENTRY_MODE           0x11
87
#define SLEEP_MODE           0x10
88
#define HORIZONTAL_RAM_START 0x44
89
#define VERTICAL_RAM_START   0x45
90
#define VERTICAL_RAM_END     0x46
91
#define RAM_WRITE            0x22
92
// Commandes complémentaires
93
#define LCD_X                0x4E
94
#define LCD_Y                0x4F
95
96
97
/*
98
***********************************************************************************************
99
* RGB en 16 bits, pour mode 65k couleurs
100
* [R4R3R2R1R0G5G4G3][G2G1G0B4B3B2B1B0]
101
***********************************************************************************************
102
*/
103
#define RGB16(r,g,b)   ((unsigned int16)r<<11)+(unsigned int16)g<<5)+(unsigned int8)b
104
105
106
/*
107
***********************************************************************************************
108
*                        Definition de quelques couleurs de base en 16 bits
109
***********************************************************************************************
110
*/
111
112
#define  NONE        0x0001      // Juste pour preciser qu'il n'y à pas de couleur
113
114
#define BLEU         0x001F
115
#define JAUNE        0xFFE0
116
#define ROUGE        0xF800
117
#define VERT         0x07E0
118
#define NOIR         0x0000
119
#define BLANC        0xFFFF
120
#define VERTCLAIR    0xEFE0
121
#define VERTFONCE    0XE0E0
122
#define ROUGEFONCE   0XF200
123
#define BLEUFONCE    0X000F
124
#define BLEUCLAIR    0X07FF
125
#define ORANGE       0XF8E0
126
#define MAUVE        0XF81F
127
128
/*
129
***********************************************************************************************
130
*                        Definition des broches , CCS C
131
*                        Materiel : PIC18F4680
132
***********************************************************************************************
133
*/
134
#define  glcd_wr             PIN_C0
135
#define  glcd_rd             PIN_C1
136
#define  glcd_cs             PIN_C2
137
#define  glcd_cd             PIN_C6
138
// LCD Data port D1:D8 --> PIC Port D0:D7
139
140
141
/*
142
***********************************************************************************************
143
*                              Constantes Globale
144
***********************************************************************************************
145
*/
146
147
#define YES                1
148
#define NO                 0
149
#define HIGH               1
150
#define LOW                0
151
152
/*
153
***********************************************************************************************
154
*                           Definition des fonctions
155
***********************************************************************************************
156
*/
157
158
void LCD_Init(void);
159
void LCD_CLS(unsigned int16 couleur);
160
void LCD_Cmd(unsigned int8 cmd);
161
void LCD_Data(unsigned int8 dat);
162
unsigned int8 LCD_Read(void);
163
unsigned int16 LCD_Read_Pixel(unsigned int8 x , unsigned int16 y);
164
void LCD_Fillscreen(unsigned int8 x1, unsigned int16 y1, unsigned int8 x2, unsigned int16 y2,unsigned int16 couleur);
165
void LCD_Pixel(unsigned int8 x , unsigned int16 y , unsigned int16 couleur);
166
void LCD_Ligne(unsigned int8 x1 , unsigned int16 y1 ,unsigned int8 x2 , unsigned int16 y2 , unsigned int16 couleur);
167
void LCD_Rect(unsigned int8 x1, unsigned int16 y1, unsigned int8 x2, unsigned int16 y2, unsigned int8 plein, unsigned int16 couleur);
168
void LCD_Cercle(unsigned int8 x, unsigned int16 y, unsigned int16 rayon, unsigned int8 plein, unsigned int16 couleur);
169
void LCD_Text57(unsigned int8 x, unsigned int16 y, char* textptr, char Taille, unsigned int16 couleur, unsigned int16 couleur_arriere);
170
171
172
/*
173
*************************************************************************************************
174
*                                     DISPLAY INITIALIZATION
175
*
176
* Description : This function initializes the LCD module      
177
* Arguments   : none
178
*         
179
* Returns     : none
180
* Note        : This function should be called once before any of the other functions
181
*************************************************************************************************
182
*/
183
void LCD_Init(void)
184
{
185
186
   // Set the cmd port
187
   Set_Tris_C(0x00);   // Port_C all outputs
188
   // Set the data port
189
   Set_Tris_D(0x00);   // Port_D all outputs
190
   // Set all bit from Port C and D to 0
191
   Output_C(0x00);
192
   Output_D(0x00);
193
194
   // Start screen initialisation
195
196
   LCD_Cmd(OSC_START);          //Start Oscillation
197
   LCD_Data(0x00);
198
   LCD_Data(0x01);
199
200
   LCD_Cmd(DRIVER_OUT);         //Driver Output Control
201
   LCD_Data(0x23);
202
   LCD_Data(0x3F);
203
204
   LCD_Cmd(LCD_DRIVE_AC);       //LCD Drive AC Control
205
   LCD_Data(0x06);
206
   LCD_Data(0x00);
207
208
   LCD_Cmd(POWER_CONTROL1);     //Power Control (1)
209
   LCD_Data(0xA8);
210
   LCD_Data(0xA6);
211
212
   LCD_Cmd(DISPLAY_CONTROL);    //Display Control
213
   LCD_Data(0x00);
214
   LCD_Data(0x33);
215
216
   LCD_Cmd(ENTRY_MODE);         //Set Display color mode for 65k color
217
   LCD_Data(0x68);
218
   LCD_Data(0x30);
219
   
220
   LCD_Cmd(POWER_CONTROL2);     //Power Control (2)
221
   LCD_Data(0x00);
222
   LCD_Data(0x05);
223
224
   LCD_Cmd(POWER_CONTROL3);     //Power Control (3)
225
   LCD_Data(0x30);
226
   LCD_Data(0x0B);
227
228
   LCD_Cmd(POWER_CONTROL4);     //Power Control (4)
229
   LCD_Data(0x20);
230
   LCD_Data(0x00);
231
232
   LCD_Cmd(SLEEP_MODE);         //Exit Sleep Mode
233
   LCD_Data(0x00);
234
   LCD_Data(0x00);
235
   Delay_Ms(30);                //delay 30ms
236
237
   LCD_Cmd(POWER_CONTROL5);     //Power Control (5)
238
   LCD_Data(0x00);
239
   LCD_Data(0xA8);
240
241
   LCD_Cmd(HORIZONTAL_RAM_START);   //Horizontal RAM address position start/end setup
242
   LCD_Data(0xEF);                  //decimal 239
243
   LCD_Data(0x00);                  //decimal 0, i.e. horizontal ranges from 0 -> 239
244
                                    //POR value is 0xEF00 anyway. This address must be set before RAM write
245
   
246
   LCD_Cmd(VERTICAL_RAM_START);     //Vertical RAM address start position setting
247
   LCD_Data(0x00);                  //0x0000 = decimal 0
248
   LCD_Data(0x00);
249
250
   LCD_Cmd(VERTICAL_RAM_END);       //Vertical RAM address end position setting
251
   LCD_Data(0x01);                  //0x013F = decimal 319
252
   LCD_Data(0x3F);
253
254
   LCD_Cmd(RAM_WRITE);              //Commande d'ecriture dans la Memoire ecran
255
256
   LCD_CLS(BLANC);                  //initialize le LCD en couleur Blanche (mode 16 Bits)
257
}
258
259
/*
260
*************************************************************************************************
261
*                            Effacer tout l'ecran en mettant tout les pixels
262
*                             à la couleur passé en argument (mode 16Bits)
263
*
264
* Arguments   : 'couleur' format 16 bits RGB16(r,g,b)(mode 565)
265
*                                    [R4R3R2R1R0G5G4G3][G2G1G0B4B3B2B1B0]
266
*            Pour (r,g,b) de (0,0,0) à (31,63,31)
267
*************************************************************************************************
268
*/
269
void LCD_CLS(unsigned int16 couleur)
270
{
271
   unsigned int8 i,hiByte,lowByte;
272
   unsigned int16 j;
273
274
   hiByte  = couleur>>8;
275
   lowByte = (unsigned int8)couleur;
276
277
   LCD_Cmd(RAM_WRITE);
278
279
   for(j=0;j<Y_END;j++)
280
   {
281
      for(i=0;i<X_END;i++)
282
      {
283
         LCD_Data(hiByte);LCD_Data(lowByte);
284
      }
285
   }
286
}   
287
288
/*
289
*************************************************************************************************
290
*                                     Envoyer une commande à l'écran
291
*************************************************************************************************
292
*/
293
void LCD_Cmd(unsigned int8 cmd)
294
{
295
   Output_D(cmd);
296
   //delay_cycles(att1);
297
   output_bit(glcd_cd,LOW);       //CD LOW pour commande
298
   //delay_cycles(att1);
299
   output_bit(glcd_wr,LOW);
300
   //delay_cycles(att1);
301
   output_bit(glcd_rd,HIGH);
302
   //delay_cycles(att1);
303
   output_bit(glcd_cs,LOW);
304
   //delay_cycles(att1);
305
   output_bit(glcd_cs,HIGH);
306
   //delay_cycles(att1);
307
}
308
/*
309
*************************************************************************************************
310
*                                     Envoyer une donnée 8 bits à l'écran
311
*************************************************************************************************
312
*/
313
void LCD_Data(unsigned int8 dat)
314
{
315
   Output_D(dat);
316
   //delay_cycles(att1);
317
   output_bit(glcd_cd,HIGH);      //CD HIGH pour display data
318
   //delay_cycles(att1);
319
   output_bit(glcd_wr,LOW);
320
   //delay_cycles(att1);
321
   output_bit(glcd_rd,HIGH);
322
   //delay_cycles(att1);
323
   output_bit(glcd_cs,LOW);
324
   //delay_cycles(att1);
325
   output_bit(glcd_cs,HIGH);
326
   //delay_cycles(att1);
327
}
328
329
/*
330
*************************************************************************************************
331
*                                     Lire une donnée 8 bits de l'écran
332
*************************************************************************************************
333
*/
334
unsigned int8 LCD_Read(void)
335
{
336
   unsigned int8 Lecture = 0;
337
   
338
   output_bit(glcd_wr,HIGH);
339
   //delay_cycles(att1);
340
   output_bit(glcd_rd,LOW);
341
   //delay_cycles(att1);
342
   output_bit(glcd_cd,HIGH);      //CD HIGH pour display data
343
   //delay_cycles(att1);
344
   output_bit(glcd_cs,LOW);
345
   //delay_cycles(att1);
346
   Lecture = input_d();
347
   output_bit(glcd_cs,HIGH);
348
   //delay_cycles(att1);
349
   output_bit(glcd_rd,HIGH);
350
   //delay_cycles(att1);
351
   return Lecture;
352
}
353
354
/*
355
*************************************************************************************************
356
*                         Lecture de la couleur d'un point dans l'écran
357
*   x       : 0 à 239
358
*   y       : 0 à 319
359
*   couleur : format 16 bits RGB16(r,g,b)
360
*************************************************************************************************
361
*/
362
363
unsigned int16 LCD_Read_Pixel(unsigned int8 x , unsigned int16 y)
364
{
365
   unsigned int8 hiByte, lowByte;
366
   unsigned int16 Couleur;
367
   
368
   hiByte  = y>>8;
369
   lowByte = (unsigned int8)y;
370
   LCD_Cmd(LCD_X);                              // coordonnée X
371
   LCD_Data(0x00);                              // Coordonnée toujours en 16bits (bit de poid
372
                                                // fort en 1er (0x00 pour 'x' qui est en 8 bits
373
   LCD_Data(x);
374
   LCD_Cmd(LCD_Y);                              // coordonnée Y
375
   LCD_Data(hiByte);
376
   LCD_Data(lowByte);
377
   // Maintenant on lis les 2 Bytes de la couleur et
378
   //on converti en 16 Bits
379
   LCD_Cmd(RAM_WRITE);
380
   hibyte = LCD_Read();                         //Lecture pour rien (retourne le numero de la cmd)
381
   hibyte = LCD_Read();
382
   lowbyte = LCD_Read();
383
   Couleur = Make16(hibyte,lowbyte);
384
   return Couleur;
385
}
386
387
/*
388
*************************************************************************************************
389
*                                     Afficher un point dans l'écran
390
*   x       : 0 à 239
391
*   y       : 0 à 319
392
*   couleur : format 16 bits RGB16(r,g,b)
393
*************************************************************************************************
394
*/
395
396
void LCD_Pixel(unsigned int8 x , unsigned int16 y , unsigned int16 couleur)
397
{
398
   unsigned int8 hiByte, lowByte;
399
400
   // Verifier si le pixel est dans l'ecran (juste verifier bord droit et bas)
401
   if ((x>GCLCDX) || (y>GCLCDY))
402
      continue;
403
   else
404
   {
405
      hiByte  = y>>8;
406
      lowByte = (unsigned int8)y;
407
   
408
      LCD_Cmd(LCD_X);                              // coordonnée X
409
      LCD_Data(0x00);                              // Coordonnée toujours en 16bits (bit de poid
410
                                                   // fort en 1er (0x00 pour 'x' qui est en 8 bits
411
      LCD_Data(x);
412
      LCD_Cmd(LCD_Y);                              // coordonnée Y
413
      LCD_Data(hiByte);
414
      LCD_Data(lowByte);
415
      hiByte  = couleur>>8;
416
      lowByte = (unsigned int8)couleur;
417
      LCD_Cmd(RAM_WRITE);
418
      LCD_Data(hiByte);LCD_Data(lowByte);
419
   }
420
}
421
422
423
/*
424
*************************************************************************************************
425
*                                     Tracer une ligne dans l'écran
426
*   x1      : 0 à 239   : debut x
427
*   y1      : 0 à 319   : debut y
428
*   x2      : 0 à 239   : fin x
429
*   y2      : 0 à 319   : fin y
430
*   couleur : format 16 bits RGB16(r,g,b)
431
*************************************************************************************************
432
*/
433
void LCD_Ligne(unsigned int8 x1 , unsigned int16 y1 ,unsigned int8 x2 , unsigned int16 y2 , unsigned int16 couleur)
434
{
435
   int16        dy, dx;
436
   signed int8  addx=1, addy=1;
437
   signed int16 P, diff;
438
439
   int16 i=0;
440
   dx = abs((signed int8)(x2 - x1));
441
   dy = abs((signed int16)(y2 - y1));
442
443
   if(x1 > x2)
444
      addx = -1;
445
   if(y1 > y2)
446
      addy = -1;
447
448
   if(dx >= dy)
449
   {
450
      dy *= 2;
451
      P = dy - dx;
452
      diff = P - dx;
453
454
      for(; i<=dx; ++i)
455
      {
456
         LCD_Pixel(x1, y1, couleur);
457
458
         if(P < 0)
459
         {
460
            P  += dy;
461
            x1 += addx;
462
         }
463
         else
464
         {
465
            P  += diff;
466
            x1 += addx;
467
            y1 += addy;
468
         }
469
      }
470
   }
471
   else
472
   {
473
      dx *= 2;
474
      P = dx - dy;
475
      diff = P - dy;
476
477
      for(; i<=dy; ++i)
478
      {
479
         LCD_Pixel(x1, y1, couleur);
480
481
         if(P < 0)
482
         {
483
            P  += dx;
484
            y1 += addy;
485
         }
486
         else
487
         {
488
            P  += diff;
489
            x1 += addx;
490
            y1 += addy;
491
         }
492
      }
493
   }
494
}
495
496
/*
497
*************************************************************************************************
498
*                                     Rempli une partie de l'écran
499
*   x1      : 0 à 239   : debut x
500
*   y1      : 0 à 319   : debut y
501
*   x2      : 0 à 239   : fin x
502
*   y2      : 0 à 319   : fin y
503
*   couleur : format 16 bits RGB16(r,g,b)
504
*************************************************************************************************
505
*/
506
void LCD_Fillscreen(unsigned int8 x1, unsigned int16 y1, unsigned int8 x2, unsigned int16 y2,unsigned int16 couleur)
507
{
508
   int16 i;
509
510
   for(i=y1; i<y2; i++)
511
   {
512
      LCD_Ligne(x1 , i , x2 , i , couleur);
513
   }
514
}
515
516
517
/*
518
*************************************************************************************************
519
*                                     Tracer un Rectangle dans l'écran
520
*   x1      : 0 à 239   : debut x
521
*   y1      : 0 à 319   : debut y
522
*   x2      : 0 à 239   : fin x
523
*   y2      : 0 à 319   : fin y
524
*   plein   : YES ou NO (rectangle plein ou vide)
525
*   couleur : format 16 bits RGB16(r,g,b)
526
*************************************************************************************************
527
*/
528
void LCD_Rect(unsigned int8 x1, unsigned int16 y1, unsigned int8 x2, unsigned int16 y2, unsigned int8 plein, unsigned int16 couleur)
529
{
530
   unsigned int8 i,TempX;
531
   unsigned int16 j,TempY;
532
533
   // Tester si x1 et y1 sont inferieures a x2 et y2
534
   if (x1 > x2)
535
      {
536
         TempX = x2;
537
         x2 = x1;
538
         x1 = TempX;
539
      }
540
   if (y1 > y2)
541
      {
542
         TempY = y2;
543
         y2 = y1;
544
         y1 = TempY;
545
      }
546
   if(plein)
547
      for(i=x1; i<x2; i++)
548
         for(j=y1; j<y2; j++)
549
            LCD_Pixel(i , j , couleur);
550
   else
551
      {
552
         LCD_Ligne(x1, y1, x2, y1, couleur);
553
         LCD_Ligne(x1, y2, x2, y2, couleur);
554
         LCD_Ligne(x1, y1, x1, y2, couleur);
555
         LCD_Ligne(x2, y1, x2, y2, couleur);
556
      }
557
}
558
/*
559
*************************************************************************************************
560
*                                     Tracer un Cercle dans l'écran
561
*   x1      : 0 à 239   : debut x
562
*   y1      : 0 à 319   : debut y
563
*   rayon   : Rayon du cercle
564
*   plein   : YES ou NO (cercle plein ou vide)
565
*   couleur : format 16 bits RGB16(r,g,b)
566
*************************************************************************************************
567
*/
568
void LCD_Cercle(unsigned int8 x, unsigned int16 y, unsigned int16 rayon, unsigned int8 plein, unsigned int16 couleur)
569
{
570
   signed int16 a, b, P;
571
   a = 0;
572
   b = rayon;
573
   P = 1 - rayon;
574
575
   do
576
   {
577
      if(plein)
578
      {
579
         LCD_Ligne(x-a, y+b, x+a, y+b, couleur);
580
         LCD_Ligne(x-a, y-b, x+a, y-b, couleur);
581
         LCD_Ligne(x-b, y+a, x+b, y+a, couleur);
582
         LCD_Ligne(x-b, y-a, x+b, y-a, couleur);
583
      }
584
      else
585
      {
586
         LCD_Pixel(a+x, b+y, couleur);
587
         LCD_Pixel(b+x, a+y, couleur);
588
         LCD_Pixel(x-a, b+y, couleur);
589
         LCD_Pixel(x-b, a+y, couleur);
590
         LCD_Pixel(b+x, y-a, couleur);
591
         LCD_Pixel(a+x, y-b, couleur);
592
         LCD_Pixel(x-a, y-b, couleur);
593
         LCD_Pixel(x-b, y-a, couleur);
594
      }
595
596
      if(P < 0)
597
         P+= 3 + 2*a++;
598
      else
599
         P+= 5 + 2*(a++ - b--);
600
    } while(a <= b);
601
}
602
603
/*
604
*************************************************************************************************
605
*                                     Tracer un texte avec la Fonte 5 x 7 points
606
*   x1      : 0 à 239
607
*   y1      : 0 à 319
608
*   Taille  : Utiliser 1 pour la taille normale , ou >1 pour agrandir les caracteres
609
*   couleur         : format 16 bits RGB16(r,g,b)    ** Couleur des caractere
610
*   couleur_arriere : format 16 bits RGB16(r,g,b)    ** Couleur d'arriere plan des caracteres
611
*************************************************************************************************
612
*/
613
void LCD_Text57(unsigned int8 x, unsigned int16 y, char* textptr, char Taille, unsigned int16 couleur, unsigned int16 couleur_arriere)
614
{
615
   int8 j, k, l, m;                                        // Compteurs
616
   int8 pixelData[5];                                      // enregistre les données du caractere
617
618
   for(; *textptr != '\0'; ++textptr, ++x)                 // Compter jusqu'a la fin du texte
619
   {
620
      if(*textptr < 'S') // Regarde si le caractere est stocké dans le 1er tableau de chaine
621
         memcpy(pixelData, FONT[*textptr - ' '], 5);
622
      else if(*textptr <= '~') // Regarde si le caractere est stocké dans le 2eme tableau de chaine
623
         memcpy(pixelData, FONT2[*textptr - 'S'], 5);
624
      else
625
         memcpy(pixelData, FONT[0], 5);   // Si caractere non trouvé alors considerer comme espace
626
627
       // Retour a la ligne et nouvelle ligne
628
      switch(*textptr)
629
      {
630
         case '\n':
631
            y += 7*Taille + 1;
632
            continue;
633
         case '\r':
634
            x = 0;
635
            continue;
636
      }
637
638
      if(x+5*Taille > X_END)                                        // Performs character wrapping
639
      {
640
         x = 0;                                                     // Set x at far left position
641
         y += 7*Taille + 1;                                         // Set y at next position down
642
      }
643
      for(j=0; j<5; ++j, x+=Taille)                                 // Loop through character byte data
644
      {
645
         for(k=0; k < 7; ++k)                                       // Loop through the vertical pixels
646
         {
647
            if(bit_test(pixelData[j], k))                           // Check if the pixel should be set
648
            {
649
               for(l=0; l < Taille; ++l)                            // These two loops change the
650
               {
651
                  for(m=0; m < Taille; ++m)
652
                  {
653
                     LCD_Pixel(x+m, y+k*Taille+l, couleur);         // Draws the pixel
654
                  }
655
               }
656
            }
657
            else if (couleur_arriere != NONE)
658
            {
659
               for(l=0; l < Taille; ++l)                            // These two loops change the
660
               {                                                    // Pixel back color
661
                  for(m=0; m < Taille; ++m)
662
                  {
663
                     LCD_Pixel(x+m, y+k*Taille+l, couleur_arriere); // Draws the pixel
664
                  }
665
               }
666
            }
667
         }
668
      }
669
   }
670
}

jetzt die 5x7 punkt buschtaben.

FONT57.c
1
//                                                                            //
2
////////////////////////////////////////////////////////////////////////////////
3
//                     fonte 5x7                                              //
4
////////////////////////////////////////////////////////////////////////////////
5
//                                                                            //
6
const int8 FONT[51][5] ={0x00, 0x00, 0x00, 0x00, 0x00, // SPACE
7
                         0x00, 0x00, 0x5F, 0x00, 0x00, // !
8
                         0x00, 0x03, 0x00, 0x03, 0x00, // "
9
                         0x14, 0x3E, 0x14, 0x3E, 0x14, // #
10
                         0x24, 0x2A, 0x7F, 0x2A, 0x12, // $
11
                         0x43, 0x33, 0x08, 0x66, 0x61, // %
12
                         0x36, 0x49, 0x55, 0x22, 0x50, // &
13
                         0x00, 0x05, 0x03, 0x00, 0x00, // '
14
                         0x00, 0x1C, 0x22, 0x41, 0x00, // (
15
                         0x00, 0x41, 0x22, 0x1C, 0x00, // )
16
                         0x14, 0x08, 0x3E, 0x08, 0x14, // *
17
                         0x08, 0x08, 0x3E, 0x08, 0x08, // +
18
                         0x00, 0x50, 0x30, 0x00, 0x00, // ,
19
                         0x08, 0x08, 0x08, 0x08, 0x08, // -
20
                         0x00, 0x60, 0x60, 0x00, 0x00, // .
21
                         0x20, 0x10, 0x08, 0x04, 0x02, // /
22
                         0x3E, 0x51, 0x49, 0x45, 0x3E, // 0
23
                         0x00, 0x04, 0x02, 0x7F, 0x00, // 1
24
                         0x42, 0x61, 0x51, 0x49, 0x46, // 2
25
                         0x22, 0x41, 0x49, 0x49, 0x36, // 3
26
                         0x18, 0x14, 0x12, 0x7F, 0x10, // 4
27
                         0x27, 0x45, 0x45, 0x45, 0x39, // 5
28
                         0x3E, 0x49, 0x49, 0x49, 0x32, // 6
29
                         0x01, 0x01, 0x71, 0x09, 0x07, // 7
30
                         0x36, 0x49, 0x49, 0x49, 0x36, // 8
31
                         0x26, 0x49, 0x49, 0x49, 0x3E, // 9
32
                         0x00, 0x36, 0x36, 0x00, 0x00, // :
33
                         0x00, 0x56, 0x36, 0x00, 0x00, // ;
34
                         0x08, 0x14, 0x22, 0x41, 0x00, // <
35
                         0x14, 0x14, 0x14, 0x14, 0x14, // =
36
                         0x00, 0x41, 0x22, 0x14, 0x08, // >
37
                         0x02, 0x01, 0x51, 0x09, 0x06, // ?
38
                         0x3E, 0x41, 0x59, 0x55, 0x5E, // @
39
                         0x7E, 0x09, 0x09, 0x09, 0x7E, // A
40
                         0x7F, 0x49, 0x49, 0x49, 0x36, // B
41
                         0x3E, 0x41, 0x41, 0x41, 0x22, // C
42
                         0x7F, 0x41, 0x41, 0x41, 0x3E, // D
43
                         0x7F, 0x49, 0x49, 0x49, 0x41, // E
44
                         0x7F, 0x09, 0x09, 0x09, 0x01, // F
45
                         0x3E, 0x41, 0x41, 0x49, 0x3A, // G
46
                         0x7F, 0x08, 0x08, 0x08, 0x7F, // H
47
                         0x00, 0x41, 0x7F, 0x41, 0x00, // I
48
                         0x30, 0x40, 0x40, 0x40, 0x3F, // J
49
                         0x7F, 0x08, 0x14, 0x22, 0x41, // K
50
                         0x7F, 0x40, 0x40, 0x40, 0x40, // L
51
                         0x7F, 0x02, 0x0C, 0x02, 0x7F, // M
52
                         0x7F, 0x02, 0x04, 0x08, 0x7F, // N
53
                         0x3E, 0x41, 0x41, 0x41, 0x3E, // O
54
                         0x7F, 0x09, 0x09, 0x09, 0x06, // P
55
                         0x1E, 0x21, 0x21, 0x21, 0x5E, // Q
56
                         0x7F, 0x09, 0x09, 0x09, 0x76};// R
57
58
const int8 FONT2[44][5]={0x26, 0x49, 0x49, 0x49, 0x32, // S
59
                         0x01, 0x01, 0x7F, 0x01, 0x01, // T
60
                         0x3F, 0x40, 0x40, 0x40, 0x3F, // U
61
                         0x1F, 0x20, 0x40, 0x20, 0x1F, // V
62
                         0x7F, 0x20, 0x10, 0x20, 0x7F, // W
63
                         0x41, 0x22, 0x1C, 0x22, 0x41, // X
64
                         0x07, 0x08, 0x70, 0x08, 0x07, // Y
65
                         0x61, 0x51, 0x49, 0x45, 0x43, // Z
66
                         0x00, 0x7F, 0x41, 0x00, 0x00, // [
67
                         0x02, 0x04, 0x08, 0x10, 0x20, // \
68
                         0x00, 0x00, 0x41, 0x7F, 0x00, // ]
69
                         0x04, 0x02, 0x01, 0x02, 0x04, // ^
70
                         0x40, 0x40, 0x40, 0x40, 0x40, // _
71
                         0x00, 0x01, 0x02, 0x04, 0x00, // `
72
                         0x20, 0x54, 0x54, 0x54, 0x78, // a
73
                         0x7F, 0x44, 0x44, 0x44, 0x38, // b
74
                         0x38, 0x44, 0x44, 0x44, 0x44, // c
75
                         0x38, 0x44, 0x44, 0x44, 0x7F, // d
76
                         0x38, 0x54, 0x54, 0x54, 0x18, // e
77
                         0x04, 0x04, 0x7E, 0x05, 0x05, // f
78
                         0x08, 0x54, 0x54, 0x54, 0x3C, // g
79
                         0x7F, 0x08, 0x04, 0x04, 0x78, // h
80
                         0x00, 0x44, 0x7D, 0x40, 0x00, // i
81
                         0x20, 0x40, 0x44, 0x3D, 0x00, // j
82
                         0x7F, 0x10, 0x28, 0x44, 0x00, // k
83
                         0x00, 0x41, 0x7F, 0x40, 0x00, // l
84
                         0x7C, 0x04, 0x78, 0x04, 0x78, // m
85
                         0x7C, 0x08, 0x04, 0x04, 0x78, // n
86
                         0x38, 0x44, 0x44, 0x44, 0x38, // o
87
                         0x7C, 0x14, 0x14, 0x14, 0x08, // p
88
                         0x08, 0x14, 0x14, 0x14, 0x7C, // q
89
                         0x00, 0x7C, 0x08, 0x04, 0x04, // r
90
                         0x48, 0x54, 0x54, 0x54, 0x20, // s
91
                         0x04, 0x04, 0x3F, 0x44, 0x44, // t
92
                         0x3C, 0x40, 0x40, 0x20, 0x7C, // u
93
                         0x1C, 0x20, 0x40, 0x20, 0x1C, // v
94
                         0x3C, 0x40, 0x30, 0x40, 0x3C, // w
95
                         0x44, 0x28, 0x10, 0x28, 0x44, // x
96
                         0x0C, 0x50, 0x50, 0x50, 0x3C, // y
97
                         0x44, 0x64, 0x54, 0x4C, 0x44, // z
98
                         0x00, 0x08, 0x36, 0x41, 0x41, // {
99
                         0x00, 0x00, 0x7F, 0x00, 0x00, // |
100
                         0x41, 0x41, 0x36, 0x08, 0x00, // }
101
                         0x02, 0x01, 0x02, 0x04, 0x02};// ~

Zu benutzen ist nicht kompliziert.

IMMER herst LCD_Init(); das der tft initializiert.
Dann ist alles bereit für alle anderen funktion.

Ich hoffen das dir gehilfen haben.

Schuss ;)

Fabrice.
(Frankreich)

von Patrick h. (patabr)


Lesenswert?

Hallo,
sorry für mein Deutsch Ich bin Französisch (translate mit google)

Ich kaufte mir dieses Moduls
http://www.ebay.com/itm/3-2-TFT-LCD-Module-Display-Touch-Panel-PCB-adapter-/190451748066#ht_5065wt_908

mit SSD1289 driver

Ich versuchte das prog F.Muller (sehr gut) für 2 Tage, aber nichts 
funktioniert .... Ich habe einen Zweifel über den Betrieb des Moduls,

könnten Sie mir ein sehr einfaches kleines prog (ich bin ein Anfänger) 
mit. für einen .hex ​​(for Pic16F877 or pic16F887 or PIC18f4525) und die 
Verkabelung zu sehen, ob es funktioniert

bitte
danke

von Fabrice (Gast)


Angehängte Dateien:

Lesenswert?

Hallo ,

Hier eine beispiel ich haben für diese treiber geschrieben.
Ist mit CCS C Compiler.

Tschuss :)

von Fabrice (Gast)


Angehängte Dateien:

Lesenswert?

Ich habe noch diese andere beispiel :)

Fabrice.

von Oliver (Gast)


Lesenswert?

Diese Library unterstützt ebenfalls den SSD1289:
http://henningkarlsen.com/electronics/library.php?id=51

(Arduino und ChipKit Umgebung)

Oliver

von Michael N. (betonmicha)


Lesenswert?

Hallo,

da ich auch keinen passenden Treiber gefunden habe der meinen 
Anforderungen entspricht, habe ich selber einen geschrieben.

Allerdings ist er noch nicht ganz fertig, was schon funktioniert ist:
- ungefülltes Rechteck zeichen.
- einzelne Pixel setzen
- und Text schreiben
- theoretisch auch Bildausgabe ( aber noch unvollständig)

Bei der Textausgabe bin ich schon fast fertig und es ist möglich mit 
einem Font Editor beliebige Schriftarten in theoretisch beliebiger Größe 
darzustellen. Hängt vom internen Speicher des AVR ab und ob die 
Schriftart auf dem Rechner installiert ist.
Muss da noch ein bisschen anpassen zwecks Höhe der Schrift und ein paar 
optimierungen machen.

Ich werde demnächst einen kleinen Artikel schreiben und dann auch den 
Quelltext veröffentlichen.

Läuft übrigens bei mir auf einem ATmega32 mit 20 MHz.

Gruß Michael

von Michael N. (betonmicha)


Lesenswert?

Ich habe hier mal meinen Treiber für das SSD1289 hochgladen. Ist nur 
experimentell und ich kann im Moment auch nicht dran weiterarbeiten.

http://www.kulturschweine.de/2013/02/atmega32-und-ssd1289-display/

Gruß
Micha

von Mario X. (grinderfx)


Lesenswert?

@Michael der Treiber ist ja ganz nett aber es wäre nett wenn noch 
irgendwo stehen würde welcher Pin wo hin muss.

Im Beitrag von Fabrice wird das ja auch gemacht
pin 2      SHDN_BL  - Non utilisé ici, connecter à VCC avec une 
resistance de 100k
* pin 4       GND     - GND
* pin 6       VCC     - Alim 3.3V
* pin 10      WR      - RC0
* pin 12      RD      - RC1
* pin 14      CS      - RC2
* pin 16      CD      - RC6
* pin 18      RST     - Vers reset du CPU (MCLR du PIC)
* pin 20:34   D1:D8   - Port de données de l'ecran connecté à RD0:RD7

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.