I don't know much about controllers. The GLCD I'm using is the NHD-C12864WM-09-FSW-FBW-3V3-M from New Haven Displays. It uses SPLC501C controller, which would now be the only one I know *anything* about. I still had to take the output and modify it somewhat.
For the little image pasted below, here's the code that the software generated:
Here's what I did to it to make it work with my GLCD:Code:'PIC BASIC PRO CODE FOR DISPLAY IMAGE ON T6963C LCD CONTROLLER '----------SUBROUTINES FOR IMAGE DATA-------------------- 'pict1: for gl_i=0 to 239 lookup gl_i,[$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$60,$60,$60,$30,$30,$38,$18,$18,$FC,$FC,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$80,$C0,$F0,$30,_ $18,$18,$0C,$0C,$0C,$0C,$0C,$18,$18,$30,$F0,$C0,$80,$00,$00,$00,_ $00,$00,$00,$60,$70,$30,$18,$18,$1C,$0C,$0C,$0C,$0C,$0C,$0C,$18,_ $38,$70,$E0,$80,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$C0,$E0,$38,$1C,$FC,_ $FC,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$FC,$FC,$0C,$0C,_ $0C,$0C,$0C,$0C,$0C,$0C,$0C,$0C,$0C,$0C,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$FF,$FF,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$03,$03,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$80,$C0,$70,$3F,$0F,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$C0,$C0,$C0,$C0,$C0,$E0,_ ],gl_k val=gl_k I2Cwrite DPIN, CPIN, $A0, addr.highbyte,addr.lowbyte, [val] addr=addr+1 pause 4 NEXT 'pict2: for gl_i=0 to 239 lookup gl_i,[$70,$38,$1F,$0F,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$80,$E0,$78,$1C,$07,$03,$00,$00,$00,$FF,_ $FF,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$FF,$FF,$40,$60,_ $60,$30,$30,$30,$30,$30,$30,$60,$60,$C0,$C0,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$FF,$FF,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $80,$C0,$60,$30,$18,$0C,$06,$03,$01,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$01,$01,_ $03,$07,$0E,$FC,$F0,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$70,$7C,$6F,$63,$60,$60,$60,$60,$60,$60,$60,$60,$FF,_ $FF,$60,$60,$60,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$03,$FF,$FC,$00,$00,$00,_ $00,$00,$00,$60,$60,$60,$60,$60,$60,$60,$60,$7F,$7F,$60,$60,$60,_ $60,$60,$60,$60,$60,$00,$00,$00,$00,$00,$00,$70,$78,$6C,$66,$63,_ $61,$60,$60,$60,$60,$60,$60,$60,$60,$60,$60,$78,$78,$00,$00,$00,_ $00,$00,$0C,$1C,$18,$30,$30,$30,$60,$60,$60,$60,$60,$60,$70,$30,_ $38,$1C,$0E,$07,$01,$00,$00,$00,$00,$3C,$7E,$7E,$7E,$7E,$3C,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$60,$60,$60,$60,$60,$7F,_ $7F,$60,$60,$60,$00,$00,$00,$00,$00,$00,$06,$0E,$1C,$18,$30,$30,_ $60,$60,$60,$60,$60,$60,$70,$30,$38,$1C,$0F,$07,$01,$00,$00,$00,_ ],gl_k val=gl_k I2Cwrite DPIN, CPIN, $A0, addr.highbyte,addr.lowbyte, [val] addr=addr+1 pause 4 NEXT 'pict3: for gl_i=0 to 239 lookup gl_i,[$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ ],gl_k val=gl_k I2Cwrite DPIN, CPIN, $A0, addr.highbyte,addr.lowbyte, [val] addr=addr+1 pause 4 NEXT 'pict4: for gl_i=0 to 239 lookup gl_i,[$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ ],gl_k val=gl_k I2Cwrite DPIN, CPIN, $A0, addr.highbyte,addr.lowbyte, [val] addr=addr+1 pause 4 NEXT return
So it didn't write *all* my code for me, but it sure helped shorten the amount of time.Code:'PIC BASIC PRO CODE FOR DISPLAY IMAGE ON T6963C LCD CONTROLLER INCLUDE "ALLDIGITAL.pbp" 'Search the PicBasic forum for this RESETB var PORTA.3 RW VAR PORTA.4 CS2 VAR PORTA.5 RS var PORTB.2 EOS VAR PORTB.3 C86 VAR PORTF.2 D0 var PORTG.0 D1 var PORTG.1 D2 var PORTG.2 D3 var PORTG.3 D4 var PORTG.4 D5 VAR PORTF.5 D6 VAR PORTE.6 D7 VAR PORTE.7 PORTA = 0 PORTB = 0 PORTC = 0 PORTD = 0 PORTE = 0 PORTF = 0 PORTG = 0 TRISA = 0 TRISB = 0 TRISC = 0 TRISD = 0 TRISE = 0 TRISF = 0 TRISG = 0 gl_k var byte gl_i var byte 'Initialize the GLCD gosub InitGLCD 'jump over subroutines goto Start '----------SUBROUTINES FOR IMAGE DATA-------------------- ShowScreen: 'Page0 gl_k = %10110000 'Go to start of page 0 GOSUB WriteCommand gl_k = %00010000 'Set Column address upper nibble to zero GOSUB WriteCommand gl_k = %00000000 'Set Column address lower nibble to zero GOSUB WriteCommand 'write the entire page for gl_i=0 to 127 lookup gl_i,[$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00_ ],gl_k gosub WriteData NEXT gl_i 'Page1 gl_k = %10110001 'Go to start of page 1 GOSUB WriteCommand gl_k = %00010000 'Set Column address upper nibble to zero GOSUB WriteCommand gl_k = %00000000 'Set Column address lower nibble to zero GOSUB WriteCommand 'write the entire page for gl_i=0 to 127 lookup gl_i,[$00,$00,$00,$60,$60,$60,$30,$30,$38,$18,$18,$FC,$FC,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$80,$C0,$F0,$30,_ $18,$18,$0C,$0C,$0C,$0C,$0C,$18,$18,$30,$F0,$C0,$80,$00,$00,$00,_ $00,$00,$00,$60,$70,$30,$18,$18,$1C,$0C,$0C,$0C,$0C,$0C,$0C,$18,_ $38,$70,$E0,$80,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$C0,$E0,$38,$1C,$FC,_ $FC,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$FC,$FC,$0C,$0C,_ $0C,$0C,$0C,$0C,$0C,$0C,$0C,$0C,$0C,$0C,$00,$00,$00,$00,$00,$00_ ],gl_k gosub WriteData NEXT gl_i 'Page2 gl_k = %10110010 'Go to start of page 2 GOSUB WriteCommand gl_k = %00010000 'Set Column address upper nibble to zero GOSUB WriteCommand gl_k = %00000000 'Set Column address lower nibble to zero GOSUB WriteCommand 'write the entire page for gl_i=0 to 127 lookup gl_i,[$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$FF,$FF,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$03,$03,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$80,$C0,$70,$3F,$0F,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$C0,$C0,$C0,$C0,$C0,$E0,_ $70,$38,$1F,$0F,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$80,$E0,$78,$1C,$07,$03,$00,$00,$00,$FF,_ $FF,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$FF,$FF,$40,$60,_ $60,$30,$30,$30,$30,$30,$30,$60,$60,$C0,$C0,$00,$00,$00,$00,$00_ ],gl_k gosub WriteData NEXT gl_i 'Page3 gl_k = %10110011 'Go to start of page 3 GOSUB WriteCommand gl_k = %00010000 'Set Column address upper nibble to zero GOSUB WriteCommand gl_k = %00000000 'Set Column address lower nibble to zero GOSUB WriteCommand 'write the entire page for gl_i=0 to 127 lookup gl_i,[$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$FF,$FF,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $80,$C0,$60,$30,$18,$0C,$06,$03,$01,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$01,$01,_ $03,$07,$0E,$FC,$F0,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$70,$7C,$6F,$63,$60,$60,$60,$60,$60,$60,$60,$60,$FF,_ $FF,$60,$60,$60,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$03,$FF,$FC,$00,$00,$00_ ],gl_k gosub WriteData NEXT gl_i 'Page4 gl_k = %10110100 'Go to start of page 4 GOSUB WriteCommand gl_k = %00010000 'Set Column address upper nibble to zero GOSUB WriteCommand gl_k = %00000000 'Set Column address lower nibble to zero GOSUB WriteCommand 'write the entire page for gl_i=0 to 127 lookup gl_i,[$00,$00,$00,$60,$60,$60,$60,$60,$60,$60,$60,$7F,$7F,$60,$60,$60,_ $60,$60,$60,$60,$60,$00,$00,$00,$00,$00,$00,$70,$78,$6C,$66,$63,_ $61,$60,$60,$60,$60,$60,$60,$60,$60,$60,$60,$78,$78,$00,$00,$00,_ $00,$00,$0C,$1C,$18,$30,$30,$30,$60,$60,$60,$60,$60,$60,$70,$30,_ $38,$1C,$0E,$07,$01,$00,$00,$00,$00,$3C,$7E,$7E,$7E,$7E,$3C,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$60,$60,$60,$60,$60,$7F,_ $7F,$60,$60,$60,$00,$00,$00,$00,$00,$00,$06,$0E,$1C,$18,$30,$30,_ $60,$60,$60,$60,$60,$60,$70,$30,$38,$1C,$0F,$07,$01,$00,$00,$00_ ],gl_k gosub WriteData NEXT gl_i 'Page5 gl_k = %10110101 'Go to start of page 5 GOSUB WriteCommand gl_k = %00010000 'Set Column address upper nibble to zero GOSUB WriteCommand gl_k = %00000000 'Set Column address lower nibble to zero GOSUB WriteCommand 'write the entire page for gl_i=0 to 127 lookup gl_i,[$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00_ ],gl_k gosub WriteData NEXT gl_i 'Page6 gl_k = %10110110 'Go to start of page 6 GOSUB WriteCommand gl_k = %00010000 'Set Column address upper nibble to zero GOSUB WriteCommand gl_k = %00000000 'Set Column address lower nibble to zero GOSUB WriteCommand 'write the entire page for gl_i=0 to 127 lookup gl_i,[$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00_ ],gl_k gosub WriteData NEXT gl_i 'Page7 gl_k = %10110111 'Go to start of page 7 GOSUB WriteCommand gl_k = %00010000 'Set Column address upper nibble to zero GOSUB WriteCommand gl_k = %00000000 'Set Column address lower nibble to zero GOSUB WriteCommand 'write the entire page for gl_i=0 to 127 lookup gl_i,[$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00_ ],gl_k gosub WriteData NEXT gl_i return WriteCommand: RS = 0 'Set Register Select for Command RW = 0 'Set Read/Write for Write CS2 = 1 'Turn On Chip Select EOS = 1 'Bring Enable Operation Signal high D0 = gl_k.0 D1 = gl_k.1 D2 = gl_k.2 D3 = gl_k.3 D4 = gl_k.4 D5 = gl_k.5 D6 = gl_k.6 D7 = gl_k.7 EOS = 0 'Falling edge of Enable Operation Signal sets the datum CS2 = 0 'Unselect chip RW = 0 'Set Read/Write for Write return WriteData: RS = 1 'Set Register Select for Data RW=0 'Set Read/Write for Write CS2 = 1 'Turn On Chip Select EOS = 1 'Bring Enable Operation Signal high D0 = gl_k.0 D1 = gl_k.1 D2 = gl_k.2 D3 = gl_k.3 D4 = gl_k.4 D5 = gl_k.5 D6 = gl_k.6 D7 = gl_k.7 EOS = 0 'Falling edge of Enable Operation Signal sets the datum CS2 = 0 'Unselect chip RW=0 'Set Read/Write for Write return InitGLCD: RW=0 'Set Read/Write for Write RS = 0 'Set Register Select for Command RESETB = 1 'Bring out of Reset EOS=0 'make sure Enable Operation Signal is low Pause 22 gl_k = $A2 '1. Set to 1/9 bias. A2=162= 1010 0010 GOSUB WriteCommand gl_k = $A0 '2. ADC Select, Normal. A0=160=1010 0000 GOSUB WriteCommand gl_k = $C8 '3. COM Output reverse. C8=200= 1100 1000 GOSUB WriteCommand gl_k = $A4 '4. Display all points Normal. A4=164= 1010 0100 GOSUB WriteCommand gl_k = $40 '5. Display Start Line set to 0. 40=64=01 000000 GOSUB WriteCommand gl_k = $25 '6. Internal Resistor Ratio. $25=37=0010 0101 [$20-$27] GOSUB WriteCommand gl_k = $81 '7. Set Electronic Volume Mode. $81=129=1000 0001 GOSUB WriteCommand gl_k = $1A '8. Set Electronic Volume Value. $10=16=00 01 0000 GOSUB WriteCommand gl_k = $2F '9. Set Power Controller. $2F=47=0010 1111 GOSUB WriteCommand gl_k = $AF '10. Display On. $AF=175=1010 1111 GOSUB WriteCommand return '----------MAIN PROGRAM---------------------------------- Start: goto ShowScreen pause 5000 goto start end
I guess the moral to all this is that there is no substitute for reading (and reading and re-reading) the datasheet until it starts to make sense...
Best Regards,
Paul




Bookmarks