0
Offline
Jr. Member
Karma: 0
Posts: 94
Arduino rocks
|
 |
« on: November 06, 2010, 03:50:46 pm » |
Bonsoir, Je démarre sur l'Arduino Mega 2560 (IDE v0021), et j'aurais besoin de votre aide pour y raccorder un LCD graphique 128*64 (lib KS0108). Quels ports doit-on utiliser sur la Mega2560 pour le bus datas, et le bus des commandes ? Je n'arrive pas à transposer le schéma ci-dessous de la Duemilanove sur la Mega2560 : http://www.mon-club-elec.fr/pmwiki_mon_club_elec/pmwiki.php?n=MAIN.ArduinoExpertLCDGraphiqueTestPourriez-vous m'indiquer les branchements à faire, ainsi que la syntaxe des modifs à prévoir sur le fichier ks0108 xxx.h ? D'avance merci. [EDIT] contenu de ks0108_Mega.h */ #ifndef KS0108_CONFIG_H #define KS0108_CONFIG_H
/*********************************************************/ /* Configuration for assigning LCD bits to Arduino Pins */ /*********************************************************/ /* Arduino pins used for Commands - these must be within the range of 30-37 */
#define CSEL1 33 // CS1 Bit // swap pin assignments with CSEL2 if left/right image is reversed #define CSEL2 34 // CS2 Bit #define R_W 35 // R/W Bit #define D_I 36 // D/I Bit #define EN 37 // EN Bit
#define LCD_CMD_PORT PORTC // Command Output Register for pins 30-37
/* This version uses pins 22-29 for LCD Data */
/*******************************************************/ /* end of Arduino configuration */ /*******************************************************/
// these macros map pins to ports using the defines above // the following should not be changed unless you really know what your doing #define LCD_DATA_LOW_NBL A // port for low nibble: A=pins 22-25 #define LCD_DATA_HIGH_NBL A // port for high nibble: A=pins 26-29
// macros to fast write data to pins 30 - 37 #define fastWriteHigh(_pin) (PORTC |= 1 << ((7-(_pin -30)) & 0x07)) #define fastWriteLow(_pin) (PORTC &= ~(1 << ((7-(_pin -30)) & 0x07)))
#endif
|
|
|
|
« Last Edit: November 06, 2010, 03:58:28 pm by kafifi »
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 94
Arduino rocks
|
 |
« Reply #1 on: November 06, 2010, 05:12:25 pm » |
Je viens de lire le readme.txt de la librairie KS0108, le wiring par défaut pour la MEGA est indiqué. Je pars là-dessus avec ma Mega2560, j'espère que c'est OK : Building --------------------------------------------------------------------------------
After the files are copied into your library directory, check the wiring matches the pin configuration for your board. The defualt wiring is different for each of the three chip types: (see http://www.arduino.cc/playground/Code/GLCDks0108 for more info)
..... Mega (ATmega1280) uses configuration file: ks0108_Mega.h CSEL1 33 // CS1 Bit // swap with CSEL2 if left/right is reversed CSEL2 34 // CS2 Bit R_W 35 // R/W Bit D_I 36 // D/I Bit EN 37 // EN Bit
LCD data 0-7 22-29 .....
|
|
|
|
|
Logged
|
|
|
|
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 27
Arduino rocks
|
 |
« Reply #4 on: November 07, 2010, 11:02:34 am » |
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 94
Arduino rocks
|
 |
« Reply #5 on: November 07, 2010, 04:43:22 pm » |
@ Polochon, Nous utilisons les mêmes LCD ;-) @tous, Bon, cela ne marche pas ici :-( J'ai compilé et uploadé le sketch ks0108exemple, rien ne 'affiche, même en jouant sur le potentiomètre de réglage du contraste. Mes branchements sont les suivants Mega "LCD (Panel B)" 5V 2 Gnd 1 n/a 3 22 7 23 8 24 9 25 10 26 11 27 12 28 13 29 14 33 15 34 16 n/a 17 35 5 36 4 37 6 rst 18 GLCDdiags retourne ceci : Serial initialized -------------------------------------------------------------------- GLCD Lib Configuration: glcd ver: 3 glcd_Device ver: 1 gText ver: 1 Panel Configuration:ks0108 Pin Configuration:ks0108-Arduino -------------------------------------------------------------------- GLCD:ks0108 DisplayWidth:128 DisplayHeight:64 Chips:2 ChipWidth:64 ChipHeight:64 CSEL1:14(PIN_J1) CSEL2:15(PIN_J0) RW:16(PIN_H1) DI:17(PIN_H0) EN:18(PIN_D3) D0:8(PIN_H5) D1:9(PIN_H6) D2:10(PIN_B4) D3:11(PIN_B5) D4:4(PIN_G5) D5:5(PIN_E3) D6:6(PIN_H3) D7:7(PIN_H4) Delays: tDDR:320 tAS:140 tDSW:200 tWH:450 tWL:450 ChipSelects: CHIP0:(14,0x1, 15,0x0) CHIP1:(14,0x0, 15,0x1) Data mode: d0-d3:bit i/o d4-d7:bit i/o -------------------------------------------------------------------- Diag Loop: 1 Initializing GLCD A priori, cela ne correspond pas à ce que j'ai câblé ! Savez-vous quel fichier de config je dois corriger ?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 94
Arduino rocks
|
 |
« Reply #6 on: November 07, 2010, 05:37:45 pm » |
C'est bon, j'ai trouvé !!! Traces OK : Serial initialized -------------------------------------------------------------------- GLCD Lib Configuration: glcd ver: 3 glcd_Device ver: 1 gText ver: 1 Panel Configuration:ks0108 Pin Configuration:ks0108-Mega -------------------------------------------------------------------- GLCD:ks0108 DisplayWidth:128 DisplayHeight:64 Chips:2 ChipWidth:64 ChipHeight:64 CSEL1:33(PIN_C4) CSEL2:34(PIN_C3) RW:35(PIN_C2) DI:36(PIN_C1) EN:37(PIN_C0) D0:22(PIN_A0) D1:23(PIN_A1) D2:24(PIN_A2) D3:25(PIN_A3) D4:26(PIN_A4) D5:27(PIN_A5) D6:28(PIN_A6) D7:29(PIN_A7) Delays: tDDR:320 tAS:140 tDSW:200 tWH:450 tWL:450 ChipSelects: CHIP0:(33,0x1, 34,0x0) CHIP1:(33,0x0, 34,0x1) Data mode: byte -------------------------------------------------------------------- Diag Loop: 1 Initializing GLCD Displaying ChipSelect Screens etc... Le soucis venait d'une erreur de syntaxe dans un fichier de config qui pointait vers ks0108_Arduino.h au lieu de ks0108_Mega.h Pour info, j'ai adapté glcd à l'Arduino Mega2560 grâce aux informations trouvées ici : http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1279128237/90L'affichage est vraiment sympa, cela change de mon vieux LCD 16x2 8-)
|
|
|
|
« Last Edit: November 07, 2010, 05:39:42 pm by kafifi »
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 27
Arduino rocks
|
 |
« Reply #7 on: November 08, 2010, 12:46:48 pm » |
Peux-tu décrire précisément la manip que tu as faite car je n'arrive pas à faire fonctionner le mien. pour info je suis sur un mega 1280. Faut-il bien utiliser le panel B de la doc GLCD ? Edit : Visiblement mon problème est différent du tiens puisque mon arduino me retourne ça Serial initialized -------------------------------------------------------------------- GLCD Lib Configuration: glcd ver: 3 glcd_Device ver: 1 gText ver: 1 Panel Configuration:ks0108 Pin Configuration:ks0108-Mega -------------------------------------------------------------------- GLCD:ks0108 DisplayWidth:128 DisplayHeight:64 Chips:2 ChipWidth:64 ChipHeight:64 CSEL1:33(PIN_C4) CSEL2:34(PIN_C3) RW:35(PIN_C2) DI:36(PIN_C1) EN:37(PIN_C0) D0:22(PIN_A0) D1:23(PIN_A1) D2:24(PIN_A2) D3:25(PIN_A3) D4:26(PIN_A4) D5:27(PIN_A5) D6:28(PIN_A6) D7:29(PIN_A7) Delays: tDDR:320 tAS:140 tDSW:200 tWH:450 tWL:450 ChipSelects: CHIP0:(33,0x1, 34,0x0) CHIP1:(33,0x0, 34,0x1) Data mode: byte -------------------------------------------------------------------- Diag Loop: 1 Initializing GLCD
Donc visiblement c'est la configuration qui est chargée mais ça s'arrête là. Si quelqu'un a déjà eu ce problème, merci de m'aider.
|
|
|
|
« Last Edit: November 08, 2010, 01:23:31 pm by Polochon »
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 94
Arduino rocks
|
 |
« Reply #8 on: November 08, 2010, 03:39:15 pm » |
Bonsoir, Oui c'est bien un panel B. J'ai suivi le howto en modifiant ces fichiers : - include/arduino_io.h - config/ks0108_Panel.h - config/ks0108-192x64_Panel.h Chaque #if defined(__AVR_ATmega1280__) devient #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) Sinon, la config du Mega2560 ne se chargeait pas, à la place, c'était "ks0108_Manual_Config.h" avec un mauvais wiring. De ton côté, vérifie encore une fois le câblage LCD <> Arduino, et le choix de la carte. Je ne pense pas à un soucis de potentiomètre de contraste puisque ton diag s'arrête au milieu. Désolé de ne pouvoir t'aider davantage.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 27
Arduino rocks
|
 |
« Reply #9 on: November 08, 2010, 04:43:00 pm » |
Ok, merci.
J'ai déjà vérifié 36 fois mon câblage, mais je vais le faire une 37ème fois. Je dois avoir un faux contact quelque part ou un câble défectueux.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 94
Arduino rocks
|
 |
« Reply #10 on: November 09, 2010, 03:41:39 pm » |
Tiens-nous au courant quand même...
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 27
Arduino rocks
|
 |
« Reply #11 on: November 16, 2010, 02:09:03 pm » |
Bon j'ai testé tous les fils au multimètre pour voir si il n'y avait pas un faux contact puis j'ai tout rebranché en faisant bien attention de ne pas me tromper mais j'ai toujours pareil. Je ne sais plus pas ou chercher.
Le programme me retourne "Initializing GLCD" puis plus rien...
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 94
Arduino rocks
|
 |
« Reply #12 on: November 19, 2010, 06:48:48 am » |
@Polochon, mon plan de câblage pour t'aider: Pin Arduino <> Pin LCD <> Fonction 22 <> 7 <> (D0) 23 <> 8 <> (D1) 24 <> 9 <> (D2) 25 <> 10 <> (D3) 26 <> 11 <> (D4) 27 <> 12 <> (D5) 28 <> 13 <> (D6) 29 <> 14 <> (D7)
33 <> 15 <> (CS1) 34 <> 16 <> (CS2) 35 <> 5 <> (RW) 36 <> 4 <> (DI) 37 <> 6 <> (EN)
1 <> 0v 2 <> +5v 3 <> Vo (curseur potentiomètre de contraste) 18 <> Vee (potentiomètre de contraste, autre extrémité à 0v) 19 <> +5v via 470ohms (Anode led rétro-éclairage) 20 <> masse (Cathode led rétro-éclairage) 17 <> RST
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 27
Arduino rocks
|
 |
« Reply #13 on: December 02, 2010, 01:56:54 pm » |
Bon finalement ça marche, j'ai honte d'avouer pourquoi, j'avais inversé les pins 1 à 20 du LCD...
Merci pour l'aide.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 94
Arduino rocks
|
 |
« Reply #14 on: December 02, 2010, 03:09:07 pm » |
Bah, cela arrive vu le nombre de fils ;-)
Bonne programmation ! @+
|
|
|
|
|
Logged
|
|
|
|
|
|