Shop OBEX P1 Docs P2 Docs Learn Events
Nokia 5160 CELL LCD + BS2 — Parallax Forums

Nokia 5160 CELL LCD + BS2

Clock LoopClock Loop Posts: 2,069
edited 2005-10-28 09:20 in BASIC Stamp
I have a cellphone LCD

After doing some searching, I found the controller chip for this small, cheap, LCD.

It uses a PCD8544 chip embedded into the lcd.

www.semiconductors.philips.com/acrobat_download/datasheets/PCD8544_1.pdf

I am not sure how to go about the program to initialize the lcd, and display something basic, like every other pixel on.

I know how to do the electronics part, but don't know where to begin with the software. I have a BS2.

I read over the datasheet, and after just recently learning the 74HC595, I kind of get what its saying. But not really.

Anyone have any ideas, or has anyone done this before?

Heres the pinout of the LCD, with the BS2 connections.

1 .. VDD = +2.7V and < 3.3 V (up to 7.4 mA) Chip power supply
BS2-P0 -- 2 .. SCLK = serial clock line of LCD
BS2-P1 -- 3 .. SI = serial data input of LCD
BS2-P2 -- 4 .. D/C = command/data switch
5 .. /CS = active low chip select (connected to GND)
6 .. Osc = external clock (connected to VDD)
7 .. GND = Ground
8 .. Vout = output of display-internal dc/dc converter
BS2-P3 -- 9 .. /RES = active low reset

All data lines going from the BS2 to the LCD have a 1 kOhm resistor to cut 5v to 3v.

I will use SEROUT command, and I understand SCLK, SI and RES from my knowledge of the 74LS595.
But I have no idea what to do with the D/C pin. If anyone wants to give me a quick rundown of the steps.

First I start by resetting the display, I do this by making P3 low, and then make SCLK go low, high, low, then put P3 high again.
Then I send some kinda data using serout to SI, and D/C?
This is where I get lost. Because on the 595, I can just do a serout to SI and SCLK with any binary combination I require, and the data just shows up on the pinouts of the 595.

... any BS2 program that will display ANYTHING on this setup would help.
It doesn't matter if its a program with no explanations or neat.
I will keep trying to understand the datasheet in the mean time.

Post Edited (BPM) : 11/4/2005 2:14:39 AM GMT

Comments

  • Clock LoopClock Loop Posts: 2,069
    edited 2005-10-26 12:56
    I think I am getting it now.

    The D/C line lets you select what mode your in. To select between writing info to your lcd display RAM, or setting up the lcd display its self.
    Still very similar to a 595... if I ever end up getting it to work, i'll post the code.
  • SN96SN96 Posts: 318
    edited 2005-10-26 13:13
    I hope you get it because I would love to do the same.

    Is the LCD color?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike

    --

    ·
  • Tom WalkerTom Walker Posts: 509
    edited 2005-10-26 13:29
    The link you posted is a good write-up for getting the lcd/controller out of the phone, but to actually "use" it you must refer to the document that the document you referenced references (the PCD8544 controller spec doc). I appears to have everything you need in order to use the controller. From a quick scan, it looks like the controller has some very strict guidelines, including the warning that the controller/display can be permanently damaged just by not being properly initialized.

    To answer your real question, I haven't seen any indication here of anyone having already "rolled" a solution to using this controller with the Stamp. Time to put on your pioneering hat [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-10-26 13:38
    This cell phone is just a monochrome lcd.. id hate to see the data sheet for color...

    So I tried this code with no results...

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    
    Dpin            PIN     4                       ' data pin
    Clk              PIN     0                       ' shift clock
    DC              PIN     2                       ' D/C pin
    
    
    Setup:
    
    PAUSE 10
    
    
    Main:
        LOW DC
        PAUSE 1
        SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]%00100001]
        PAUSE 1
        SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]%10010000]
        PAUSE 1
        SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]%00001100]
        PAUSE 1
        HIGH DC
        PAUSE 1
        SHIFTOUT Dpin, Clk, mSBFIRST, [noparse][[/noparse]%00011111]
    
    
    



    All of that shift out stuff was taken from the data sheet to initialize it and display a 5 dot bar on the very left side of the lcd.
    I think I need some pro help here, because i dont see what im dooin wrong. (I am sure alot)
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-10-26 14:14
    I am close to desoldering the thing, and reconnecting it back to the cell phone board to see it I fried it already...

    Can't get the glory of the art of electronics, unless you dive in with hands in the air.
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-10-27 04:24
    Do I need to clock the clock pin when I am changing reset, and or D/C????
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-10-27 05:51
    The LCD still works great in the cell phone... didn't break it.

    I wish I could afford the parallax O-scope. I might be able to then see how each data line is being used, and setup...... If the o-scope can work at that speed...

    But I still wonder if its the fact that I did not send clock information with a D/C change or a RESET change... I do know the 595 requires that the RESET is sent WITH a clock pulse.

    Post Edited (BPM) : 10/27/2005 11:06:21 AM GMT
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-10-27 06:02
    Anyone know of a way I can monitor the lcd's communications with a BS2? Like can I record what it does, and print it to debug? Obvioulsy using shiftin.

    Anyone try to monitor a device this way? It is possible?
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-10-27 09:53
    Tried this code... dosen't work

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    
    Dpin            PIN     4                       ' data pin
    Clk             PIN     0                       ' shift clock
    DC              PIN     2                       '
    Reset           PIN     6
    
    Setup:
    
    PAUSE 10
    
    
    Main:
    
        SHIFTOUT Reset, Clk, MSBFIRST, [noparse][[/noparse]%1]
        SHIFTOUT DC, Clk, MSBFIRST, [noparse][[/noparse]%0]
        SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]%00100001]
        SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]%10010000]
        SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]%00001100]
        SHIFTOUT DC, Clk, MSBFIRST, [noparse][[/noparse]%1]
        SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]%00011111]
    
    END
    
    



    Now I am just shooting in the dark. :-(
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-10-27 11:04
    After hooking the cell phone lcd up to some test wires, and putting the cell phone back together, I found out that the way I am
    hooking the LCD up is 100% correct. Measured voltages, etc. All correct.

    I only need a o-scope and im set.

    I am somehow sending the data to the lcd incorrectly.

    Theres gotta be someone who can help me.

    Measuring the D/C line, it seems to be HIGH all the time.. (but it could very well pulse and I not know it, due to it being a voltage measurement, as I do not own a O-scope. can't afford one.

    Post Edited (BPM) : 11/10/2005 12:43:37 AM GMT
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-10-27 20:23
    Tom Walker said...
    BPM,
    I think it is a little harsh to imply that "no one is willing to help me come up with a program to possibly get the lcd to start working" when you have, indeed, been given references to achieve your goal.
    <OK, Tom....drop the caffeine source and back away....>

    Given references? I am the one who POSTED the link to the data sheet and the link to the pinouts of the LCD. No one has given me any help on this whats so ever.

    I don't need much help, just for some person who knows a bit more about serial communication to take a look at the data sheet and tell me what I am doing wrong. In my thread, you will see I have made a few attempts at a program as a result of looking at the data sheet.

    Both have failed without any results. I understand that its non-standard in the fact that its not sold here or any other typical tronics store.

    But the serial interface is pretty standard, anyone who knows serial devices pretty well could prolly point me in the right direction after taking a look at the data sheet.

    I was just trying to make the point that even if you do find the data sheet, pin-outs, and get it hooked up, chances are good that no one will know how to help or will not want to take the time to help.

    I cannot continue further with my lcd, untill one of two things happen.

    1. Someone sees what I am doing wrong. And tells me.
    2. I wait for a few years after saving up for a O-scope.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-10-27 21:06
    I printed out the Spec sheet, I will take a look at it when I have more time.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10

    Post Edited (Paul Baker) : 10/27/2005 9:12:23 PM GMT
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-10-27 21:18
    Paul Baker said...
    I printed out the Spec sheet, I will take a look at it when I have more time.

    Damn, thats a heafty print... But thanks... Theres a page in the datasheet, Chaper 13, page 22 that tells you exactly how to initalize the LCD and how to send it display data.. I tried to do this in my code above with no results...

    Hopefully you can see my mistakes.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-10-27 21:42
    First off your code doesnt do a /RES pulse: "Immediately following power-on, the contents of all internal registers and of the RAM are undefined. A RES pulse must be applied. Attention should be paid to the possibility that the device may be damaged if not properly reset."

    Check chapter 8 for more details.

    The spec sheet is actually fairly light, the VS1002 data sheet I printed out last week was over a hunderd pages, not including app notes.

    <edit> Sorry, was looking at your earlier code, but I think you may have the polarity reversed, to reset, RES is pulsed low, and a pulsout command may be a better fit for this function </edit>

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10

    Post Edited (Paul Baker) : 10/27/2005 9:46:09 PM GMT
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-10-27 21:59
    Ok I think I know where problems are arising, your trying to use shiftout for all the commands, try this instead:

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    Dpin PIN 4 ' data pin
    Clk PIN 0 ' shift clock
    DC PIN 2 '
    Reset PIN 6

    Setup:

    PAUSE 10
    'Dont forget to setup the IO lines to the correct direction here
    Reset = 1

    Main:

    PULSOUT Reset, 1
    DC = 0
    SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]%00100001]
    SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]%10010000]
    SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]%00001100]
    DC = 1
    SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]%00011111]

    END

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-10-27 22:51
    From the data sheet:
    All internal registers are reset by applying an external RES
    pulse (active LOW) (by the description of low in the datasheet,, LOW level input voltage = [noparse][[/noparse]VSS minimum] to [noparse][[/noparse]0.3VDD maximum]

    Wouldn't this require a reset pulse of 0?

    Thus reset = 0 WHEN ON? (low or GND)
    Then put reset back to 1 (high or +v)

    I didn't catch this either when pulsing out reset, I put it to a 1.
    That means I had reset enabled the whole time while attempting to program the chip??
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-10-27 22:55
    Also in all examples, every time reset was enabled, or when DC was changed, The SHIFT line ALWAYS had a pulse on it.

    With my knowledge of the 74ls595, SHIFT always needed to cycle at least once to get the reset to work.
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-10-27 23:03
    Also during the transmission of several bytes, in all cases, whenever DC was being used, they didn't KEEP it high, they only pulsed it for one duration of the SHIFT cycle, and again its always pulsed WITH DB0 bit....

    Would I need to send DC high at the exact same time I am sending DB0? If so, dosen't that mean I cannot use the BS2 to run this LCD?

    Or I might have to manually pulse CLK and all other lines, in a delicately organized BINARY ON and OFF pattern to allow two outputs to be sent
    at the exact same SHIFT?

    Am I talking out of a non-working braincell here?
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-10-28 00:26
    This doesn't work

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    
    Dpin PIN 4   ' data pin
    Clk PIN 0    ' shift clock
    DC PIN 2     ' D/C pin
    Reset PIN 6  ' reset pin,
    
    
    Setup:
    
    DIRS = %111111     'IO line direction P0 - P6 outputs
    
    DC = 0             'make sure DC is set to low, this sets chip config mode
    Reset = 0          'make sure reset is on at power on
    SHIFTOUT Reset, Clk, MSBFIRST, [noparse][[/noparse]0] 'you need to shift reset in
    PAUSE 10
    Reset = 1          'turn off reset
    
    Main:
    
    SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]%00100001, %10010000, %00001100]  'this sets up the lcd according to the datasheet
    
    DC = 1              'This changes chip config mode, into lcd display mode
    
    SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]%00011111]  'this will display 5 dots in the very upper left corner of the lcd.
    
    END
    
    




    If I am correct this should be working 100% right now.

    Once small note.... while operating the cell phone when its put back together, I noticed a voltage mesurement of 7.8 volts on the VOUT pin of the lcd. The description of the vout pin on one of the pages I found on the net, the pinout from that said that the vout pin generates 7.8 volts... It tells one to disable the vout, basically connect it to nothing.

    When I measure the vout pin when not put together in the cell phone, but instead on my BS2, there is no voltage at that pin.
    Either I need to supply 7.8 volts, or the internal voltage regulator in the lcd chip dosen't work unless the lcd is setup properly.
    And I think to the best of my knowledge I have sent the proper sequence to the lcd, the only next step is to supply the vout pin with
    7.8 volts.

    The data sheet mentions that the lcd has two modes on vout. Either you can generate 7.8 volts at vout, by the lcd (internal regulator on)
    or you can SUPPLY 7.8 volts to the vout and the internal regulator is off.

    It does not go to say how to ENABLE or disable the internal regulator, so I am guessing that its a factory option and this lcd, unlike the one that is shown on another website, requires 7.8volts.

    I will supply it with 7.8 volts, and watch it fry, or work. I do not have anyother way to go now.

    Post Edited (BPM) : 10/28/2005 12:34:52 AM GMT
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-10-28 01:44
    Supplying 7.8 volts didn't work..

    When I hooked the lcd back up to the cell phone.

    The lcd still works.


    Could the lcd really be so picky as to require that DC be on only for one clock and only durning DB0???

    Stuck again.
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-10-28 02:22
    Mabee my lsb need to be first.
    I tried to make all MSBFIRST to send LSBFIRST. That did nothing.

    I would imagine the way bit flow sheets are read is oldest on the left, newest on the right??? Time
    >
    If so, the MSBFIRST is the correct way..

    As far as this question...Would I need to send DC high at the exact same time I am sending DB0?
    I think the answer is no. DC is ONLY measured by the chip at the DB0 bit. The setting of DC dosen't matter the rest of the time.. It can be on OR off..

    So then what might I be doing wrong.

    I suspect that if no one here can see the problem, the only way for me to really know is get a o-scope. $$$$$$$$$$$$


    Oooop I just realized that I am skipping a setup byte.... the 3rd one. I will retry all previous conditions, including supplying 7.8volts, changing MSBFIRST to LSBFIRST (just for the hell of it)
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-10-28 03:40
    I HAVE SOMETHING. The display is all random static for about 3 seconds, and then turns off.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    
    Dpin PIN 4   ' data pin
    Clk PIN 0    ' shift clock
    DC PIN 2     ' D/C pin
    Reset PIN 6  ' reset pin,
    
    
    Setup:
    
    DIRS = %111111     'IO line direction P0 - P6 outputs
    
    'DC = 0             'make sure DC is set to low, this sets chip config mode
    'Reset = 0          'make sure reset is on at power on
    SHIFTOUT Reset, Clk, MSBFIRST, [noparse][[/noparse]0] 'you need to shift reset in
    PAUSE 1
    Reset = 1          'turn off reset
    
    Main:
    
    SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]%00100001]  'this sets up the lcd according to the datasheet
    SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]%10010000]
    SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]%00100000]
    SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]%00001100]
    
    'THE LCD FAILS HERE, all static disappears here, and then does nothing.
    
    DC = 1        'This changes chip config mode, into lcd display mode
    
    SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]%00011111]  'this will display 5 dots in the very upper left corner of the lcd.
    
    END
    
    



    I was right about the 7.8 volts.

    I was right about the me skipping the setup byte.

    So from the beginning I had these things wrong:

    1. was not supplying lcd with 7.8volts, will not show anything without this.
    2. reset IS low when on, and SHIFTOUT MUST be used with it. (i tested this by disabling shift out and only setting reset) static only shows like this
    3. the lcd fails in the program step when sending DC, I might be right about DC needing to be clocked only at DB0, and at the same time. I don't know..
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-10-28 04:48
    Got it.

    I WAS ACTUALLY WRONG ABOUT THE 7.8 VOLTS...
    You can get the LCD to provide its own 7.8 VOLTS by attaching a 100nf capacitor to ground. Then you dont need a seperate 7.8 power supply.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    
    Dpin PIN 2   ' data pin
    Clk PIN 0    ' shift clock
    DC PIN 4     ' D/C pin
    Reset PIN 6  ' reset pin,
    
    
    Setup:
    
    DIRS = %111111     'IO line direction P0 - P6 outputs
    
    DC = 0             'make sure DC is set to low, this sets chip config mode
    Reset = 0          'make sure reset is on at power on
    SHIFTOUT Reset, Clk, LSBFIRST, [noparse][[/noparse]0] 'you need to shift reset in
    PAUSE 1
    Reset = 1          'turn off reset
    
    
    Main:
    
    SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]%00100001, %10010000, %00100000, %00001100]  'this sets up the lcd according to the datasheet
    
    DC = 1        'This changes chip config mode, into lcd display mode
    HIGH clk      ' This clocks DC bit in
    LOW clk      ' same
    SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]%00011111]    'this will display 5 dots on the lcd.
    
    PAUSE 50000
    
    



    This displays 5 dots. But not at the very left side of the lcd. But that doesn't matter, I removed the static on the display by CLOCKING in DC. Before I clocked in DC there would be static all over the display combined with what I was trying to write to the display.

    The pause at the end is to keep the stamp from sleeping. I need to write code that will update the display constantly.


    Thank you paul, you set me off to re-examine my work and question myself.
    You also made me realize that I was not far from the right way to make this work.

    I will post my code here when I get a full program running that can display what ever you like.
    But the above code will make this lcd work now.

    Post Edited (BPM) : 11/4/2005 2:16:34 AM GMT
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-10-28 05:18
    I am wrong about the DC also.

    There is no need to clock that in... IT DOESN'T REMOVE THE STATIC...

    The only way I can remove the static is to write to the display all zeros. Or somehow reset the display memory.
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-10-28 09:20
Sign In or Register to comment.