Go Down

Topic: [solved] DIP204-4 with SPI (Read 3 times) previous topic - next topic

_frank_

Sep 14, 2011, 01:52 am Last Edit: Jan 21, 2012, 10:49 pm by _frank_ Reason: 1
Hi,
i try to get my Display to work with SPI and an arduino Uno.
of course i changed to soldering bridge (13) from 4/8 to SPI

here the Data-Sheet of the display:
http://www.lcd-module.de/eng/pdf/doma/dip204-4e.pdf

and my code:

Code: [Select]

//http://arduino.cc/en/Reference/SPI
// include the SPI library:
#include <SPI.h>

/*
10 (SS)   -> 4 (CS)
11 (MOSI) -> 5 (SID)
12 (MISO) -> 7 (SOD)
13 (SCK)  -> 6 (SCLK)

GND -> 1 (VSS)
5V  -> 2 (VDD)

5V-220-10k-GND
       \_ 3 (VEE)
*/

//int chartable[255];
// set pin 10 as the slave select for the digital pot:
const int slaveSelectPin = 10;

void setup() {
 // set the slaveSelectPin as an output:
 pinMode (slaveSelectPin, OUTPUT);
 
 //data for lcd dip204-4
 //http://www.mikrocontroller.net/articles/AVR_LCD_KS0073/DIP204_mit_Hardware-SPI
 SPI.setBitOrder(LSBFIRST);
 SPI.setDataMode(SPI_MODE3);
 SPI.setClockDivider(SPI_CLOCK_DIV64);
 
 // initialize SPI:
 SPI.begin();
 //lcd-init
 lcd_write(0x34,1);        // 34 0011 0100 (8Bit Bus, RE=1)
 lcd_write(0x09,1);        // 09 0000 1001 (4 Line Mode)
 lcd_write(0x30,1);        // 30 0011 0000 (8Bit Bus, N=0, RE=0, DH=0, REV=0)
}

void loop()
{
 /*
   * Zeile 1: 0x00 (bis 0x13)
   * Zeile 2: 0x20 (bis 0x33)
   * Zeile 3: 0x40 (bis 0x53)
   * Zeile 4: 0x60 (bis 0x73)
 */
 lcd_write(0x00,byte('1'));//1.Zeile,1.Spalte
 lcd_write(0x01,byte('A'));//1.Zeile,2.Spalte
 lcd_write(0x20,byte('2'));//2.Zeile,1.Spalte
 lcd_write(0x21,byte('B'));//2.Zeile,2.Spalte
 lcd_write(0x40,byte('3'));//3.Zeile,1.Spalte
 lcd_write(0x41,byte('C'));//3.Zeile,2.Spalte
 lcd_write(0x60,byte('4'));//4.Zeile,1.Spalte
 lcd_write(0x61,byte('D'));//4.Zeile,2.Spalte
}

int lcd_write(int address, int value) {
 // take the SS pin low to select the chip:
 digitalWrite(slaveSelectPin,LOW);
 //  send in the address and value via SPI:
 SPI.transfer(address);
 SPI.transfer(value);
 // take the SS pin high to de-select the chip:
 digitalWrite(slaveSelectPin,HIGH);
}


my Problem is, that nothing is displayed... i've searched google and this forum, but found no answer how to get this display working with arduino+spi.

the LCD-Library is imho only for 4 and 8bit normal transfer

regards Frank

Nadir

According to datasheet I could not see "Display on" command on your sketch.

_frank_

thanks for your answer, i'll try it out
currently experimenting with 4bit-mode and have to sold the bridge J3 again

olikraus

I just want to mention this lib:
http://code.google.com/p/doglcd/
But I am not sure if this fits to your type of displays. At least it is SPI mode and same company.  :smiley-roll:

Oliver

_frank_

#4
Sep 16, 2011, 03:10 pm Last Edit: Sep 16, 2011, 03:34 pm by _frank_ Reason: 1
nice idea...is DOGLCD working with LSBFIRST or MSBFIRST (i need LSBFirst)? i looked through the code, but its depending not on SPI-LIB.

hoping LiquidCrystal-Lib will support SPI in future (commands are the same)

Go Up