Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] OT: HD44780 LCD lock-up - busy flag stays set

2007-08-22 by Kathy Quinlan

Mark Nowell wrote:
> Apologies in advance for the thoroughly non-AVR question but I'm really 
> tearing my hair out with an LCD problem and I'm sure there are some 
> really clever/experienced LCD'ers here (grovel, scrape) ...
> 
> We've recently switched to yet another cheaper, brighter, 16x2, HD44780 
> compatible LCD (Ampire AC162DY1LY). A small number of these latest 
> displays lock-up after correctly initialising and executing a (variable) 
> number of display commands. By "lock-up" I mean that the busy-flag stays 
> set for at least 150ms, after which time the watchdog resets the micro, 
> which then attempts to re-initialise the display, and fails, presumably 
> because it's still busy. Display shows the last written text overwritten 
> by blocks on the top line, bottom line blank. The display controller 
> appears to still be alive because the successive E-cycles show different 
> data-bit patterns for the alternate BF and AC3 cycles (4-bit mode).
> 
> The LCD driver code has been untouched over 15 years, several thousand 
> displays and half-a-dozen different display types. I've double-checked 
> the timings and they're not even close to marginal. Code below [ok, it's 
> an 80C196 but the comments are in english - 12MHz - port writes take 
> 833ns, branches 833/1500ns - I'll claim it's a deliberate reminder of 
> how what a marvel AVR RISC is].
> 
> Has anyone experienced anything like this? Should I suspect faulty 
> displays? Or my code?

I have had problems with Ampire displays and static, I found that by 
grounding the LCD Bezzle I could stop this problem.


> TIA,
> Mark
> 
> void LMFWriteData( void ) {
>   /* on entry LMDATA contains DB0-7 */
>   /* check busy status */
>   asm bbc lmNoDisplay,0,checkBusyFlag ;
>   asm br lmfwdEnd ;
> checkBusyFlag:
>   ioport1 = 0x2f ;                  /* rw=1, db4-7=weak1, e=rs=0 */
>   ioport1 = 0x6f ;                  /* e=1, db7->busy flag */
>   asm bbc ioport1,3,busyFlagClr ;
>   ioport1 = 0x2f ;                  /* e=0 */
>   ioport1 = 0x6f ;                  /* e=1, db7->AC3 */
>   asm br checkBusyFlag ;
> busyFlagClr:
>   ioport1 = 0x2f ;                  /* e=0 */
>   ioport1 = 0x6f ;                  /* e=1, db7->AC3 */
>   ioport1 = 0x2f ;                  /* e=0 */
>   /* write instr */
>   asm ldb LMDATAHI,LMDATA ;
>   asm shrb LMDATAHI,#4 ;            /* LMDATAHI.0-3=hi data */
>   asm andb LMDATA,#0x0f ;           /* Clr LMDATA.4-7 */
>   asm ldb ioport1,#0x1f ;           /* put rs=1,r/w=0,db4-7=weak1,e=0 */
>   asm addb ioport1,LMDATAHI,#0x50 ; /* e=1,db4-7=hi data */
>   asm addb ioport1,LMDATAHI,#0x10 ; /* e=0 */
>   asm addb ioport1,LMDATA,#0x50 ;   /* put lo data,e=1 */
>   asm addb ioport1,LMDATA,#0x10 ;   /* e=0 */
> lmfwdEnd: ;
> }

-- 
Regards,

Kat.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.