# GLCD Timing Problem

#### Utku

Joined Dec 14, 2014
10
Hello,

I am trying to use a GLCD, a WDG0151-TMI-V#N00 and I think I have a timing problem. I have to write my code in AVR assembly language and although I made the delay time 5 micro seconds between signal enable/disables (as in the tutorial in here), still nothing shows up on the screen. Might it be because I am using a development board and it takes a long time for the signal travel from the MPU to GLCD? I would be very grateful if you could help me. Thank you very much in advance.

Regards

#### ericgibbs

Joined Jan 29, 2010
17,174
hi Ut,
There are some noted drawing and programming errors.

If you post your assembly code we can look it over.
E

#### Utku

Joined Dec 14, 2014
10
Thanks. I am posting my assembly code.

#### Attachments

• 6.4 KB Views: 35

#### ericgibbs

Joined Jan 29, 2010
17,174
hi,
There are some noted drawing and programming errors.

#### jpanhalt

Joined Jan 18, 2008
11,087
It would be helpful if you posted your routines. This set of routines came from Pommie, who is a frequent helper here. Any credit belongs to him. I changed only a very few things. Most notably, Pommie uses a routine called WaitNotBusy for timing. I simply inserted some NOP's. You will see a section with four. That was done while trouble shooting some issues. Two NOP's will usually work. The enable set and clear has one NOP. At 4 MHz, that is probably not necessary. At 8 MHz, which I am using, it may not be necessary either. There is a comment at that point.

John

EDIT: Code = MPASM

#### Attachments

• 1.4 KB Views: 21
Last edited:

#### Utku

Joined Dec 14, 2014
10
But which assembly is it? I am using an ATmega32 so I am using AVR Assembly. All routines I use are in the code by the way.

#### jpanhalt

Joined Jan 18, 2008
11,087
The code I added is MPASM. Your code may use different mnemonics, but the processes should be quite similar, because the GLCD controllers are the same.

John

#### Utku

Joined Dec 14, 2014
10
4 nops don't work. Actually I have tried even like 30 nops but still doesn't work.

#### Utku

Joined Dec 14, 2014
10
For some reason, only a very large delay loop works but erroneously. That loop is as below. It introduces a delay of approx. 1ms.

Code:
GLCD_PULSE_DELAY:
; Introduces a delay to send the command to the GLCD.
ldi temp, 15
mov dly1, temp
ldi temp, 255
mov dly2, temp
ldi temp, 1
ldi temp1, 0
PULSE_DELAY_LOOP:
SUB dly1, temp
SBC dly2, temp1
BRCC PULSE_DELAY_LOOP
ret