Discussion like this should be kept at the forum unless there's some need for private email.
Quote:
dear sir
The parameters specified by u is set still it(nokia 3310 lcd) doesnt respond i dont know why all the sample prog says the same spec.i am using 20Mhz crystal and using spi interface to connect with the lcd .
Is there timing spec for initialisation and data sending pls do reply to this mail i am stuck half way through.Pls do verify the code and reply me
i am suppling 3v to the lcd as power is there any specific time at which the lcd should be powered up.the lcd shows no response.my controller is 18f8720
i have attached the the code of mine also
veera vikraman.s
vikraman
Code:
#include<18f8720.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP,NOBROWNOUT,PUT
#use delay(clock=20000000)
#use rs232(baud=9600,xmit = PIN_C6, rcv = PIN_C7)
#define LCD_DC_PIN PIN_F3 // Pf3
#define LCD_CE_PIN PIN_D1 // PD1
#define SPI_DO_PIN PIN_C5 // PB3
#define LCD_RST_PIN PIN_D2 // PD2
#define SPI_CLK_PIN PIN_C3 // PC3
#define LCD_PS PIN_D3
#define HIGH 1
#define LOW 0
void main ( void )
{
int data_in,data;
output_low(SPI_DO_PIN);
output_low(SPI_CLK_PIN);
setup_spi(SPI_MASTER | SPI_L_TO_H | SPI_CLK_DIV_16);
output_bit(LCD_DC_PIN,HIGH);
output_bit(LCD_CE_PIN,HIGH);
output_bit(PIN_D3,1);
delay_us(200);
output_bit(LCD_RST_PIN,LOW);
delay_ms(10);
output_bit(LCD_RST_PIN,HIGH);
output_bit(LCD_DC_PIN,LOW);
output_bit(LCD_CE_PIN,LOW);
spi_write( 0x21);
spi_write( 0xC8);
spi_write( 0x13);
spi_write( 0x20);
spi_write( 0x09);
delay_ms(50);
}
You should check the section 8.1 of the PCD8544 datasheet about the powerup and initialization. Basically just after power to the display is applied it should be resetted. (like you do)
I guess sample programs use the same initialization commands as they have been found to be working general settings. Of course they can be adjusted and they are explained in detail in the PCD8544 datasheet. But the settings mentioned here should give picture. I'm not aware of any specific initialization timings (except reset, figure 12.2 in PCD8544 datasheet) as long as your SPI is withing specs.
Have you tried different SPI speeds ? Have you verified SPI is working ok ? Instead of the hardware SPI you could just bit bang the bits using software to emulate SPI.
PCD8544 datasheet mentions the max. SPI speed as 4 MHz.
After initialization my display shows random garbage and it needs to be zeroed to clean the memory.