Thank you Mrshilov and everyone else for sharing your hard work! This library is great, much faster than previous examples. I am running an [url=http://www.buydisplay.com/default/7-tft-screen-touch-lcd-display-module-w-ssd1963-controller-board-mcu.html]ER-TFTM070-4[/url] display on ATMega645A @ 16MHz. I swapped Mrshilov's initialization values for my own (based on the sample code provided by the manufacturer) and it works well with one problem:
Display is upside down and color is in BGR mode, but control register [b:2fc0418f06]Set Address Mode 36h[/b:2fc0418f06] has no effect on the screen! In my old routine I can change [b:2fc0418f06]Set Address Mode 36h[/b:2fc0418f06] to flip display in any orientation and change the color mode. With Mrshilov's routine, no change! Only difference I can tell is Mrshilov uses submode=new while my working routine uses old submode.
I could fix this by flipping the screen around and changing the color constants to BGR, but that feels like a hack job :P. Does anyone have some insight?
Thanks again for sharing.
[code:1:2fc0418f06]'-------------------------------------------------------------------------------
' Init display
'-------------------------------------------------------------------------------
Sub Display_init
Res_disp = 0 : Waitms 25 : Res_disp = 1 'Hardware Reset
Ssd1963_select_reg &H01 'Software reset
Waitms 10
Ssd1963_select_reg &HE2 'PLL multiplier, set PLL clock to 120M
Ssd1963_write_data &H0023 'N=0x36 for 6.5M, 0x23 for 10M crystal
Ssd1963_write_data &H0002
Ssd1963_write_data &H0004
Ssd1963_select_reg &HE0
Ssd1963_write_data &H01 'start PLL
Waitms 1
Ssd1963_select_reg &HE0
Ssd1963_write_data &H03 'LOCK PLL
Waitms 5
Ssd1963_select_reg &H01 'Software reset
Waitms 10
Ssd1963_select_reg &HE6 'Set PCLK Pixel Clock frequency
Ssd1963_write_data &H03
Ssd1963_write_data &H33
Ssd1963_write_data &H33
Ssd1963_select_reg &HB0 'Set the LCD panel mode (RGB TFT or TTL)
Ssd1963_write_data &H20
Ssd1963_write_data &H00
Ssd1963_write_data &H03 'horizontal size 799 high Byte
Ssd1963_write_data &H1F 'horizontal size 799 low Byte
Ssd1963_write_data &H01 'vertical size 479 high Byte
Ssd1963_write_data &HDF 'vertical size 479 low Byte
Ssd1963_write_data &H00 'RGB
'Ssd1963_write_data &H2D 'BGR
Ssd1963_select_reg &HB4 'Set Horizontal Period B4
Ssd1963_write_data &H04 'High byte of horizontal total period (display + non-display) in pixel clock HT
Ssd1963_write_data &H1F 'Low byte of the horizontal total period (display + non-display) in pixel clock HT
Ssd1963_write_data &H00 'High byte of the non-display period between the start of the horizontal sync (LLINE) HPS
Ssd1963_write_data &HD2 'Low byte of the non-display period between the start of the horizontal sync (LLINE) HPS
Ssd1963_write_data &H00 'Set the horizontal sync pulse width (LLINE) in pixel clock. Width = (HPW + 1) pixels
Ssd1963_write_data &H00
Ssd1963_write_data &H00
Ssd1963_write_data &H00
Ssd1963_select_reg &HB6 'vsync
Ssd1963_write_data &H02 'set vt
Ssd1963_write_data &H0C
Ssd1963_write_data &H00 'set vps
Ssd1963_write_data &H22
Ssd1963_write_data &H00 'set vpw
Ssd1963_write_data &H00 'set fps
Ssd1963_write_data &H00
Ssd1963_select_reg &HB8 'GPIO Configuration
Ssd1963_write_data &H0F 'GPIO is controlled by host GPIO[3:0]=output GPIO[0]=1 LCD ON GPIO[0]=1 LCD OFF
Ssd1963_write_data &H01 'GPIO0 normal
Ssd1963_select_reg &HBA
Ssd1963_write_data &H01 'GPIO[0] out 1 --- LCD display on/off control PIN
Ssd1963_select_reg &H36 'Set the read order from frame buffer to the display panel
Ssd1963_write_data &H09 'BGR
Ssd1963_select_reg &H3A 'RGB Format 565
Ssd1963_write_data &H50
Ssd1963_select_reg &HF0
Ssd1963_write_data &H03 'Set Pixel data format 16Bit
Ssd1963_select_reg &HBC 'Post Processor
Ssd1963_write_data &H40 'contrast
Ssd1963_write_data &H40 'brightness
Ssd1963_write_data &H40 'saturation
Ssd1963_write_data &H01 'enable/disable
Waitms 5
Ssd1963_select_reg &H29 'Display ON
Ssd1963_select_reg &HBE 'Set PWM for B/L
Ssd1963_write_data &H06
Ssd1963_write_data &H80
Ssd1963_write_data &H01
Ssd1963_write_data &HF0
Ssd1963_write_data &H00
Ssd1963_write_data &H00
Ssd1963_select_reg &HD0 'Set DynamicBacklightControl Configuration
Ssd1963_write_data &H0D
End Sub[/code:1:2fc0418f06]
↧