Currently, I am building a simple Z80 computer system on breadboard. I am at the point where I need to start learning how the display module works so that I can have some output. I cannot for the life of me get the display to show anything, no matter what bytes I send to it. Below is the ASM code I last used for testing. My Z80 is being run at 120 Hz for these tests. I have also tried many other initialization routines I have found online to no avail, but this one is based on the one specified in the ST7920's manual.
ld hl,initData ;Memory location holding a string of bytes that are used for initialization initLoop: ld a,(hl) ;Load init byte at HL to A cp $ff jr z, breakLoop ;Break if the end of string is reached out $00,a ;Send init byte to display's instruction register inc hl ;Move to subsequent init byte jr initLoop breakLoop: ld hl,displayData displayLoop: ;Feed bytes from displayData into display RAM ld a,(hl) cp $ff jr z, breakLoop2 out $01,a inc hl jr displayLoop breakLoop2: halt initData: .db $30 ;Function set, 8-bit parallel, basic intstruction \ .db $30 ;Function set, 8-bit parallel, basic intstruction | .db $0c ;Display ON, cursor and blink OFF |---Taken from manual .db $01 ;Display clear | .db $06 ;Address counter auto-increment after read/write / .db $34 ;Function set, 8-bit parallel, extended instruction .db $80 ;Graphic display address set y .db $80 ;Graphic display address set x .db $36 ;Graphic display ON .db $32 ;Basic instruction set .db $ff ;End loop displayData: .db $21 .db $21 .db $21 .db $21 .db $21 .db $21 .db $ff ;End loop
Note that sending to port 0 enables the display's instruction register, and port 1 allows display data I/O. I have verified that these signals and CE go low at the appropriate times, so I am almost inclined to believe that the issue falls on the bytes I am feeding the device. Every pin connection on the device has been tested, and I have done much research to make sure my connections are correct. Below, I will include a reduced schematic of my system showing only connections between the Z80 and display, and a picture of the display module's back side.
One strange thing that has occurred very rarely before is that running initialization will cause a blinking 16x16 cursor to show up in the middle of the screen, move once, and then disappear from the screen. This happened consistently with a certain string of bytes, but I have not been able to recreate it since, nor was it even what I wanted it to do in the first place. Another occurrence was the appearance of junk data all over the screen. I think this could be due to a bad reset signal. In any case, I'm hoping that somebody who has experience with these tricky devices can come up with a solution, or at least guide me in the right direction.
UPDATE 1: It was brought to my attention that the display's CE pin is active high, unlike the RST and WR pins. I performed a nand operation on the port 1 and 2 enable signals in order to generate the correct CE signal for the device. Previously, CE was equal to P1 & P2 I pulled all the wires for the display, and reconnected them 1 by 1 to ensure that my wiring was correct. I don't own an oscope, but I was able to manually clock my z80 system and observe the CE, WR, and RS signals before, during, and after a display operation. The signals seemed to match what is shown in the device manual, and I am still left with the same problem as before.