Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Proportional Fonts for GLCDs + TrueType Converter
Goto page Previous  1, 2, 3
 
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
mariosm

Bascom Member



Joined: 12 Oct 2005
Posts: 48
Location: Thessaloniki

greece.gif
PostPosted: Thu May 27, 2021 11:54 am    Post subject: Reply with quote

Thank you Netzman for your answer.
I have made the changes and now i have one error.

Error : 93 Line : 46 Variable not dimensioned [___READRAMPZ] , in File : ProportionalFont.inc
I do not know what to do about this error.

Quote:
Do you have a working basic sample without using the proportional fonts library?


I have written my project with libraries from this link
https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&p=73362#73362
All is OK but now i don't want SPI connection.


I have used library for this link
https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=13804&postdays=0&postorder=asc&highlight=st7735&start=15
This library use "Config Graphlcd" command but i have problem with font files. I can use only 8x8, 16x16 fonts. Τhis has a bad appearance on display. Any other font files from many converters don't work.

_________________
Bascom AVR ver 2.0.8.5 full version
Back to top
View user's profile
Netzman

Bascom Expert



Joined: 25 Nov 2005
Posts: 131
Location: Graz

austria.gif
PostPosted: Mon May 31, 2021 9:17 pm    Post subject: Reply with quote

Hello,

the RAMPZ register shouldn't be there in the first place since it is a device with 64K of memory. In fact, in the datasheet, the memory address 0x3B (=RAMPZ) is marked as reserved and the errata says, RAMPZ has been removed.
So I guess that just stuck when Mark derived the dat file for this processor.

I've adjusted the font library and compiled it with o-family's glcd-ST7735S_1R8_128x160 driver, see the attachment.

br

_________________
LCD Menu | Proportional Fonts
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5922
Location: Holland

blank.gif
PostPosted: Tue Jun 01, 2021 9:23 am    Post subject: Reply with quote

the RAMPZ is not used when the flash code is 64KB.
At least, not by bascom.
In libs you find code that checks the romsize. Only when it exceeds 64KB it will use rampz.
When this gives problems in user libs, you can simply remark the rampz in the DAT file.

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

Bascom Member



Joined: 12 Oct 2005
Posts: 48
Location: Thessaloniki

greece.gif
PostPosted: Tue Jun 01, 2021 12:11 pm    Post subject: Reply with quote

Thank you again Netzman for your answer.

I used your new files for test.
Τhe result is very good but i have a problem.
The first character of every string is broken.
I also tried different font files with the same problem.

[img][/img]

_________________
Bascom AVR ver 2.0.8.5 full version
Back to top
View user's profile
Netzman

Bascom Expert



Joined: 25 Nov 2005
Posts: 131
Location: Graz

austria.gif
PostPosted: Wed Jun 02, 2021 9:32 pm    Post subject: Reply with quote

I can't reproduce this behaviour, could you upload a complete sample (incl. fonts) which shows that?

Thank you for the explanation, Mark! I resorted to use _huge, which is 0 when the program size is <= 64K and use LPM/ELPM respectively.

thx, br

_________________
LCD Menu | Proportional Fonts
Back to top
View user's profile Visit poster's website
mariosm

Bascom Member



Joined: 12 Oct 2005
Posts: 48
Location: Thessaloniki

greece.gif
PostPosted: Thu Jun 03, 2021 10:13 am    Post subject: Reply with quote

Thank you again Netzman for your answer.

On attachment you will find the files you need.

I created many different font files with Bascom True Type Font Converter 1.4, but I have the same problem.

_________________
Bascom AVR ver 2.0.8.5 full version
Back to top
View user's profile
Netzman

Bascom Expert



Joined: 25 Nov 2005
Posts: 131
Location: Graz

austria.gif
PostPosted: Sun Jun 06, 2021 12:28 am    Post subject: Reply with quote

In the Pset-Routine resp. the _convert_color1 routine called from there the memory positions in the softstack Y+5 and Y+6 get trashed, which contains the pointers to the frame space for local variables.
I don't think this is intended behaviour, maybe o-family can help there.

This saves/restores the memory positions prior/post calling Pset as a temporary fix (in ProportionalFont.inc, line 193):
Code:
                     ' ### OTHER DISPLAYS ###
                     !push R10                              ' save registers used in the font loop,
                     !push R11                              ' they could also be used in the external set pixel routine
                     !push R12
                     !push R13

                     !ld R24, Y+5
                     !push R24
                     !ld R24, Y+6
                     !push R24

                     Pset Xpos , Y , Forecolor              ' or any other set pixel routine

                     !pop R24
                     !st Y+6, R24
                     !pop R24
                     !st Y+5, R24

                     !pop R13
                     !pop R12
                     !pop R11
                     !pop R10
                     ' ######################

(tested in the simulator)

br

_________________
LCD Menu | Proportional Fonts
Back to top
View user's profile Visit poster's website
mariosm

Bascom Member



Joined: 12 Oct 2005
Posts: 48
Location: Thessaloniki

greece.gif
PostPosted: Wed Jan 05, 2022 12:55 pm    Post subject: Reply with quote

Netzman wrote:
In the Pset-Routine resp. the _convert_color1 routine called from there the memory positions in the softstack Y+5 and Y+6 get trashed, which contains the pointers to the frame space for local variables.
I don't think this is intended behaviour, maybe o-family can help there.

This saves/restores the memory positions prior/post calling Pset as a temporary fix (in ProportionalFont.inc, line 193):
Code:
                     ' ### OTHER DISPLAYS ###
                     !push R10                              ' save registers used in the font loop,
                     !push R11                              ' they could also be used in the external set pixel routine
                     !push R12
                     !push R13

                     !ld R24, Y+5
                     !push R24
                     !ld R24, Y+6
                     !push R24

                     Pset Xpos , Y , Forecolor              ' or any other set pixel routine

                     !pop R24
                     !st Y+6, R24
                     !pop R24
                     !st Y+5, R24

                     !pop R13
                     !pop R12
                     !pop R11
                     !pop R10
                     ' ######################

(tested in the simulator)

br


After a long time with health problems I have returned to thank Netzman for the answer.
All characters is OK but now I am confused with other problem.
How can I replace a letter of a word with a new one without use CLS command?
Now the new letter is printed on the old one with Lcd_tt_text command.

_________________
Bascom AVR ver 2.0.8.5 full version
Back to top
View user's profile
Netzman

Bascom Expert



Joined: 25 Nov 2005
Posts: 131
Location: Graz

austria.gif
PostPosted: Thu Jan 06, 2022 12:54 am    Post subject: Reply with quote

Good to hear you've recovered.
There are several possibilities, you could draw a rectangle using the background color over the text (the function Lcd_tt_textwidth(byval Text As String) As Word returns the width of the text using the currently selected font, the variable Lcd_tt_fontheight As Byte contains the height), you could write the same text again on the same position using the background color, draw an image or other graphics over the text, depends on your use case.

br

_________________
LCD Menu | Proportional Fonts
Back to top
View user's profile Visit poster's website
mariosm

Bascom Member



Joined: 12 Oct 2005
Posts: 48
Location: Thessaloniki

greece.gif
PostPosted: Thu Jan 06, 2022 12:15 pm    Post subject: Reply with quote

Netzman wrote:
Good to hear you've recovered.
There are several possibilities, you could draw a rectangle using the background color over the text (the function Lcd_tt_textwidth(byval Text As String) As Word returns the width of the text using the currently selected font, the variable Lcd_tt_fontheight As Byte contains the height), you could write the same text again on the same position using the background color, draw an image or other graphics over the text, depends on your use case.

br


Thank you Netzman
I write the same text again and this is OK.

I have two more questions (I hope the last questions Rolling Eyes )

How can I change the background color?
How can I draw graffics (circle, square etc.)?

Is there any sample code?

_________________
Bascom AVR ver 2.0.8.5 full version
Back to top
View user's profile
Netzman

Bascom Expert



Joined: 25 Nov 2005
Posts: 131
Location: Graz

austria.gif
PostPosted: Thu Jan 06, 2022 6:40 pm    Post subject: Reply with quote

Since the font routines don't handle any background at all, it is up to you to define that (by drawing a rectangle with your background color before writing the text over it, draw an image etc), which gives you more design freedom.
Which graphics functions you can use depends on the display library, o-family's glcd-ST7735S_1R8_128x160 driver redefines Bascom's internal graphics functions so you could use Bascom's graphics commands: https://avrhelp.mcselec.com/index.html?lcd_commands.htm
But keep in mind the _convert_color1 routine is called from every graphics command,which alters the soft stack, so be carefull when using graphics functions from within a sub/function.

There is a sample included with my ILI9341 lcd library, which also covers the usage of the font routines: https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=12893
The graphics library you use hooks into Bascom's graphics commands, therefore also the samples supplied with Bascom apply here.

br

_________________
LCD Menu | Proportional Fonts
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 Jan 07, 2022 4:49 am    Post subject: Reply with quote

I received an email from the questioner, so I looked it up.

[glcd-ST7735S_1R8_128x160.lib] is a modification of the library created by "Mrshilov" in 2017.
The original library doesn't seem to expect this library to be called while using local variables.
It will take some time to fix.
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: Sat Jan 08, 2022 1:46 am    Post subject: Reply with quote

I fixed it in an easy way.
Please test with this.
Back to top
View user's profile Visit poster's website
svberg

Bascom Member



Joined: 07 Nov 2011
Posts: 48

blank.gif
PostPosted: Mon Aug 29, 2022 10:49 pm    Post subject: Reply with quote

Hi.
This looks great, but download links not working.
Anyone have a working link, or a copy of the files??
Best regards svein
Back to top
View user's profile
Netzman

Bascom Expert



Joined: 25 Nov 2005
Posts: 131
Location: Graz

austria.gif
PostPosted: Tue Aug 30, 2022 11:06 am    Post subject: Reply with quote

it's working fine for me here, could you try again?
_________________
LCD Menu | Proportional Fonts
Back to top
View user's profile Visit poster's website
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, 3
Page 3 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