Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC16F916 with ST7565R

Status
Not open for further replies.

scarab84

New Member
Hello everyone!
I'm new to this site, and hopefully my questions won't be too dumb. First, I apologize that this post is so long...
I'm trying to control LCD screen from Newhaven Display (part# NHD-C12864WC-FSW-FBW-3V3-M; https://www.newhavendisplay.com/nhdc12864wcfswfbw3v3m-p-4049.html) with PIC16F916 (https://www.electro-tech-online.com/custompdfs/2012/08/41250F.pdf). That LCD has built-in ST7565R (https://www.electro-tech-online.com/custompdfs/2012/08/ST7565R.pdf) controller. I've never used PIC nor LCD like that, so there's definitely something I'm doing wrong.
1. Those are my connections:
---PIC--- ---LCD---
RA0 (pin2) - DB0 (pin6)
RA1 (pin3) - DB1 (pin7) and so on, I want to use parallel interface.
Vss (GND)
RC0 (pin11) - A0 (pin3)
RC1 (pin12) - RW-WR (pin4)
RC2 (pin13) - CS1B (pin1)
RC3 (pin14) - E-RD (pin5)
RC4 (pin15) - /RES (pin2)
Vss (GND)
Vdd (+3.0V)
I'm using internal oscillator. I think everything works fine since I checked each port and made LED blink. C86 (pin29) and PS (pin30) are connected to Vdd for logic HIGH. I want to use 6800 interface which I think means that: CS1B (enables device), E (pin5) will enable operation, and RW-WR (pin4) will specify read or write. Is this correct?
I have connected rest of the pins on LCD as it is specified in the specs sheet (page 4 from Newhaven). I'm using 1uF capacitors. I just don't understand why on page5 cap3 have different polarity. Anyway, ST7565R datasheet also explains how to connect it on page32 and it matches that table on page4 from Newhaven. To sum it up:
Do I understand 6800 interface correct, and is it better to use it than 8080?
Do I understand capacitors polarity, is it a mistake on page5 from Newhaven?
What's the difference if I connect V0-V4 to Vdd or Vss?
On ST7565R datasheet chip select has two pins (CS1B and CS2 - page20). That LCD has only CS1B, does it mean CS2 is internally connected to HIGH logic?

2. I've used that initialization program that they have on page10 from Newhaven. What I understand (it's a pseudo-code?):
P3.7 is RW (my pin4); P3.0 is A0 (my pin3); P3.1 is RESET (my pin2); P3.4 is E (pin5); P3.3 probably C86 (pin29);
SET means set the bit (bsf command), and RESET means clears the bit (bcf command). Questions:
Is this code for 6800 or 8080 interface, does it matter?
Does RESET means clear, shouldn't that be clear and set (re-set)?
After that initialization code, I send 0xff to portA with Writedata subroutine, but nothing happens on the screen? Am I missing something? I thought it would display at least one dot.

3. I promise it's the last one. The dumbest question is here:
How to connect that FFC connector? I've also ordered that board: https://www.newhavendisplay.com/nhdffc30-p-2477.html
I think those gold leads should go to the bottom of that port. That means if you look at the front of the LCD screen (and the cable is not twisted), you see the board from the back (no labels). I've tried both ways - nothing worked.

It's been almost a week, and I still don't get anything on the screen. I've ordered three LCDs, and played with two. I don't know if I burned one or not by connecting it wrong, but I think if you put that FFC wrong side, it's not gonna connect anyway. I don't wanna touch third display yet. I'm using 5V power supply and converted it to 3V with LM317 voltage regulator. The only thing that works is backlight LOL
Is there anyway to check that screen without micro-controller and initialization? When you apply power should something appear on the display? I'm not 100% sure if I connect power supply correctly to the LCD.
If anyone can help me with that, it would be great. THX!!!

P.S. I don't have my code with me now. I can post it on Monday. I'm just using MPASM assembler.
 
Hi,

You sure have plenty of problems there, and if you have connected things the wrong way around its hard to say if the Pic or lcds are intact.

The EADOG lcds are very similar and have the advantage of using 0.1" standard ic pin type connectors and use the simpler SPI interface.
https://www.mouser.com/Search/Refine.aspx?Keyword=eadog

Below is the link to my assembler thread which should work on a 16F with a little modification, though easiser just to buy a 18F chip, to prove things work ok.
https://www.electro-tech-online.com/threads/glcds-with-pic-18f-assembler.40676/

The chip used for the voltage level conversion should 74hc4050 instead of the one shown, though if you are running both devices on 3v then it is not needed.


Do not know of any way to test the lcds other than by a micro based unit.

Hope that helps a bit..
 
The specs state that Vo requires Vdd -- 10.3v for contrast..... You need a negative voltage, Have you installed the caps as per the schematic..... You may need to specify the "Electronic Volume" so you can see anything.... I have a serial version of this device.. I have to include a setting 0f 0x7F ( mid way ) in the initialization routine...

Of course!! without seeing we can only suggest ideas..
 
Thank you for your replies.
Richard - that assembler thread will be definitely helpful.
Ian - I get positive 2V at V0, so there's something wrong. I'm pretty sure caps are installed correctly.
I'm attaching my code.
 
My code is in C# and is at work... I cant remember the exact settings I used... I wont be in until Thursday at the earliest...

I should imagine at least -8v on Vo...


Found it....
Code:
public void Init()
        {
            //  Volume mode
            SendCommand( VOLUME_FIRST ); // 0x81
 
            // Volume set
            SendCommand( VOLUME_SECOND ); // 0x10
 
            //Booster ratio = 4
            SendCommand( BOOSTER_FIRST ); // 0xF8
 
            //Read/modify/write
            SendCommand( RMW );		// 0x00
 
            //turn Display on
            SendCommand( CMD_DISPLAY_ON ); // 0xAF
 
            //page address = 0
            SendCommand( SET_PAGE );	// 0xB0
 
            //column address high = 0
            SendCommand( COLUMN_UPPER ); // 0x10
 
            //column address low = 0
            SendCommand( COLUMN_LOWER ); //0x00
 
            // LCD bias select Bias 1/9
            SendCommand( BIAS_9 );  // 0xA2
 
            // ADC select  ADC Direction L-R
            SendCommand( ADC_NORMAL );	//0xA0
 
            // SHL select  SHL Direction 0-64
            SendCommand( COM_NORMAL );  // 0xC0
 
            // Initial Display line Initial Display line
            SendCommand( DISP_START_LINE );	// 0x10
 
            // turn on voltage converter (VC=1, VR=0, VF=0)
            SendCommand( (byte) (POWER_CONTROL | 0x4) ); // 0x2C
            // wait for 50% rising
            Thread.Sleep( 50 );
 
            // turn on voltage regulator (VC=1, VR=1, VF=0)
            SendCommand( (byte) (POWER_CONTROL | 0x6) ); // 0x2E
            // wait >=50ms
            Thread.Sleep( 50 );
 
            // turn on voltage follower (VC=1, VR=1, VF=1)
            SendCommand( (byte) (POWER_CONTROL | 0x7) ); // 0x2F
            // wait
            Thread.Sleep( 50 );
 
            // set lcd operating voltage (regulator resistor, ref voltage resistor)
            SendCommand( (byte) (RESISTOR_RATIO | 0x6) ); 0x26
 
            //Normal Display or revers
            SendCommand( ADC_NORMAL ); // 0xA0
 
            SendCommand( COM_REVERSE ); // 0xC8
 
            SetContrast( 30 );   // function  0x81, then 0x1E
	}

This was my initialization code .... I put the constants at the end of each line
 
Last edited:
It works :))) Thank you for all your help.
Had to play with that chip select...
Anyway, I used Freescale micro-controller because I'm more familiar with it. Now I know how the code should look like, so it shouldn't be that hard to make PIC work (will try tomorrow).
Is there command to clear data RAM or you just have to write 0x00 to clear it?
Will programming in C be better or I can do the same thing in assembly language for PIC?
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top