Ks0108B Generic LCD Interface Help PLease

Hi all.
I am trying to interface a Generic LCD from Spark fun:

To an Arduino 2009.
I followed this tutorial:
http://www.arduino.cc/playground/Code/GLCDks0108

And all seemed fine and dandy but there is a table about half way down that has a few different pin out versions.

The data sheet for the model number on the back of the LCD display says that I need to use Pinout A, Based on the table on page three:
http://amotec-display.com/pdf/ADM12864H.pdf

The Backlight is working. Contrast seems to be even though i dont have a negative voltage there, using a POT i can make the screen dark with pixels or blank.

This means completely powered up, Correct?

I have downloaded the libraries and tried the example code and sketch from the forementioned Arduino Tutorial and cant even get a pixel to change.

I have included the specific arduino library header, ks0108_arduino.h which maps the pins to the arduino.

Also the Sparkfun data sheet for the screen is here:

but that part number is no where on the display
which the one from Amotecs is on the back, it seems the only difference between the 2 are the chip select. but i feel that would just result in the LCD displaying backwords i would assume, it wouldnt inhibit the device altogether.

Has anyone used this before?
what success have you had and how did you do it?

I guess im just reaching out here for a little advice, i have tried so many things i need some outside help.
thanks guys.

even though i dont have a negative voltage there

You don't need a negative voltage. The pin is outputing a negative voltage so you did it right. Don't try to connect a negative voltage to that pin. It will release some "doggy" smell, according to someone that did it.

This means completely powered up, Correct?

Yeah, it's powered up.

i have tried so many things i need some outside help.

We kind of have a "rule" here. You need to post your exact code and a hi-res picture of all your connections, in order to get help.

Your right about the code and pics.
I'm not at the comp the code is on, ill post it as soon as I am.
Same with the pic..
Sry

even though i dont have a negative voltage there

You don't need a negative voltage. The pin is outputing a negative voltage so you did it right. Don't try to connect a negative voltage to that pin. It will release some "doggy" smell, according to someone that did it.

How can you respond to this when you don't know where "there" is?

Pin 3 is the 'contrast' pin and if he is referring to this pin then he most certainly can (and usually must) connect a negative voltage there. You assume he is referring to pin 18 which is the negative supply from which the negative voltage for pin 3 is usually derived. Your statements regarding this pin are correct.

If he has connected his potentiometer between VDD and VEE as recommended then he very well could (and probably does) have a negative voltage at pin 3 without realizing it. That pretty much exhausts my knowledge of Graphical LCDs.

Don

The pin 18 in some documents are referred to as negative voltage. In the datasheet there is a cartoon showing one model requires a 10V battery to get negative vlotage compared with the common ground. But I guess his one has that pin 18.

His model has a "Building" negative voltage.

Well I wouldn't use the term 'building' even though that's what it says on the diagram. This is the result of several iterations of translation - probably Japanese --> Chinese --> English or maybe even Japanese --> English --> Chinese --> English.

I wouldn't use the term 'cartoon' either since the diagrams aren't humorous or political and they won't be used to create a fresco. In any case either connection will result in a negative voltage at pin 3 for much of the potentiometer rotation.

Don

ok so here is the code that i am using:

#include <ks0108_arduino.h> // header with specific pinouts 
 #include <ks0108.h>  // library header
  #include <Arial14.h>  // font definition for 14 point Arial font.
  #include "SystemFont5x7.h"   // system font
  #include "ArduinoIcon.h"     // bitmap  
  unsigned long startMillis;
  unsigned int iter = 0;
void setup(){
  GLCD.Init(NON_INVERTED);   // initialise the library
  GLCD.ClearScreen();  
  GLCD.DrawBitmap(ArduinoIcon, 32,0, BLACK); //draw the bitmap at the given x,y position
  delay(3000);
  GLCD.ClearScreen();
  GLCD.SelectFont(System5x7);       // select fixed width system font 
}
void loop(){ // run over and over again
  startMillis = millis();
  while( millis() - startMillis < 1000){ // loop for one second
    GLCD.DrawRect(0, 0, 64, 61, BLACK); // rectangle in left side of screen
    GLCD.DrawRoundRect(68, 0, 58, 61, 5, BLACK);  // rounded rectangle around text area   
    for(int i=0; i < 62; i += 4)
      GLCD.DrawLine(1,1,63,i, BLACK);  // draw lines from upper left down right side of rectangle  
    GLCD.DrawCircle(32,31,30,BLACK);   // draw circle centered in the left side of screen  
    GLCD.FillRect(92,40,16,16, WHITE); // clear previous spinner position  
    GLCD.CursorTo(5,5);               // locate curser for printing text
    GLCD.PrintNumber(++iter);         // print current iteration at the current cursor position 
  } 
  // display number of iterations in one second
  GLCD.ClearScreen();               // clear the screen  
  GLCD.CursorTo(13,2);              // positon cursor  
  GLCD.Puts("FPS= ");               // print a text string  
  GLCD.PrintNumber(iter);           // print a number 
 }

Yes my contrast is taken off of 18 and put through a POT that then goes to pin three.

Here is the header file that calls out the pins: ks0108_arduino.h

/*
  ks0108_Arduino.h - Arduino library support for ks0108 and compatable graphic LCDs
  Copyright (c)2008 Michael Margolis All right reserved

  This is the configuration file for mapping Arduino (ATmega168) pins to the ks0108 Graphics LCD library

*/

#ifndef      KS0108_CONFIG_H
#define KS0108_CONFIG_H

/*********************************************************/
/*  Configuration for assigning LCD bits to Arduino Pins */
/*********************************************************/
/* Arduino pins used for Commands
 * default assignment uses the first five analog pins
 */

#define CSEL1                        14            // CS1 Bit   // swap pin assignments with CSEL2 if left/right image is reversed
#define CSEL2                        15            // CS2 Bit

#define R_W                              16            // R/W Bit
#define D_I                              17            // D/I Bit 
#define EN                              18            // EN Bit
#define RES                         19            // Reset Bit  // uncomment this to contol LCD reset on this pin

/* option: uncomment the next line if all command pins are on the same port for slight speed & code size improvement */
#define LCD_CMD_PORT            PORTC            // Command Output Register for pins 14-19

/* Arduino pins used for LCD Data 
 * un-comment ONE of the following pin options that corresponds to the wiring of data bits 0-3 
 */
#define dataPins8to11   // bits 0-3 assigned to arduino pins 8-11, bits 4-7 assigned to arduino pins 4-7
//define dataPins14to17 //bits 0-3 assigned to arduino pins 14-17, bits 4-7 assigned to arduino pins 4-7. (note command pins must be changed)
///define dataPins0to3  // bits 0-3 assigned to arduino pins 0-3 , bits 4-7 assigned to arduino pins 4-7, this is marginally  the fastest option but  its only available on runtime board without hardware rs232.

/* NOTE: all above options assume LCD data bits 4-7 are connected to arduino pins 4-7 */

/*******************************************************/
/*     end of Arduino configuration                    */
/*******************************************************/

#ifndef dataPins0to3                     // this is the only option on standard arduino where all data bits are on same port 
#define LCD_DATA_NIBBLES                // if this is defined then data i/o is split into two operations
#endif 

// these macros  map pins to ports using the defines above
// the following should not be changed unless you really know what your doing 
#ifdef dataPins0to3
#define LCD_DATA_LOW_NBL   D   // port for low nibble: D=pins 0-3  
#endif
#ifdef dataPins14to17 
#define LCD_DATA_LOW_NBL   C   // port for low nibble: C=pins 14-17 (using this requires reasignment of command pins) 
#endif
#ifdef dataPins8to11            // the following is the defualt setting
#define LCD_DATA_LOW_NBL   B   // port for low nibble, B=pins 8-11
#endif

#define LCD_DATA_HIGH_NBL  D   // port for high nibble: D=pins 4-7, B & C not available on std arduino  

// macros to fast write data to pins known at compile time, this is over 30 times faster than digitalWrite
#define fastWriteHigh(_pin_) ( _pin_ < 8 ?  PORTD |= 1 << (_pin_ & 0x07) : ( _pin_ < 14 ?  PORTB |= 1 << ((_pin_ -8) & 0x07) : PORTC |= 1 << ((_pin_ -14) & 0x07)  ) ) 
#define fastWriteLow(_pin_) ( _pin_ < 8 ?   PORTD &= ~(1 << (_pin_  & 0x07)) : ( _pin_ < 14 ?  PORTB &= ~(1 << ((_pin_ -8) & 0x07) )  :  PORTC &= ~(1 << ((_pin_ -14) & 0x07) )  ) )


#endif

pics are coming later today.

Everything looks the same as the example code except for the first include.
I still need to see the ks0108.h. If you swear you didn't change anything in that header file, I'll be almost certain the connections are incorrect.
So a picture will help (I hope the connections are not made by all white or all red wires).

Before you try to troubleshoot your connections, have you tried this?
use delay(30000) in the setup. Reset your arduino, then turn the pot up and down to see if anything is already showing on the screen. If the pot is not giving the right voltage, you will not see anything but all black dots. It's the same thing as setting your computer monitor at a bad contrast setting.

ks0108.h header file

/*
  ks0108.h - Arduino library support for ks0108 and compatable graphic LCDs
  Copyright (c)2008 Michael Margolis All right reserved
  mailto:memargolis@hotmail.com?subject=KS0108_Library 

  The high level functions of this library are based on version 1.1 of ks0108 graphics routines
  written and copyright by Fabian Maximilian Thiele. His sitelink is dead but
  you can obtain a copy of his original work here:
  http://www.scienceprog.com/wp-content/uploads/2007/07/glcd_ks0108.zip

  Code changes include conversion to an Arduino C++ library, rewriting the low level routines 
  to read busy status flag and support a wider range of displays, adding more flexibility
  in port addressing and improvements in I/O speed. The interface has been made more Arduino friendly
  and some convenience functions added. 

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

  Version:   1.0  - May  8 2008  - initial release
  Version:   1.0a - Sep  1 2008  - simplified command pin defines  
  Version:   1.0b - Sep 18 2008  - replaced <wiring.h> with boolean typedef for rel 0012  
  Version:   1.1  - Nov  7 2008  - restructured low level code to adapt to panel speed
                                 - moved chip and panel configuration into seperate header files    
                                               - added fixed width system font
  Version:   2   - May 26 2009   - second release
                                 - added support for Mega and Sanguino, improved panel speed tolerance, added bitmap support
     
*/

#include <inttypes.h>
typedef uint8_t boolean;
typedef uint8_t byte;
#include <avr/pgmspace.h>

#ifndef      KS0108_H
#define KS0108_H

#define GLCD_VERSION 2 // software version of this library

// Chip specific includes
#if defined(__AVR_ATmega1280__)
#include "ks0108_Mega.h"  // include this for the Arduino Mega other ATmega1280 boards
#elif defined (__AVR_ATmega644__)  // TODO - check this define 
#include "ks0108_Sanguino.h"   // include this for Sanguino or ATmega644 boards
#else
#include "ks0108_Arduino.h"  // include this for the Arduino or other ATmega168 boards
#endif

yeah that is one reason i havent got a pic up, my buddy did all the same color. {Green}, the wires are labeled but i dont think thats going to show up in the pic.

I can tell you which pin goes to what though:
the numbers on the left are the position of the connections on the LCD.
the stuff following is the connections on the arduino

1 is wired to Vcc
2 is ground
3 is on the wiper of the POT
4 is DO connected to pin 8 on arduino
5 is D1 connected to pin 9
6 is D2 connected to pin 10
7 is D3 connected to pin 11
8 is D4 connected to pin 4
9 is D5 connected to pin 5
10 is D6 connected to pin 6
11 is D7 connected to pin 7
12 is CS1 connected to pin 14
13 is CS2 connected to pin 15
14 is reset connected to pin 19
15 is R/W connected to pin 16
16 is D/I connected to pin 17
17 is EN connected to pin 18
18 is connected to the POT
19 is at 5 volts for backlight with a 330 resistor
20 is ground for backlight.

hope this isnt too confusing.
thanks