Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Library for ST7735R display
Goto page Previous  1, 2
 
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
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Thu May 02, 2019 9:00 am    Post subject: Reply with quote

thanks for this useful addition.
_________________
Mark
Back to top
View user's profile Visit poster's website
O-Family

Bascom Expert



Joined: 23 May 2010
Posts: 320
Location: Japan

japan.gif
PostPosted: Fri May 17, 2019 12:47 am    Post subject: 1.8inch 65K FullColorLCD 128x160dot [ST7735S] Reply with quote

The ST7735R library has been modified for a 1.8inch 128x160 dot LCD module.

Circuit diagram
https://drive.google.com/file/d/1c32gRYhuUFC-DsTAqnpYj25CDtQTkXEH/view?usp=sharing
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Sat May 18, 2019 9:51 am    Post subject: Reply with quote

thanks for this useful addition and sharing it.
_________________
Mark
Back to top
View user's profile Visit poster's website
O-Family

Bascom Expert



Joined: 23 May 2010
Posts: 320
Location: Japan

japan.gif
PostPosted: Tue Jan 05, 2021 1:57 am    Post subject: Reply with quote

The bug in the original [glcd-ST7735R.lib] was not fixed.
It does not work if A0=[DC] and Sclk=[SCK] are assigned to another port.
Please use the new library (libversion = 002).


Last edited by O-Family on Tue Jan 05, 2021 2:53 am; edited 1 time in total
Back to top
View user's profile Visit poster's website
O-Family

Bascom Expert



Joined: 23 May 2010
Posts: 320
Location: Japan

japan.gif
PostPosted: Tue Jan 05, 2021 2:52 am    Post subject: Reply with quote

The bug in the original [glcd-ST7735R.lib] was not fixed.
It does not work if A0=[DC] and Sclk=[SCK] are assigned to another port.
Please use the new library (libversion = 002).
Back to top
View user's profile Visit poster's website
Dave

Bascom Member



Joined: 05 Feb 2005
Posts: 314
Location: OR

usa.gif
PostPosted: Sat Oct 01, 2022 12:53 am    Post subject: Reply with quote

Thank you Mrshilov and O-Family for sharing these libs.

I'm using a O-Family ST7735S lib and I would like some help with fonts.

The color8x8.font work but I don't know how to create other fonts. I have tried font16x16.font and other fonts but they show as mixed up as seen in 16x16 pictured below.

My question is how do I create fonts for the ST7735S?






Code:

   '
   '  **************************************
   '  *  0.96inch 65K full color LCD test  *
   '  *      160 x 80 dot [ST7735S] SPI    *
   '  *        O-Family  2021. 1. 5        *
   '  **************************************
   '

$regfile = "m168def.dat"
$crystal = 8000000
$baud = 38400

$hwstack = 64
$swstack = 10
$framesize = 24

print version(3)

   '
   '  * Initial setting of G-LCD *
   '

$lib "glcd-ST7735S_160x80.lib"                              'Incorporate the ST7735S 160x80 library.
   'Designate the connection port of LCD. Cs1 = [CS] , A0 = [DC] , Rst = [RSE] , Si = [SDA] , Sclk = [SCL]
   'Config Graphlcd = Color , A0 = Portd.5 , Rst = Portd.6 , Si = Portd.4 , Sclk = Portd.7       '[Cs1] and [Rst] are optional.
Config Graphlcd = Color , A0 = Portd.5 , Cs1 = Portd.3, Rst = Portd.6 ,  Si = Portd.4 , Sclk = Portd.7

Const Portrait = 0         'LCD screen. (0: Landscape [X=160, Y=80], 1: Portrait [X=80, Y=160])
Const Rotate_180 = 1       'LCD screen 180 degree rotation. (0: connector Lower side, 1: connector Upper side)

Cls                        'Erase the entire screen of the G-LCD.

'For some reason, that I don't understand,
'my ST7735S colors are inverted.
Const White = &B0000_0000
Const Blue = &B1111_1100
Const Black = &B1111_1111
Const Magenta = &B0001_1100

'setfont Alpha_20p29x21
'setfont font16x16
Setfont Color8x8    'Only font that worked.

Lcdat 5 , 10 , "123" , blue , white
Lcdat 30 , 10 , "456" , Black , White
Lcdat 50 , 10 , "789" , Magenta , white

End

$include "color8x8.font"
'$include "font16x16.font"
'$include "Arial.font"
Back to top
View user's profile
O-Family

Bascom Expert



Joined: 23 May 2010
Posts: 320
Location: Japan

japan.gif
PostPosted: Sat Oct 01, 2022 8:16 am    Post subject: Reply with quote

Monochrome fonts and color fonts have different data alignments.
Please use [color16x16.font] in [Samples].

The post below has a converter that converts monochrome fonts to color fonts.
https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=13094&highlight=color+colour+font+converter
Back to top
View user's profile Visit poster's website
Dave

Bascom Member



Joined: 05 Feb 2005
Posts: 314
Location: OR

usa.gif
PostPosted: Sat Oct 01, 2022 4:44 pm    Post subject: Reply with quote

Thank you O-Family.
I now understand a little more about color fonts. From the post you linked to color fonts must be multiples of 8. So 8x8, 16x16 is ok but for example 10x12 would not work. Do I have that right? Or is that a limitation of your converter?
Back to top
View user's profile
O-Family

Bascom Expert



Joined: 23 May 2010
Posts: 320
Location: Japan

japan.gif
PostPosted: Sun Oct 02, 2022 2:21 am    Post subject: Reply with quote

This is because the original library only supports fonts that are multiples of 8 dots.
Color LCDs take a long time to draw, so I think this is to simplify the coordinate calculation even a little to increase the drawing speed.
Back to top
View user's profile Visit poster's website
Dave

Bascom Member



Joined: 05 Feb 2005
Posts: 314
Location: OR

usa.gif
PostPosted: Tue Jan 10, 2023 4:49 am    Post subject: Reply with quote

Hello Mrshilov & O-Family,

I'm having a problem compiling for ATxmega32e5 part. I get the same error that enniom reported.
Error : 221 Line : 219 Backward jump out of range [_CLEAR_GRAPH1 [ 86]] , in File :...
I've tried all versions and I get the same error. What am I doing wrong? Here is example code:

Code:
$crystal = 32000000
$regfile = "xm32E5def.dat"
$hwstack = 100
$swstack = 100
$framesize = 100
$lib "xmega.lib"
CONFIG SUBMODE = NEW

Config Osc = Disabled , 32mhzosc = Enabled

Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1  ' we will use 32 MHz and divide by 1 to end up with 32 MHz
Config Priority = Static , Vector = Application , Lo = Disabled , Med = Enabled , Hi = Disabled

   '
   '  * Initial setting of G-LCD *
   '
Const Portrait = 0                                       'LCD screen. (0: Landscape [X=160, Y=128], 1: Portrait [X=128, Y=160])
Const Rotate_180 = 1                                     'LCD screen 180 degree rotation. (0: connector Upper side, 1: connector Lower side)
$lib "glcd-ST7735S_1R8_128x160.lib"                      'Incorporate the ST7735S 1.8inch 128x160 library.
'$lib "glcd-ST7735R.lib"

Config Graphlcd = Color , Cs1 = Portd.0 , Rst = Portd.6 , A0 = Portd.7 , Si = Portd.5 , Sclk = Portd.4      '[Cs1] and [Rst] are optional.
Initlcd
Cls

end

'Both Libs above gererate this error.
'Error : 221   Line :   219   Backward jump out of range [_CLEAR_GRAPH1 [ 86]]  , in File : C:\MCS\BASCAVR2085\LIB\GLCD-ST7735R.LIB
'Error : 221   Line :   219   Backward jump out of range [_CLEAR_GRAPH1 [ 86]]  , in File : C:\MCS\BASCAVR2085\LIB\GLCD-ST7735S_1R8_128X160.LIB
 


Thanks,
Dave
Back to top
View user's profile
O-Family

Bascom Expert



Joined: 23 May 2010
Posts: 320
Location: Japan

japan.gif
PostPosted: Tue Jan 10, 2023 6:48 am    Post subject: Reply with quote

Please wait a moment as the library needs to be modified for Xmega.
Back to top
View user's profile Visit poster's website
Dave

Bascom Member



Joined: 05 Feb 2005
Posts: 314
Location: OR

usa.gif
PostPosted: Tue Jan 10, 2023 8:31 pm    Post subject: Reply with quote

Thank you.

I just noticed from help that the E5 series virtual ports are fixed.
Quote:
noticeSome processors like the ones from the E5 series have a fixed relation. These chips have virtual port registers (port,ddr,pin) and do not need a CONFIG VPORT).For the E5 this relation is :

PORT0 - Virtual port A

PORT1 - Virtual port C

PORT2 - Virtual port D

PORT3 - Virtual port R


Could that be the problem?
Back to top
View user's profile
O-Family

Bascom Expert



Joined: 23 May 2010
Posts: 320
Location: Japan

japan.gif
PostPosted: Wed Jan 11, 2023 12:30 am    Post subject: Reply with quote

Fixed the library for Xmega. [revision 004]
please try it.
Back to top
View user's profile Visit poster's website
Dave

Bascom Member



Joined: 05 Feb 2005
Posts: 314
Location: OR

usa.gif
PostPosted: Wed Jan 11, 2023 1:28 am    Post subject: Reply with quote

Yes it works great. Thank you!
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 Previous  1, 2
Page 2 of 2

 
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