Forum: Projekte & Code KS0108 Busy Flag (ASM)


von RES (Gast)


Lesenswert?

Goodday All.....

Does anybody understand the Busy Flag problem on a GLCD with KS0108
chipset?
I can't get it operating, only with a small delay it works, but I need
speed.
Here is my ASM (for AVR micros) BF routine.


pollBF:  cbi  PORTC, E      ;E lo
  clr  temp
  out  DDRD, temp      ;PORTD all inputs
  sbi  PORTC, RW      ;R/W hi (read mode)
  cbi  PORTC, DI      ;D/I lo (intruction mode)
  nop          ;tAS > 140 ns
  nop
loopBF:  sbi  PORTC, E      ;E hi
  nop          ;tDDR > max. 320 ns
  nop
  in  temp, PIND      ;read pins PORTD
  ldi  temp, 0b00000000    ;only bit7
  cbi  PORTC, E      ;E lo
  nop
  nop
  cpi  temp, 0x00      ;if BF = 1,
  brne  loopBF        ; -> loop
  ser  temp        ;else ->
  out  DDRD, temp      ; PORTD all outputs
  ret

I can't see an error in the code, can you?

Thanks.

von Uwe Nagel (Gast)


Lesenswert?

I think I can...

You load PIND into temp and then you overwrite temp with 0b00000000.
What will be in temp? Allways 0!
I guess it would be right to write:

  in  temp, PIND      ;read pins PORTD
  andi  temp, 0b10000000    ;only bit7

Uwe

von RES (Gast)


Lesenswert?

Yes, now it works.  :)
Also made another error, when polling the BF, E must kept high.

Thanks.

von RES (Gast)


Lesenswert?

A few years later..

Guess what, now running at 8 MHz and causing the problem.

http://img114.imageshack.us/img114/9213/imgp2515rd5.jpg

But, problem solved. It's the time after the polling, use at least 5 
nops.

--- >8
   sbi   PORTB, E         ;clock hi
   nop            ;tDDR < 320 ns
loopBF:   sbic   PIND, BF      ;wait BF goes lo
   rjmp   pollBF
   nop
   nop
   nop            ;tCYC > 1 us
   nop
   nop
   cbi   PORTB, E         ;clock lo
--- >8

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.