freeskier89
New Member
Hello,
I am writing some assembly to control a LCD with a SSD1339 controller with a 8bit 6800 parallel interface. The timing diagram for the communication is here on page 56.
(Datasheet: https://www.electro-tech-online.com/custompdfs/2007/05/SSD1339_17.pdf)
I have looked through the datasheet and it looks pretty straight forward, but I can't seem to get the LCD to turn on. Early in the datasheet it said that it uses the Enable pin as a latch for the data, but the timing suggests that it is CS# instead? Here are the essential elements for the LCD that I have written:
I'm quite sure that I have the hardware end hooked up correctly and it is something slightly wrong with my code. My guess is that it is either the way I am setting the control pins for writing to the LCD or the initialization parameters. I would be deeply grateful if anyone could lend some expertise!
Edit: There isn't anyway to remap a port in MPLAB is there? That would be a nice software feature to have (to take literals and rearrange them).
I am writing some assembly to control a LCD with a SSD1339 controller with a 8bit 6800 parallel interface. The timing diagram for the communication is here on page 56.
(Datasheet: https://www.electro-tech-online.com/custompdfs/2007/05/SSD1339_17.pdf)
I have looked through the datasheet and it looks pretty straight forward, but I can't seem to get the LCD to turn on. Early in the datasheet it said that it uses the Enable pin as a latch for the data, but the timing suggests that it is CS# instead? Here are the essential elements for the LCD that I have written:
Code:
LCD_C MACRO X
MOVLW X
CALL LCD_WriteCommand
ENDM
LCD_D MACRO X
MOVLW X
CALL LCD_WriteData
ENDM
LCD_WriteData
BSF port_lcdctrl,lcd_DC
CALL LCD_WriteByte
RETURN
LCD_WriteCommand
BCF port_lcdctrl,lcd_DC
CALL LCD_WriteByte
RETURN
LCD_WriteByte
;This is a mess... I hooked up the D7 to D0 (mcu) backwards to the LCD
;hence I have to reverse the order of the byte.
;TODO: THINK OF A MORE EFFICIENT WAY OF DOING THIS!
MOVWF lcd_buffer
CLRF lcd_buffer1
BTFSC lcd_buffer, 0
BSF lcd_buffer1, 7
BTFSC lcd_buffer, 1
BSF lcd_buffer1, 6
BTFSC lcd_buffer, 2
BSF lcd_buffer1, 5
BTFSC lcd_buffer, 3
BSF lcd_buffer1, 4
BTFSC lcd_buffer, 4
BSF lcd_buffer1, 3
BTFSC lcd_buffer, 5
BSF lcd_buffer1, 2
BTFSC lcd_buffer, 6
BSF lcd_buffer1, 1
BTFSC lcd_buffer, 7
BSF lcd_buffer1, 0
;make sure reset is high (not resetting). I have heard that some
;people have troubles with pins randomly falling low.
BSF port_lcdctrl, lcd_RES
; Move Byte onto portD
MOVF lcd_buffer1, w
MOVWF port_lcddata
BSF port_lcdctrl, lcd_E
BCF port_lcdctrl,lcd_Rw
BCF port_lcdctrl, lcd_CS
CALL DLYMS
BSF port_lcdctrl, lcd_CS
CALL DLYMS
BCF port_lcdctrl,lcd_E
BSF port_lcdctrl,lcd_Rw
BSF port_lcdctrl,lcd_DC
RETURN
LCD_Init
CLRF port_lcddata
BSF port_lcdctrl, lcd_E
BCF port_lcdctrl, lcd_DC
BCF port_lcdctrl,lcd_Rw
CALL LCD_Reset
LCD_C h'A0'
LCD_D b'01100000' ;Configure color settings
LCD_C h'A1'
LCD_D 00h ;Set display start line
LCD_C h'A2'
LCD_D 0 ;Set offset
LCD_C h'A6';Set to normal display
LCD_C h'AD'
LCD_D h'8E' ;Set VCOMH source
LCD_C h'B0'
LCD_D b'00000101'
; // Set pre & dis_charge
; // pre=1h dis=1h
LCD_C h'B1'
LCD_D h'11'
; // clock & frequency
; // clock=Divser+1 frequency=fh
LCD_C h'B3'
LCD_D h'F0'
; // Set pre-charge voltage of color A B C
; // color A
; // color B
; // color C
LCD_C h'BB'
LCD_D h'1C'
LCD_D h'1C'
LCD_D h'1C'
; // Set VcomH
; //
LCD_C h'BE'
LCD_D h'1F'
; // Set contrast current for A B C
; // Color A
; // Color B
; // Color C
LCD_C h'C1'
LCD_D h'AA'
LCD_D h'B4'
LCD_D h'C8'
; // Set master contrast
; // no change
LCD_C h'C7'
LCD_D h'0F'
; // Duty
; // 127+1
LCD_C h'CA'
LCD_D h'7F'
; // Display on
LCD_C h'AF'
RETURN
Edit: There isn't anyway to remap a port in MPLAB is there? That would be a nice software feature to have (to take literals and rearrange them).
Last edited: