View previous topic :: View next topic |
Author |
Message |
mariosm
Joined: 12 Oct 2005 Posts: 48 Location: Thessaloniki
|
|
Back to top |
|
|
Netzman
Joined: 25 Nov 2005 Posts: 127 Location: Graz
|
Posted: Mon May 31, 2021 9:17 pm Post subject: |
|
|
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 |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Tue Jun 01, 2021 9:23 am Post subject: |
|
|
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 |
|
|
mariosm
Joined: 12 Oct 2005 Posts: 48 Location: Thessaloniki
|
Posted: Tue Jun 01, 2021 12:11 pm Post subject: |
|
|
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 |
|
|
Netzman
Joined: 25 Nov 2005 Posts: 127 Location: Graz
|
Posted: Wed Jun 02, 2021 9:32 pm Post subject: |
|
|
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 |
|
|
mariosm
Joined: 12 Oct 2005 Posts: 48 Location: Thessaloniki
|
Posted: Thu Jun 03, 2021 10:13 am Post subject: |
|
|
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 |
|
|
Netzman
Joined: 25 Nov 2005 Posts: 127 Location: Graz
|
Posted: Sun Jun 06, 2021 12:28 am Post subject: |
|
|
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 |
|
|
mariosm
Joined: 12 Oct 2005 Posts: 48 Location: Thessaloniki
|
Posted: Wed Jan 05, 2022 12:55 pm Post subject: |
|
|
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 |
|
|
Netzman
Joined: 25 Nov 2005 Posts: 127 Location: Graz
|
Posted: Thu Jan 06, 2022 12:54 am Post subject: |
|
|
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 |
|
|
mariosm
Joined: 12 Oct 2005 Posts: 48 Location: Thessaloniki
|
Posted: Thu Jan 06, 2022 12:15 pm Post subject: |
|
|
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 )
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 |
|
|
Netzman
Joined: 25 Nov 2005 Posts: 127 Location: Graz
|
Posted: Thu Jan 06, 2022 6:40 pm Post subject: |
|
|
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 |
|
|
O-Family
Joined: 23 May 2010 Posts: 320 Location: Japan
|
Posted: Fri Jan 07, 2022 4:49 am Post subject: |
|
|
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 |
|
|
O-Family
Joined: 23 May 2010 Posts: 320 Location: Japan
|
Posted: Sat Jan 08, 2022 1:46 am Post subject: |
|
|
I fixed it in an easy way.
Please test with this. |
|
Back to top |
|
|
svberg
Joined: 07 Nov 2011 Posts: 48
|
Posted: Mon Aug 29, 2022 10:49 pm Post subject: |
|
|
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 |
|
|
Netzman
Joined: 25 Nov 2005 Posts: 127 Location: Graz
|
Posted: Tue Aug 30, 2022 11:06 am Post subject: |
|
|
it's working fine for me here, could you try again? _________________ LCD Menu | Proportional Fonts |
|
Back to top |
|
|
|