Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Fast library for SSD1963 LCD
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> Share your working BASCOM-AVR code here
View previous topic :: View next topic  
Author Message
Mrshilov

Bascom LCD Guru



Joined: 24 Jan 2009
Posts: 314
Location: Russia

russia.gif
PostPosted: Mon Feb 03, 2014 2:09 am    Post subject: Fast library for SSD1963 LCD Reply with quote

Library for SSD1963 LCD with 16-bit interface:
[/URL]
LCD is 3/5V compliant.
Library works in Submode = New, so its very easy to include in project and unused Subs are not compiled to save memory space.
Also to save space you may use reduced Fonts, like Font36x56 in example. It has only digits, placed at position 33...42. To correct this shift simply use Digit_font = 1.
Any Fons may be included via $include. Supports both types of BASCOM Fonts - "Color" and "B&W".
You can display 8-bit (BGC) and 16 bit (BIN) pictures. Also 16 bit pictures can be loaded from SPI-Flash ROM. To prepare bin-file from bmp, gif, jpg, wmf, emf, ico I wrote special program Pic2Bin.

Library is fast. I specially made it to work quickly. In this video test program working at 8MHz. However, display resolution is 800x480 and its better to use 16MHz or 32MHz (Atxmega).
Video - http://youtu.be/U9kgDOa79MY
Based on Mr.Six1 sources.
Back to top
View user's profile
enniom

Bascom Member



Joined: 20 Oct 2009
Posts: 537

PostPosted: Wed Feb 05, 2014 5:48 am    Post subject: Reply with quote

Thank you MrShilov for your hard work and sharing the Bascom code for the SSD1963 color display.

I have not programmed color displays with XMega chips.

1. Do you have an idea of how difficult it would be to modify the code posted here to work on XMega?
2. Would the touch-screen routines be similar to the ones posted for the SSD1289 display?

Any help or advice you have would be greatly appreciated. Based on your (or others) feedback, I will decide to purchase additional XMega chips.
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5920
Location: Holland

blank.gif
PostPosted: Wed Feb 05, 2014 8:06 am    Post subject: Reply with quote

well done ! This is a big display ! And it still works smooth. Love the YT videos Very Happy
I had no idea there were so many different graphical chips. Keep up the great work.

_________________
Mark
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5920
Location: Holland

blank.gif
PostPosted: Wed Feb 05, 2014 8:09 am    Post subject: Reply with quote

this code need small adjustments for xmega.
For example :
Dim Color_h_ssd1963 As Iram Byte At 22
Dim Color_l_ssd1963 As Iram Byte At 21

These are registers R21 and R22. The xmega can not linear address these registers. But you can use bascom SETREG statement. Or use some asm with STS.

_________________
Mark
Back to top
View user's profile Visit poster's website
Mrshilov

Bascom LCD Guru



Joined: 24 Jan 2009
Posts: 314
Location: Russia

russia.gif
PostPosted: Wed Feb 05, 2014 4:15 pm    Post subject: Reply with quote

enniom wrote:

1. Do you have an idea of how difficult it would be to modify the code posted here to work on XMega?

As Mark say, "this code need small adjustments". The simplest way is to change:
Dim Color_h_ssd1963 As Iram Byte At 22
Dim Color_l_ssd1963 As Iram Byte At 21
to:
Dim Color_h_ssd1963
Dim Color_l_ssd1963


enniom wrote:
2. Would the touch-screen routines be similar to the ones posted for the SSD1289 display?

SSD1289 and SSD1963 displays use the same touch chips XPT2046. So routines is compatible, but need to correct X and Y coefficients due to screen size.
Back to top
View user's profile
Evert :-)

Bascom Expert



Joined: 18 Feb 2005
Posts: 2156

netherlands.gif
PostPosted: Wed Feb 05, 2014 9:25 pm    Post subject: Reply with quote

Always nice to see that big parts of my code is re-used.

Thanks for sharing your code.

_________________
www.evertdekker.com Bascom code vault
Back to top
View user's profile Visit poster's website
sasha_1973

Bascom Member



Joined: 30 Jul 2013
Posts: 58

ukraine.gif
PostPosted: Fri Feb 07, 2014 2:16 am    Post subject: Reply with quote



Last edited by sasha_1973 on Tue Nov 04, 2014 10:10 pm; edited 3 times in total
Back to top
View user's profile
Evert :-)

Bascom Expert



Joined: 18 Feb 2005
Posts: 2156

netherlands.gif
PostPosted: Fri Feb 07, 2014 12:30 pm    Post subject: Reply with quote

Sorry i can't read that, i'm not that good in my Russian.

It was meant as compliment, i'm glad that a lot of people using (parts) of my code and share the code that they made also with the Bascom community.

_________________
www.evertdekker.com Bascom code vault
Back to top
View user's profile Visit poster's website
sasha_1973

Bascom Member



Joined: 30 Jul 2013
Posts: 58

ukraine.gif
PostPosted: Fri Feb 07, 2014 3:15 pm    Post subject: Reply with quote



Last edited by sasha_1973 on Tue Nov 04, 2014 10:09 pm; edited 1 time in total
Back to top
View user's profile
Evert :-)

Bascom Expert



Joined: 18 Feb 2005
Posts: 2156

netherlands.gif
PostPosted: Fri Feb 07, 2014 4:34 pm    Post subject: Reply with quote

Link works fine, check your browser settings or use a other browser.
_________________
www.evertdekker.com Bascom code vault
Back to top
View user's profile Visit poster's website
sasha_1973

Bascom Member



Joined: 30 Jul 2013
Posts: 58

ukraine.gif
PostPosted: Fri Feb 07, 2014 5:51 pm    Post subject: Reply with quote



Last edited by sasha_1973 on Tue Nov 04, 2014 10:08 pm; edited 2 times in total
Back to top
View user's profile
GrainyPCB

Bascom Member



Joined: 30 Jan 2013
Posts: 12
Location: Cincinnati, OH

usa.gif
PostPosted: Mon Feb 17, 2014 10:09 pm    Post subject: Reply with quote

Thank you Mrshilov and everyone else for sharing your hard work! This library is great, much faster than previous examples. I am running an ER-TFTM070-4 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 Set Address Mode 36h has no effect on the screen! In my old routine I can change Set Address Mode 36h 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 Razz. Does anyone have some insight?

Thanks again for sharing.

Code:
'-------------------------------------------------------------------------------
' 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
Back to top
View user's profile
enniom

Bascom Member



Joined: 20 Oct 2009
Posts: 537

PostPosted: Fri Feb 21, 2014 3:15 am    Post subject: Reply with quote

Hello Mark, MrShilov, GrainyPCB, (and others)

Trying to make the SSD1963 (480x272) LCD work with a XMEGA192A3 using the library INC file posted by MrShilov.

After spending quite some time, I cannot see any function on the LCD.

The pin-out for the LCD and my modifications to the library to accommodate the XMEGA are attached.

Any help or suggestions would be greatly appreciated - and also what to do with pins F_CS and REST.

Ennio
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5920
Location: Holland

blank.gif
PostPosted: Fri Feb 21, 2014 10:22 am    Post subject: Reply with quote

try to use some other port than portA. i have pulled some hairs a week ago when doing an oled driver. the odd thing was that porta worked, and that i could toggle all pins, but that for some reason it did not work as normal. had no time to check on that, but using another port worked out fine.
further i can recommend to use a virtual port for these signals. config vport. for data this is not required but for control signals it is best.

if that does not work, i can have a look at the code.

_________________
Mark
Back to top
View user's profile Visit poster's website
enniom

Bascom Member



Joined: 20 Oct 2009
Posts: 537

PostPosted: Fri Feb 21, 2014 3:11 pm    Post subject: Reply with quote

Hello Mark,

Somewhere between your advice NOT to use PORTA, re-reading MAK3's AN#192 for Virtual Ports and comparing my code to that of the WIKI 7 Inch SSD1963 Display, I now have the display working.

But, as pointed out by GrainyPCB, my display too shows text to be upside-down/backwards. Maybe these are Chinese right-to-left displays??? ;)

Thanks for your help and motivation.

Ennio
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> Share your working BASCOM-AVR code here All times are GMT + 1 Hour
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum