Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Dave

Pages: [1]
1
Character LCDs / Need help please with NHD-0420D3Z-fl-GBW-V3
« on: March 02, 2015, 09:29:51 AM »
Has anyone used this display in the SPI mode with a Pic processor(pic18f2620)? If so any code to share?

Iíve tried using the SPI peripheral and straight bit bang, still canít get the display to work other than in test mode.
I have R2 shorted with a zero ohm 0603 resistor,I have set the CKP to 1 and the CKE to 1, the clock is set to 62.5kHz. I also tried different modes (grasping at straws now). Looking at the signals with a scope and all seems well, seeing as there are now timing diagrams to check against.
As I understand it when the display powers up, it powers up in the on mode, therefore all I should have to do is send 0x13(code for the #1), and the display should display a ď1Ē, I got nothing, I even tried turning on the display, setting the curser to home first.

SPI INITALIZATION CODE
void initialize_spi()
{
   
    LATBbits.LATB4 = 1;/*disable lcd*/
     SSPCON1 = 0;
    SSPCON1bits.SSPEN = 0;/*Synchronous Serial Port Enable bit  DISABLED*/
    SSPCON1bits.SSPM = 2;/*SPI Master mode, clock = FOSC/64*/
    SSPCON1bits.CKP = 1;/*Clock Polarity Select bit*/
    SSPSTATbits.CKE = 1;/*SPI Clock Edge Select bit (SPI mode only)*/

    }

LCD TEST FUNCTION
void test()
{
   
    LATBbits.LATB4 = 0;/*Set LCD select low*/
    Delay10TCYx(20);
   
    PIR1bits.SSPIF = 0;/*clear Synchronous Serial Port Interrupt Flag bit*/
    SSPBUF = 0x13;
    while(!PIR1bits.SSPIF);/*The transmission/reception is complete (must be cleared in software)*/
    Delay10TCYx(20);
   LATBbits.LATB4 = 1;/*Set LCD select high*/

  }
//******************************************************
Second test function bit bang
void lcd_test(unsigned char DATA)
{
    unsigned int n,x;
    unsigned char data;
    data = DATA;
    LCD_SEL = 0;/*Set LCD select low*/
     for(n = 0; n<8;n++)
     {
         if((data & 0x80) == 0x80) SDO = 1; /*LATCbits.LATC5 = 1;*/
         else SDO = 0; /*LATCbits.LATC5 = 0;*/
         data = data << 1;
         SCK = 0;
         Delay10TCYx(1);
         SCK = 1;
      }
     SCK = 1;/*set clock high*/
     LCD_SEL = 1;/*Set LCD select high*/
}
I can see no reason why this isnít working, other than the SPI front end on the display is Tango Uniform.

Pages: [1]