One thing unresolved bit of the LCD is the R/~W line. I had largely assumed that the display was write only in this product, but I was quite wrong as reading is needed at least to poll the 'busy' bit in the status register. I had found the readLCDnybble function a while back, but at that time 0x8000 was a mystery to me until I found that it was for keyboard column selection. So why is it used in the LCD routine. I believe that it serves double duty. In this case, bit 2 is also connected to LCD R/~W line.
EC45 ; LCD read nybble; return PD in A (shifted LCD data into b5-3)
EC45 readLCDnybble_EC45:
EC45 86 03 ldaa #3
EC47 97 09 staa DDRD_9 ; DDRD: b1, b0 output; others input
EC49 86 04 ldaa #4
EC4B B7 80 00 staa $8000 ; XXX b2 of 8000 seems to do double-duty as R/~W for LCD
EC4E 14 00 80 bset PORTA_0 $80 ; PORTA: b7 high
EC51 96 08 ldaa PORTD_8 ; PORTD: all data bits
EC53 15 00 80 bclr PORTA_0 $80 ; PORTA: b7 low
EC56 14 09 FF bset DDRD_9 $FF ; DDRD: all pins output
EC59 7F 80 00 clr $8000 ; XXX b2 of 8000 seems to do double-duty as R/~W for LCD
EC5C 15 08 3C bclr PORTD_8 $3C ; PORTD: b5,4,3,2 low
EC5F 39 rts
I don't know why bit 2 in particular; this might imply there being double duty on some of the other lines as well. Or maybe it was just convenient in laying out the traces.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.