SED1335 Graphic LCD driver problem

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi Gents;

I have been trying to make my new shining Winstar WG320240C LCD ( )
with S1D13305F formerly known as SED1335 controller by using an ATMEL
ATMEGA162 uc. I have written the below code but when I power up my
circuit, LCD starts flickering continuesly. I cannot initialize the
screen and make it running to display some words :(

Could you please check my code and circuit below if you see something
wrong and drop me a line or two ;)
If there is also anyone who worked this LCD out, please send me any
reference, cuz I am getting crazy soon..

For connections I set up like:

    |-- PIN1    Ground
    |-- PIN2    +5V
    |-- PIN3    ~apprx. -16V
    |-- PIN4    RD/E connected to PA6
    |-- PIN5    WR/RW connected to PA5
    |-- PIN6    Ao connected to PA7
    |-- PIN7    DB0 connected to PC0
    |-- PIN8    DB1 connected to PC1
    |-- PIN9    DB2 connected to PC2
LCD |-- PIN10   DB3 connected to PC3
    |-- PIN11   DB4 connected to PC4
    |-- PIN12   DB5 connected to PC5
    |-- PIN13   DB6 connected to PC6
    |-- PIN14   DB7 connected to PC7
    |-- PIN15   CS connected to Gnd
    |-- PIN16   RES connected to PD7
    |-- PIN17   Negative voltage output connected to PIN3 through a
    |-- PIN18   Frame Ground connected to Gnd
    |-- PIN19   NC
    |-- PIN20   NC

My code is:

.include ""
.equ    CTL_RW    = 5
.equ    CTL_E    = 6
.equ    CTL_A    = 7
.equ    CTLPORT    = PORTA
.equ    DATPORT    = PORTC
.def    rtemp1    = r16
.def    rtemp2    = r17
.def    data    = r18
.macro    cmdw
        ldi        data,    (@0)
        rcall    lcd_cmdw
.macro    datw
        ldi        data,    (@0)
        rcall    lcd_datw
.org     0
        rjmp    start
;-- lcd_reset
;-- adjusts the port/pin directions
;-- and sends a reset pulse to the LCD
        ldi    rtemp1,    $ff
        out    DDRA,    rtemp1    
        ldi    rtemp1,    $a0
        out    PORTA,    rtemp1
        ldi    rtemp1,    $ff
        out    DDRC,    rtemp1    ; PC0..PC7 -> all output
        sbi    DDRD,    7        ; PD7 -> output
        sbi    PORTD,    7        ; first set PD7
        rcall    delay1ms
        rcall    delay1ms
        rcall    delay1ms
        rcall    delay1ms
        ldi    rtemp1,    $00
        out    PORTA,    rtemp1
        cbi    PORTD,    7        ; clear PD7  (reset)
        rcall    delay1ms        ; wait 3ms.
        rcall    delay1ms
        rcall    delay1ms
        rcall    delay1ms
        rcall    delay1ms
        sbi    PORTD,    7        ; set PD7
        ldi    rtemp1,    $a0
        out    PORTA,    rtemp1
        ldi    r18,     200
        rcall    delay1ms        ; wait for stabilization. approx 100 ms.
        dec        r18
        brne    lcd_rs_lp
;-- lcd_init
;-- initializes lcd
        ; System Set
        cmdw    $40
        datw    $30
        datw    $87
        datw    $07
        datw    $27        ; dec 39
        datw    $42        ; dec 66
        datw    $ef        ; dec 239
        datw    $28        ; dec 40
        datw    $00
        ; Scroll
        cmdw    $44
        datw    $00
        datw    $00
        datw    $f0
        datw    $80
        datw    $25
        datw    $f0
        ; HDOT
        cmdw    $5a
        datw    $00
        ; Overlay
        cmdw    $5b
        datw    $03
        ; Display OFF
        cmdw    $58
        datw    $16
        rcall    lcd_tclr
        ; Cursor format
        cmdw    $5d
        datw    $07
        datw    $87
        ; Display ON
        cmdw    $59
        datw    $16
        ; Cursor direction
        cmdw    $4c
        ; Cursor write
        cmdw    $46
        datw    $00
        datw    $00
        cmdw    $46
        datw    $00
        datw    $00
        ldi    r28,    $e8
        ldi    r29,    $03        ; 1000
        cmdw    $42
        datw    $00
        sbiw    r28,     1
        brne    lcd_tclrlp
;-- lcd_cmdw
;-- writes a command to the lcd.
        cbi        CTLPORT, CTL_E
        sbi        CTLPORT, CTL_A
        cbi        CTLPORT, CTL_RW
        sbi        CTLPORT, CTL_E
        out        DATPORT, data
        cbi        CTLPORT, CTL_E
;-- lcd_datw
;-- writes data to lcd
        cbi        CTLPORT, CTL_E
        cbi        CTLPORT, CTL_A
        cbi        CTLPORT, CTL_RW
        sbi        CTLPORT, CTL_E
        out        DATPORT, data
        cbi        CTLPORT, CTL_E
;-- delay1ms
;-- delays 1000 CLK cycles
        ldi        rtemp1, 10
        ldi        rtemp2,    32
        dec        rtemp2
        brne    delayi
        dec        rtemp1
        brne    delayo
        ldi        rtemp1,        0
        out        sreg,        rtemp1
        ldi        rtemp1,        low(RAMEND)
        out        spl,         rtemp1
        ldi        rtemp1,        high(RAMEND)
        out        sph,        rtemp1
        rcall    lcd_reset
        rcall    lcd_init
        datw    $3
        sbi        DDRD, 6
        sbi        PORTD, 6
lp:        rjmp    lp



Re: SED1335 Graphic LCD driver problem
Hi there

I am working on exactly the same Winstar LCD using a AT89c52 to start with
at this moment.

I had the same problem as you. I played with the initialization values and I
got it right.
At the moment I am at work and I don't have the C code with me but as soon
as I get it I will sent it to you.

Try the fiddling with the pot controlling the negative voltage. That solved
one of my early problems.

Check these values

Quoted text here. Click to load it

It took me a while to calculate the right ones. I still quite don't
understand it
I didn't understand what they mean by the frame frequency (is it the power
frequency 60Hz in the states while 50Hz in Australia)

I fluked it somehow but it works now. I am still going crazy over it.

Quoted text here. Click to load it

Site Timeline