SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By dext3r
#10611
I'd like to use that cellphone color LCD in an upcoming project, but coming up with "firmware" to control the LCD seems like a daunting task to undertake by myself. (store onboard bitmaps, fonts..etc)

Would anyone be interested in collaborating on making this 'backpack' device? (I am pretty familiar with PICs;consequently, thats the only dev hardware I have right now, although I am interested in playing with some Atmel stuff...)

I think something like this would really benefit the community and simplify
implementation of the LCD, allowing more people to just grab it and run with it.

looking forward to hearing your thoughts...
bryan
User avatar
By roach
#10618
dext3r wrote:I'd like to use that cellphone color LCD in an upcoming project, but coming up with "firmware" to control the LCD seems like a daunting task to undertake by myself. (store onboard bitmaps, fonts..etc)
Take a look at Jesper's Yampp-7 (http://www.myplace.nu/mp3/). Somewhere in that badly organized mess of a site is a SWEET MP3 player that uses this exact LCD. Get the "yampp7_usb_color" firmware, and check out the source code.
By dext3r
#10625
Wow, awesome! Thanks for the headsup...real good info.

Now to make it more for general use.
By amcfall
#10678
roach wrote:
dext3r wrote:I'd like to use that cellphone color LCD in an upcoming project, but coming up with "firmware" to control the LCD seems like a daunting task to undertake by myself. (store onboard bitmaps, fonts..etc)
Take a look at Jesper's Yampp-7 (http://www.myplace.nu/mp3/). Somewhere in that badly organized mess of a site is a SWEET MP3 player that uses this exact LCD. Get the "yampp7_usb_color" firmware, and check out the source code.
As far as I can tell, there app needs a Phillips controller based LCD, not Epson. Did I miss something? That site needs some serious organization :-)

My LCD and boards should be here next week so I can start playin.g

Avery

Edit:

Nevermind, actually started digging through the docs and it looks like the firmware will work with the Epson, just their board won't. Thanks, that should be a great read!
User avatar
By roach
#10685
amcfall wrote: it looks like the firmware will work with the Epson, just their board won't. Thanks, that should be a great read!
Yeah, by default, the firmware is designed for the Phillips display, but can be switched to support the Epson with a couple of changes to some stuff (mostly in Constants.h, IIRC).
By dext3r
#10775
woo board and LCD came today....really tempted to just display a box or something, heh :)
User avatar
By wittend
#11042
I'm obviously more than a bit thick, but after reading everything I can find about controlling this display, I have yet to find an example that helps me.

Everything I read indicates that the interface presented is some variant of the familiar Motorola/Freescale Serial Peripheral Interface (SPI). It does not seem far fetched to assume that in this case the LCD operates in slave mode relative to a microprocessor or other SPI signal source, so in unless someone corrects me, I make that assumption. I have not seen it so stated.

In my limited experience, SPI is always presented interms of four signals, with the names Master In Slave Out (MISO), Master Out Slave In (MOSI), Clock (SCLK), and Chip Select (SSN - don't ask me why). The information provided for the SparkFun Nokia LCD Breakout board seems (most) concerned with: /Reset, SDATA, SCLK, and /CS. It is not unusual or suprising to have different naming conventions between different manufacturers. But I have not been able to determine which, if any, of these signals correspond to the standard. The more I look at example schematics, the more unsure I become, and even a seemingly obvious relationship like /CS -> SSN begins to worry me.

In addition, SPI Specification details four modes of operation. According to one source:

Mode 0 operation is characterized by the clock (SCLK) starting at a low level. The data is sampled on the leading edge of the clock.

Mode 1 operation is characterized by the clock (SCLK) starting at a low level. The data is sampled on the falling edge of the clock.

Mode 2 operation is characterized by the clock (SCLK) starting at a high level. The data is sampled on the falling edge of the clock.

Mode 3 operation is characterized by the clock (SCLK) starting at a high level. The data is sampled on the rising edge of the clock and changes on the falling edge.

I have two signal sources I wish to test. One is an I2C/SPI tester which allows me to control all of these parameters. The other (more important one) is a cell phone module which provides much more limited flexibility in their assignment.

I can eventually sort this out by trial and error, but it is tedious and frustrating, and I am sure that others have wanted the same information. Can anyone point me to a place where this is explained clearly? In short, what I want to know is what is the relationship of the pins on the breakout board to the standard SPI pins, and which of the four modes am I dealing with?
By amcfall
#11153
wittend wrote:I'm obviously more than a bit thick, but after reading everything I can find about controlling this display, I have yet to find an example that helps me.

Everything I read indicates that the interface presented is some variant of the familiar Motorola/Freescale Serial Peripheral Interface (SPI). It does not seem far fetched to assume that in this case the LCD operates in slave mode relative to a microprocessor or other SPI signal source, so in unless someone corrects me, I make that assumption. I have not seen it so stated.

In my limited experience, SPI is always presented interms of four signals, with the names Master In Slave Out (MISO), Master Out Slave In (MOSI), Clock (SCLK), and Chip Select (SSN - don't ask me why). The information provided for the SparkFun Nokia LCD Breakout board seems (most) concerned with: /Reset, SDATA, SCLK, and /CS. It is not unusual or suprising to have different naming conventions between different manufacturers. But I have not been able to determine which, if any, of these signals correspond to the standard. The more I look at example schematics, the more unsure I become, and even a seemingly obvious relationship like /CS -> SSN begins to worry me.

In addition, SPI Specification details four modes of operation. According to one source:

Mode 0 operation is characterized by the clock (SCLK) starting at a low level. The data is sampled on the leading edge of the clock.

Mode 1 operation is characterized by the clock (SCLK) starting at a low level. The data is sampled on the falling edge of the clock.

Mode 2 operation is characterized by the clock (SCLK) starting at a high level. The data is sampled on the falling edge of the clock.

Mode 3 operation is characterized by the clock (SCLK) starting at a high level. The data is sampled on the rising edge of the clock and changes on the falling edge.

I have two signal sources I wish to test. One is an I2C/SPI tester which allows me to control all of these parameters. The other (more important one) is a cell phone module which provides much more limited flexibility in their assignment.

I can eventually sort this out by trial and error, but it is tedious and frustrating, and I am sure that others have wanted the same information. Can anyone point me to a place where this is explained clearly? In short, what I want to know is what is the relationship of the pins on the breakout board to the standard SPI pins, and which of the four modes am I dealing with?
I have one I'm playing with, just started coding. So all of my info is sketchy :-)

I don't think the LCD is truly SPI, just similar (in the description it's just called a "relatively simple serial interface"). The 8 bit mode looks more SPI like, with all four signals. The 9 bit mode uses only 3. Look in the Epson data sheet under 8.1.3, 8 and 9 bit serial interface. It's 9 bit, looks like it's max speed is 20Khz (50ns min cycle time). Should be pretty easy to bit bang.

Avery
User avatar
By roach
#11156
There is some good sample code that uses this exact LCD (even ordered from SpakFrun!) here
User avatar
By wittend
#11158
roach wrote:There is some good sample code that uses this exact LCD (even ordered from SpakFrun!) here
Thank you for the reply.

Unfortunately I have already studied it closely, and it makes things, if possibe, much *less* clear. The example may be useful if one is using this device with an AVR controller, I'm not sure. But it doesn't answer *any* of my questions.

thanks, though.

dave
User avatar
By roach
#11159
wittend wrote:Thank you for the reply.

Unfortunately I have already studied it closely, and it makes things, if possibe, much *less* clear. The example may be useful if one is using this device with an AVR controller, I'm not sure. But it doesn't answer *any* of my questions.

thanks, though.

dave
d'OH! Didn't see that you weren't using an AVR.

double d'OH! Didn't see that someone posted this EXACT LINK previously in the thread.

Sorry for the stoopidity :)
By amcfall
#11252
Here's a basic routine wriutten in CCS PICC.
Code: Select all

//basic routines to drive an ERpson S1D15G00 series based LCD, like the ones from sparkfun.com
// Epson S1D15G10 Command Set and init sequence stolen from sparkfun.com example source code
#include <18F4620.h>
#device adc=8
#FUSES NOWDT                 	//No Watch Dog Timer
#FUSES INTRC_IO              	//Internal RC Osc, no CLKOUT
#FUSES NOPROTECT             	//Code not protected from reading
#FUSES NOIESO                	//Internal External Switch Over mode disabled
#FUSES BORV21                	//Brownout reset at 2.1V
#FUSES NOBROWNOUT            	//No brownout reset
#FUSES NOPUT                 	//No Power Up Timer
#FUSES NOCPD                 	//No EE protection
#FUSES STVREN                	//Stack full/underflow will cause reset
//#FUSES DEBUG
#FUSES NODEBUG               	//No Debug mode for ICD
#FUSES NOLVP                 	//No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT                 	//Program memory not write protected
#FUSES NOWRTD                	//Data EEPROM not write protected
#FUSES NOEBTR                	//Memory not protected from table reads
#FUSES NOCPB                 	//No Boot Block code protection
#FUSES NOEBTRB               	//Boot block not protected from table reads
#FUSES NOWRTC                	//configuration not registers write protected
#FUSES NOWRTB                	//Boot block not write protected
#FUSES NOFCMEN               	//Fail-safe clock monitor disabled
#FUSES NOXINST               	//Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES NOPBADEN              	//PORTB pins are configured as digital I/O on RESET
#FUSES LPT1OSC               	//Timer1 configured for low-power operation
//#FUSES MCLR
#FUSES NOMCLR                	//Master Clear pin used for I/O


#use delay(clock=8000000)
#define EEPROM_SDA   PIN_D6
#define EEPROM_SCL   PIN_D7
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,errors)
//#include <24512mod.c>


#DEFINE PICTX PIN_C6
#DEFINE PICRX PIN_C7
#DEFINE	_LCDPWR PIN_D1

#DEFINE CS PIN_A5
#DEFINE LCDCLOCK PIN_C3
#DEFINE LCDDATA PIN_C5
#DEFINE _RESET PIN_C4


void write_lcd(int1, unsigned int);
void init_lcd(void);
void LCD_pixel_write(unsigned int8, unsigned int8, unsigned int8);//8 bit color 

void main()
{
	int8 eepromdata=123;
	long int eepromaddress=0;
	setup_wdt(WDT_OFF);
	setup_adc_ports(NO_ANALOGS|VSS_VDD);
	setup_adc(ADC_OFF|ADC_TAD_MUL_0);
	setup_psp(PSP_DISABLED);
	setup_spi(FALSE);
	setup_wdt(WDT_OFF);
	setup_timer_0(RTCC_INTERNAL);
	setup_timer_1(T1_DISABLED);
	setup_timer_2(T2_DISABLED,0,1);
	setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
	setup_comparator(NC_NC_NC_NC);
	setup_vref(FALSE);
	setup_low_volt_detect(FALSE);
/*
	for (eepromaddress=0; eepromaddress<512; eepromaddress++)
		{
		init_ext_eeprom();
		delay_ms(10);
		eepromdata=123;
		write_ext_eeprom(eepromaddress, eepromdata);
		delay_ms(100);
		printf ("done writing\n\r");
		eepromdata=read_ext_eeprom(eepromaddress);
		printf ("EEprom memory address %Ld wrote 123 read %u\n\r", eepromaddress, eepromdata);
		delay_ms(10);
		}
*/

	while(1)
		{
		init_lcd();
		delay_ms(1000);
		}
}
	


void write_lcd(int1 LCDmode, unsigned int data)//mode ==0 send a command, mode==1 sends data
	{
	if (!LCDmode)
		output_low(LCDDATA);//when entering commands: SI=LOW at rising edge of 1st SCL
	else 
		output_high(LCDDATA);//send data
	output_low(LCDCLOCK);
	output_high(LCDCLOCK);
	//send data, 8th bit first
	if (data & 128)
		output_high(LCDDATA);
	else
		output_low(LCDDATA);
	output_low(LCDCLOCK);
	output_high(LCDCLOCK);
	//7th bit
	if (data & 64)
		output_high(LCDDATA);
	else
		output_low(LCDDATA);
	output_low(LCDCLOCK);
	output_high(LCDCLOCK);
	//6th bit
	if (data & 32)
		output_high(LCDDATA);
	else
		output_low(LCDDATA);
	output_low(LCDCLOCK);
	output_high(LCDCLOCK);
	//5th bit
	if (data & 16)
		output_high(LCDDATA);
	else
		output_low(LCDDATA);
	output_low(LCDCLOCK);
	output_high(LCDCLOCK);
	//4th bit
	if (data & 8)
		output_high(LCDDATA);
	else
		output_low(LCDDATA);
	output_low(LCDCLOCK);
	output_high(LCDCLOCK);
	//3rd bit
	if (data & 4)
		output_high(LCDDATA);
	else
		output_low(LCDDATA);
	output_low(LCDCLOCK);
	output_high(LCDCLOCK);
	//2nd bit
	if (data & 2)
		output_high(LCDDATA);
	else
		output_low(LCDDATA);
	output_low(LCDCLOCK);
	output_high(LCDCLOCK);
	//1st bit
		if (data & 1)
		output_high(LCDDATA);
	else
		output_low(LCDDATA);
	output_low(LCDCLOCK);
	output_high(LCDCLOCK);
	output_high(CS);
	output_low(CS);	

	}



// Epson S1D15G10 Command Set
#define DISON       0xaf   
#define DISOFF      0xae   
#define DISNOR      0xa6  
#define DISINV      0xa7  
#define COMSCN      0xbb   
#define DISCTL      0xca   
#define SLPIN       0x95   
#define SLPOUT      0x94   
#define PASET       0x75   
#define CASET       0x15   
#define DATCTL      0xbc   
#define RGBSET8     0xce   
#define RAMWR       0x5c   
#define RAMRD       0x5d   
#define PTLIN       0xa8   
#define PTLOUT      0xa9   
#define RMWIN       0xe0   
#define RMWOUT      0xee   
#define ASCSET      0xaa   
#define SCSTART     0xab   
#define OSCON       0xd1   
#define OSCOFF      0xd2   
#define PWRCTR      0x20   
#define VOLCTR      0x81   
#define VOLUP       0xd6   
#define VOLDOWN     0xd7   
#define TMPGRD      0x82   
#define EPCTIN      0xcd   
#define EPCOUT      0xcc   
#define EPMWR       0xfc   
#define EPMRD       0xfd   
#define EPSRRD1     0x7c   
#define EPSRRD2     0x7d   
#define NOP         0x25 


void init_lcd(void)
	{//mode ==0 send a command, mode==1 sends data
	unsigned int16 i;
	output_low(_LCDPWR);//apply power to LCD
	delay_ms(250);
	output_low(CS);
	output_low(LCDDATA);
	output_high(LCDCLOCK);
	output_high(_reset);
	output_low(_reset);
	output_high(_reset);
	output_high(LCDCLOCK);
	output_high(LCDDATA);
	output_high(LCDCLOCK);
	delay_ms(10);
	write_lcd(0, DISCTL);//display control
	write_LCD(1, 0x03);
	write_LCD(1, 0x1A);
	write_LCD(1, 0x0C);
	write_LCD(1, 0x00);
	
	write_lcd(0, COMSCN);//common scan direction
	write_LCD(1, 0x01);

	write_lcd(0, OSCON);//oscillator on
	write_lcd(0, SLPOUT);//sleep out
	write_lcd(0, VOLCTR);//electronic volume control
	write_LCD(1, 0x05);//cares about lower 6 bits	V1 volume
	write_LCD(1, 0x01);//cares about lower 3 bits	1+Rb/Ra, supposed to specify "resistance ratio of internal resistor"

	write_lcd(0, PWRCTR);//power control
	write_LCD(1, 0x0f);//turn stuff on
	write_LCD(1, 0x64);

	write_lcd(0, DISINV);//inverse display

	write_lcd(0, DATCTL);//Data control
	write_LCD(1, 0x00);
	write_LCD(1, 0x00);
	write_LCD(1, 0x01);
	write_LCD(1, 0x00);

	write_lcd(0, RGBSET8);//setup color lookup table
	//red
	write_LCD(1, 0);
	write_LCD(1, 2);
	write_LCD(1, 4);
	write_LCD(1, 6);
	write_LCD(1, 8);
	write_LCD(1, 10);
	write_LCD(1, 12);
	write_LCD(1, 15);
	//green
	write_LCD(1, 0);
	write_LCD(1, 2);
	write_LCD(1, 4);
	write_LCD(1, 6);
	write_LCD(1, 8);
	write_LCD(1, 10);
	write_LCD(1, 12);
	write_LCD(1, 15);
	//blue
	write_LCD(1, 0);
	write_LCD(1, 4);
	write_LCD(1, 9);
	write_LCD(1, 15);

	write_lcd(0, NOP);//no op

	write_lcd(0, PASET);//page start/end ram
	write_LCD(1, 2);//for some reason it starts at 2
	write_LCD(1, 131);

	write_lcd(0, CASET);//column start/end ram	
	write_LCD(1, 0);
	write_LCD(1, 131);

	write_lcd(0, RAMWR);//write a background
	for (i=0; i< 18000; i++)
		{
		write_LCD(1, 28);		//green
		}

	write_lcd(0, DISON);//display on
	delay_ms(200);
	for (i=0; i<160; i++)
		{
		write_lcd(0, VOLUP);//changes contrast, find correct setting by trial and error
		delay_ms(20);
		}

	//draw a square in the middle of the screen
	for (i=0; i<4096; i++)
		{
		lcd_pixel_write((i%64) + 32, (i/64)+32, i);
		}
	
	
	}



void LCD_pixel_write(unsigned int8 x, unsigned int8 y, unsigned int8 color)//8 bit color 
	{
	x=x+2;
	write_lcd(0, 0x75);//page start/end ram
	write_lcd(1, x);
	write_lcd(1, 132);
	write_lcd(0, 0x15);//column start/end ram
	write_lcd(1, y);
	write_lcd(1, 131);
	write_lcd(0, 0x5C);//color
	write_lcd(1, color);
	}




User avatar
By wittend
#11254
amcfall wrote:Here's a basic routine wriutten in CCS PICC.
Code: Select all
...
Thanks, It looks as if I will need a secondary processor to sort out driving these things. If I had time, it would be nice to test PIC, AVR, ARM, and 8051. I am not so expert with any of these that I can instantly intuit what is really going on from the source. A PIC may be a good place to start.

Contrary to my earlier statements, the LCD controller presents a custom serial interface which, given some extra pins and a bit of gymnastics, can *sometimes* be kludged and shoehorned to an existing SPI interface. Just not in the case of the devices I wish to connect it to.

I guess that I let myself be led astray by the fact that the example code given for ARM on the SparkFun page *does* seem to use the existing SPI facilities, and the Atmel example includes two pins which may just happen to have alternate functions as standard SPI pins. Probably I have been a bit deluded by the fact that I have a 'high level' (oxymoron, I know) SPI interface available that I wish to test as well.
By amcfall
#11261
wittend wrote:
amcfall wrote:Here's a basic routine wriutten in CCS PICC.
Code: Select all
...
Thanks, It looks as if I will need a secondary processor to sort out driving these things. If I had time, it would be nice to test PIC, AVR, ARM, and 8051. I am not so expert with any of these that I can instantly intuit what is really going on from the source. A PIC may be a good place to start.

Contrary to my earlier statements, the LCD controller presents a custom serial interface which, given some extra pins and a bit of gymnastics, can *sometimes* be kludged and shoehorned to an existing SPI interface. Just not in the case of the devices I wish to connect it to.

I guess that I let myself be led astray by the fact that the example code given for ARM on the SparkFun page *does* seem to use the existing SPI facilities, and the Atmel example includes two pins which may just happen to have alternate functions as standard SPI pins. Probably I have been a bit deluded by the fact that I have a 'high level' (oxymoron, I know) SPI interface available that I wish to test as well.
Yeah, I was a bit confused by the Sparkfun code also. Fortunately bitbanging the interface is pretty easy. Now I need to figure out how to display an image. Off to research bitmaps, converters and fun stuff like that.

Avery