Shop OBEX P1 Docs P2 Docs Learn Events
Have anybody tried to control a 64128 graphics lcd with KS0713 ic (with serial — Parallax Forums

Have anybody tried to control a 64128 graphics lcd with KS0713 ic (with serial

ciphernetciphernet Posts: 24
edited 2007-06-18 13:17 in Propeller 1
I looked at some PIC code for serial control of a Graphic LCD display (64x128 pixels) with a KS0713 chip on glass controller and tried to convert the PIC code for use with the propeller, with little luck.

I want to use the rest of the pins on the propeller for other purposes, so I am left with five pins and that should be enough to control the KS0713 LCD controller, but the display seems dead.

Have anybody tried to access one of these panels serially with the propeller? I have checked my hardware and it seems OK. All capacitors for the charge-pump and internal PSU is okay and the display gets the correct 3,3V voltage.

I think I have a problem with the serial shift-out routine.

Can anybody help?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-06-16 00:49
    There are already debugged serial I/O routines for the Propeller that come with the Propeller Tool or can be found in this forum or in the Propeller Object Exchange.

    If you're really intent on just converting the PIC code to Propeller, post what you have along with a description of the behavior you're seeing·and someone will offer help.
  • ciphernetciphernet Posts: 24
    edited 2007-06-16 14:17
    Hi Mike, here is the code so far:


    CON
    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000



    CS1B = 16
    RST = 17
    RS = 18
    CLK = 19
    DATA = 20

    BITS = 8

    VAR



    PUB Main

    dira[noparse][[/noparse]CS1B]~~ ' SET THE LCD CONTROL PINS AS OUPUTS
    outa[noparse][[/noparse]RST]:=0
    dira[noparse][[/noparse]RST]~~
    outa[noparse][[/noparse]RST]:=0 ' SET THE RESET PIN LOW
    dira[noparse][[/noparse]RS]~~
    outa[noparse][[/noparse]RS]:=0
    dira[noparse][[/noparse]CLK]~~
    outa[noparse][[/noparse]CLK]:=0
    dira[noparse][[/noparse]DATA]~~
    outa[noparse][[/noparse]DATA]:=0

    waitcnt(100_000 + cnt) ' WAIT

    outa[noparse][[/noparse]RST]:=1 ' SET THE RESET PIN HIGH FOR NORMAL OP.
    outa[noparse][[/noparse]CS1B]:=0 ' SET THE CS1B PIN LOW FOR WRITE OP.

    waitcnt(100_000 + cnt) ' WAIT FOR LCD TO SETTLE

    outa[noparse][[/noparse]RS]:=0 ' SET RS PIN LOW FOR LCD COMMANDS
    SEROUT ($E2) ' SEND RESET COMMAND FOR ALL LCD REGS.

    SEROUT ($A0) ' SELECT SEG OUTPUT DIR : ADC=0
    SEROUT ($C0) ' SELECT COM OUTPUT DIR : SHL=0
    SEROUT ($A2) ' SELECT LCD BIAS
    SEROUT ($2F) ' TURN ON VOL. CONV, REG, VOLT FOLLOWER
    waitcnt(100_000 + cnt) ' WAIT
    SEROUT ($26) ' SELECT THE REG. RESISTOR
    SEROUT ($81) ' 1ST INSTRUCTION SET REF. VOLT. REG.
    SEROUT ($20) ' 2ND INSTRUCTION REG
    waitcnt(100_000 + cnt) ' WAIT
    SEROUT ($A4) ' NORMAL DISPLAY
    SEROUT ($A6) ' REVERSE DISPLAY OFF
    SEROUT ($AF) ' TURN ON THE LCD

    ' INIT DONE - DRAW SOMETHING ON LCD

    outa[noparse][[/noparse]RS]:=0 ' SET RS PIN LOW FOR LCD COMMANDS
    SEROUT ($40) ' INITIAL DISPLAY LINE
    SEROUT ($B0)
    SEROUT ($14) ' SET MSB COL. ADDRESS
    SEROUT ($00) ' SET LSB COL. ADDRESS

    outa[noparse][[/noparse]RS]:=1 ' SET RS PIN HIGH FOR LCD DATA
    SEROUT ($F0) ' DISPLAY DATA - TEST





    PUB SEROUT (TX_BYTE) ' MSB FIRST SERIAL OUT ROUTINE



    REPEAT (BITS)
    outa[noparse][[/noparse]DATA] := TX_BYTE >> (BITS-1) ' Set output
    TX_BYTE := TX_BYTE << 1 ' Shift value right
    !outa[noparse][[/noparse]CLK] ' cycle clock
    waitcnt(1000 + cnt) ' delay
    !outa[noparse][[/noparse]CLK]
    waitcnt(1000 + cnt) ' delay

    outa[noparse][[/noparse]DATA]~ ' Set data to low
    outa[noparse][[/noparse]CLK]~ ' Set clk to low

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·Give me some slack, please.. I have programmed SX controllers for five years but the prop just blows my mind :-)
  • ciphernetciphernet Posts: 24
    edited 2007-06-16 14:22
    Sorry, saw that the TAB infomation was removed when I pasted the code into my post..

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·Give me some slack, please.. I have programmed SX controllers for five years but the prop just blows my mind :-)
  • ciphernetciphernet Posts: 24
    edited 2007-06-16 14:37
    I changed the serial code a bit but still no luck

    PUB SEROUT (TX_BYTE)··································· ' MSB FIRST SERIAL OUT ROUTINE
    ·
    · outa[noparse][[/noparse]CS1B]:=0········································ ' SET THE CS1B PIN LOW FOR WRITE OP.
    ·
    · REPEAT (BITS)·······························································
    ····· outa[noparse][[/noparse]DATA] := TX_BYTE >> (BITS-1)·················· ' Set output··········
    ····· TX_BYTE := TX_BYTE << 1···························· ' Shift value right···
    ····· outa[noparse][[/noparse]CLK]:=1······································· ' SET CLOCK HIGH - TO CLOCK DATA OUT
    ····· outa[noparse][[/noparse]CLK]:=0······································· ' SET CLOCK LOW···························································
    ····· waitcnt(1000 + cnt)································ ' delay···············

    · outa[noparse][[/noparse]DATA]:=0········································ ' Set data to low
    · outa[noparse][[/noparse]CLK]:=0········································· ' Set clk to low
    · outa[noparse][[/noparse]CS1B]:=1········································ ' SET THE CS1B PIN HIGH FOR IDLE OP.
    ···

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·Give me some slack, please.. I have programmed SX controllers for five years but the prop just blows my mind :-)
  • rjo_rjo_ Posts: 1,825
    edited 2007-06-17 00:26
    ciphernet,

    First of all... thanks for posting the question. Second... which lcd are you looking at?

    I have never looked at the serial routines... it's on my list[noparse]:)[/noparse]

    So, if there is a subtle problem here... it's beyond me.

    But... I have a question about timing.

    You appear to be using a waitcnt to stall the main until the subroutines executes... so that the next instruction doesn't get executed before the current call has had a chance to return. Is that almost correct?

    (If so... I was told not to do that!!!)


    Rich
  • ciphernetciphernet Posts: 24
    edited 2007-06-18 00:15
    Hi Rich,

    It´a Displaytech LCD panel from RS Components. They are based on the S6B1713 (KS0713) COG controller.

    I saw my mistake regarding the delays and now the routine itself is running. It did stall because of the delays I made, but I still can´t get the LCD up and running. I will check my connections and check the pulses with my FlukeMeter tonight.

    Thanks for the tip regarding the delays.


    Jan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·Give me some slack, please.. I have programmed SX controllers for five years but the prop just blows my mind :-)
  • ciphernetciphernet Posts: 24
    edited 2007-06-18 13:17
    All is working fine now. Tested the code step by step and made some mod´s.


    Jan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·Give me some slack, please.. I have programmed SX controllers for five years but the prop just blows my mind :-)
Sign In or Register to comment.