Go Down

Topic: How to control 2 graphic LCDs with one Arduino (Read 9 times) previous topic - next topic

bperrybap

Just a followup.
The library is working fine for the "dual display" 256x64 configuration.
I used my same 128x128 teensy++ setup and simply changed
the config file to make it 256x64 instead and everything works just fine.
I ran the diag and the glcdDemo sketches.

So you can definitely use the dual displays either way.
The only limitation is that when using 256x64 the library code will not
let you access the right most pixel.
It essentially creates a 255x64 display.

So if you want to access all the pixels you will have to run them vertically stacked
as 128x128 instead of horizontally stacked as 256x64.

--- bill

Raoul6391

Hi Bill
Thanks a lot for your reply.
I will try following your recommendations tomorrow night (Central Europe Time).
And will keep you posted.
Raoul.

Raoul6391

Bill

Thank you again for explaining how it works and not just giving tips to make it work… It helps to learn and react smarter in front of any issue.


I went back home for lunch time to do some testing.
You were right, library is working fine with a 256X64 configuration, and yes we loose the last column, meaning the real display is 255X64. I just executed GLCDDiags and some other simple programs I already have.

I confirm there is no need of additional buffering.

My mistake was a wrong wiring on CSEL1 and CSEL2, I confirm that the right configuration is (as it is stated in the file ks0108_Mega.h):

-         CS1 & CS2 from first module must be connected to pins 33, 34

-         CS1 & CS2 from second module must be connected to pins 32, 31.


I tried quickly to apply same methodology for a 128X128 configuration (modifying ks108_Panel.h to change HEIGHT to 128 and chip number to 4 and then GLCD_Config.h):
Code: [Select]
/*
* ks0108-128X128_Panel.h - User specific configuration for Arduino GLCD library
* Modification of ks0108_Panel.h to manage two 128X64 LCDs as one 128X128 LCD 
* Use this file to set LCD panel parameters
* This version is for a standard ks0108 display
* This file uses a board specific pin assignment file based on the board selected in the IDE
*
*/

#ifndef GLCD_PANEL_CONFIG_H
#define GLCD_PANEL_CONFIG_H

/*
* define name for panel configuration
*/
#define glcd_PanelConfigName "Two 128X64 LCD in One LCD 128X128"

/*********************************************************/
/*  Configuration for LCD panel specific configuration   */
/*********************************************************/
#define DISPLAY_WIDTH 128
#define DISPLAY_HEIGHT 128

// panel controller chips
#define CHIP_WIDTH     64  // pixels per chip
#define CHIP_HEIGHT    64  // pixels per chip

/*
* the following is the calculation of the number of chips - do not change
*/
#define glcd_CHIP_COUNT ((DISPLAY_WIDTH + CHIP_WIDTH - 1)  / CHIP_WIDTH)

/*********************************************************/
/*  Chip Select Configuration                            */
/*********************************************************/

/*
* Change the following define to match the number of Chip Select pins for this panel
* Most panels use two pins for chip select,
* but check your datasheet to see if a different number is required
*/
#define NBR_CHIP_SELECT_PINS   4 // the number of chip select pins required for this panel


Code: [Select]
/*
* glcd_Config.h - User specific configuration for Arduino GLCD library
*
* This file is shipped to automatically configure the library for a
* 128x128 ks0108 panel using the wiring described in the documentation.
*
* Use this file to select the active glcd configuration file
* Then edit the selected panel file to configure parameters for that panel.
*
* This wiring is identical to the wiring used in the previous ks0108 library.
* For Teensy devices the wiring selected matches the wiring documented on the Teensy website.
*
*/

#ifndef glcd_CONFIG_H
#define glcd_CONFIG_H

/*
  * You can select a configuration file by uncommenting one line to include the
  * the desired configuration file.
  *
  * Select 1 and only 1 configuration file.
  *
  * The "AutoConfig" configuration files will configure the library based on a set of
  * pre-customized configurations for the supported Arduino board type.
  *
  * These configurations match the the panel configurations and wiring diagrams
  * in the library documentation based on the type of board selected in the Arduino IDE
  * and are compatible with wiring used in earlier versions of the ks0108 library
  *
  * NOTE: if you have a panel that has different dimensions than the distributed configuration, you can either
  * edit the supplied configuration file for that board type or create a fully custom configuration file.
  *
  * The auto configuration file (default is named  "config/ks0108_Panel.h") selects the appropriate board
  * pin configuration file based on the current board selection in the Arduino IDE.
  *   
  * The auto configuration panel configuration files can be found in the "config" directory, the naming is:
  *  "{PANELNAME}_Panel.h"
  * Where:
  *   {PANELNAME} is the glcd panel type. (for example, ks0108)
  *
  * The pin configuration files for each board type can also be found in the "config" directory, the naming is:
  *  "{PANELNAME}_{BOARDNAME}.h"
  * Where:
  *   {PANELNAME} is the glcd panel type. (for example, ks0108)
  *   {BOARDNAME} is the name of the board (as selected in the Arduino IDE).
  *
  * So for example, the auto configuration file name for a ks0108 panel
  * would be: "ks0108_Panel.h"
  * The ks0108 pin configuration file for a "Arduino" board would be: "ks0108_Arduino.h"
  * and the pin configuration file for a "Mega": "ks0108_Mega.h"
  *
  */

/***********************************************************************************************************
*
* BETA TEST NOTE:
*  - Does the autoconfig work correctly in your environment with your boards and displays?
*  - Is the mechanism to make a custom configuration easy to use?
*  - We want your comments and suggestions for making configuration easer, particularly for novices
*
* Additional "autoconfig" files can be created, there is an example for 192x64 panels in this distribution.
* In the future there will be more for different panel types, like sed1520, ks0713, etc..
* Not all custom configuration files that may be supplied in the release are included in the alpha distribution
*
***********************************************************************************************************/


/*
  * autoconfig includes - (comment this out if using manual configurations, see below)
  */
//#include "config/ks0108_Panel.h"          // automatically configure library for a ks0108 panel
//#include "config/ks0108-192x64_Panel.h"   // automatically configure library for a ks0108 192x64 panel
#include "config/ks0108-128X128_Panel.h"          // automatically configure library for a 128X128 panel



I didn't have too much time to debug but GLCDDiags didn't compil showing non compatible chip numbers...
Is the process to be followed the same as for a 256X64 configuration?


Thank you again for the great library and for the time you spent supporting.
Raoul

bperrybap

Yes there is a library problem. Looks like you uncovered an old bug.
It looks like somehow a fix a I did LONG ago was lost in the official panel configuration files.
(It was in my private config files I use for my own testing)
I will correct this in the library so that it is fixed in the next update.

Please replace your define for glcd_CHIP_COUNT in your panel configuration file
with this and it should correct the problem.

Code: [Select]

#define glcd_CHIP_COUNT (((DISPLAY_WIDTH + CHIP_WIDTH - 1)  / CHIP_WIDTH) * ((DISPLAY_HEIGHT + CHIP_HEIGHT -1) / CHIP_HEIGHT))


This happened because we normally don't test vertically stacked chips because
none of the real panels we can test with are made that way, and when I test the
dual display configuration which does use vertically stacked chips, I use a custom
config file that is not part of the normal library.
I found the bug probably a year ago and I thought I put the correction
in all the configuration files, but it seems to now be missing.


Sorry about this.
But thank you for helping make the library better by discovering this issue.


--- bill

Raoul6391

Bill
Don't be sorry at all, I am happy if I can contribute in making the library more robust doing "monkey testing".
I will not be able to try your correction until end of the week as I am currently in a business trip.
I will keep you posted.
Thank you again.
Raoul.

Go Up