Hello,
I'm driving a SSD1306 0.96" I2C 128X64 OLED Display Module with a PIC16F18326 in GLCD_TYPE_SSD1306_CHARACTER_MODE_ONLY
GCB SynWrite 6.22.2290 version.txt says "12/06/2019:v0.98.06"
The glcd.h file is dated 5/8/2019 8:35 AM
Large font works fine. (GLCDfntDefaultsize = 2)
In the small font (GLCDfntDefaultsize = 1) the "space" charactor 0x20 doesn't appear write the entire font block or cell, only the leftmost vertical column.
When a charactor ("W" for example) is written, then overwritten with a space charactor, only the upper left pixel of the "W" is blanked. With the "X" charactor, only the upper and lower left pixels are blanked.
The GCB command used for writing charactors is "GLCDDrawChar_SSD1306(xposition, yposition, "X", 1 )"
Sample code is attached.
I've stared at the font tables in the .h files but don't understand the organization of the pixels in the tables.
Jim - we should get you on the very latest GLCD drivers. This may already have the fix. We are pretty close to a release and I can release for this issue.
Wopuld that work for you?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Jim, never noticed that because I never messed with fonts and ony used SSD1306 as is as the full display with 1K buffer so use uno or nano or anything with enough ram.
I think it's a nice display. Anobioum wrote the include and added graphic commands to read a pixel was on or off...and use xor graphics.
Get a pic with some ram...or a cheap uno..and see what it can do.
I could not find the char 32 ie space in glcd lib problem.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I agree, the little OLED displays are sweet. I have driven them with Raspberry Pi and Python libraries and am familiar with their more advanced capabilities. For this project I can't redefine the enviornment or throw more horsepower at the display, so it will be nice having a fix for the only bug I have encountered. The text only mode is fine for this application, and I can likely find a workaround if necessary.
Thanks, Jim
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have no Idea where the data for text chars is kept or if it's scaled for size. Maybe Anobium could advice for like creating new chars ie change "T" to be a smiley...for example.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Jim and I will resolve offline, but, the fonts (as these are OLED fonts) are held in two tables. These two tables use different methods to create the bitmap of the character.
My guess. I have over looked a use case where the space is not incrementing the XPosition.... this is a guess until I look at the issue.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Jim and I will resolve offline, but, the fonts (as these are OLED fonts) are held in two tables. These two tables use different methods to create the bitmap of the character.
My guess. I have over looked a use case where the space is not incrementing the XPosition.... this is a guess until I look at the issue.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Font Table – looks correct as follows, see the second section for definition of the issue.
Section 1
We are using OLED FONT1.
OLED FONT1 is a variable font width. This is called proportional font (not a FIXED width font, the old GCB font is FIXED width)
OLED FONT1 uses tables OLEDFont1Index and OLEDFont1Data.
Where OLEDFont1Index is a pointer to OLEDFont1Data. OLEDFont1Data hold the bitmap data.
If we look at "X" to start with.
Line 6440 in GLCD.H
5 cols wide
Bitmap is 0x42, 0x24, 0x18, 0x24, 0x42 for "X"
So, if you draw an 8*5 matrix of the pixels would be as follows. This shows the Hex values.
Col 1 2 3 4 5
Row X _ _ _ X
Row _ X _ X _ Row _ _ X _ _
Row _ X _ X _ Row X _ _ _ X
This is a documentation error. That we need to add to the help.
The OLED font 1 is a proportional font. Therefore, you cannot really do what you are trying to do. I will explain.
The Char X is 5 characters wide and SPACE is 1 character width. And, you are positioning the character at the incorrect place... 4 pixels out of position as you have assumed that all characters are same width. They are not.
However, I have found an issue with the global variable GLCDFontWidth but as you are not using this is not the cause of your issue. I have fixed.
If your goal is to overwrite the existing chars... use filledbox for the extent of the characters... oh you cannot as you are using Text only mode. So, we need to print sufficient 's to overwrite the existing pixel string.
The following code show a method in low memory mode to achieve this.
;------Mainprogram~~~dimxpos,xposition,lastPrintLocXasbyte'Need to make public the private variabledimGLCDXasbyteGLCDfntDefaultsize=1' Set Small Fontdoforever'Test stringGLCDDrawString(0,0,"This is a string")Forxpos=0to14' write a line of chars to OLEDxposition=xpos*GLCDFontWidthGLCDDrawChar(xposition,20,"1",1)next'You can use the Private variable to get the last pixel updated'You will need to store GLCDX as 20*"1" is a known length... a string of Random chars is an unknown lengthlastPrintLocX=GLCDXwait3s'Put a ! where we expect the 14 spaces to finish... this is 13 because we have a character at 0GLCDPrint(13,8,"!")'Print 14 spacesGLCDDrawString(0,20,Fill(14," "))wait3sForxpos=0tolastPrintLocXGLCDPrint(xpos,20," ")nextwait3sloopEnd
Summary
The root cause was the use of the proportional font but this highlight another issue with the specified font width of the space character.
So, use the technique above to overpaint the string when you are using low memery GLCD mode.
And, get the latest GLCD libraries that have the font width of the space character fix. This will be in the next release.
Anobium
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"So, if you draw an 8*5 matrix of the pixels would be as follows. This shows the Hex values.
Col 1 2 3 4 5
Row X _ _ _ X
Row _ X _ X _
Row _ _ X _ _
Row _ X _ X _
Row X _ _ _ X
So, looking at SPACE in the table
Line 6386 in GLCD.H
1 col wide.
Bitmap is 0x00.
So simply a Column of seven pixels of nothing."
Should that be five pixels of nothing?
Does this apply to all glcd or just SSD1306...and then only in text only mode?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This applies to the specific font type - OLED FONT 1. This is a proportional font.
As all fonts are shared. This is across the system.
The GCB font, OLED FONT 2, and other fonts are all monospaced fonts.
Why do it like this? We needed to get more characters onto the OLED displays. So, working on the STARTPIC vendor board.... I figured out a method to use proportional fonts.
Please find the documentation of the StartPIC18 board here. And, you demo folders C:\GCB@Syn\GreatCowBasic\Demos\vendor_boards\startpic18_board
And. You can replace the fonts. You could define you own fonts and fonts come in two types.... proportional and monospaced. So, someone can create a lookup table and then replace a fontset.
There are demos for this, see these folders (all whatever folder you are using).
If you do not know the difference bwetween the font types then try two fonts, the same sentence. Arial and Courier New.
In the picture the top font is Courier New - a monospaced font where each character has the same dimensions. The bottom font is Arial - a proportional font where the characters are of varying width.
Wow! interesting. I've never had this space char fault so by default I must be using a mono spaced char set.
Remember pong is just moving a space char--32 around and changing the forground colour.
edit I assumed a space char was 8x8 pixels wide/high.
If not it explains the errors I had. More help needed as my assumptions have been wrong all this time.
Last edit: stan cartwright 2020-01-10
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Interesting and clever. I really want someone to write a simple converter to create mote fonts. It is very easy to generate a font and a converter to Great Cow BASIC would be easy also,
To generate the tables from the jump tables would be a simple BASIC converter. There a lots of converters (I guess not many have looked at them) but the new release has a few more for compressing and converting BMP files.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I found I'm using #define GLCD_EXTENDEDFONTSET1.
Can I search for that please? I want to see what I've been "using wrong" for so long... if indeed I have been.
Off track, sinclair basic was design your own charset and store in ram then poke the two bytes system vars that said where the char set started...so it used yours instead. Sorry, memories.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
#define GLCD_EXTENDEDFONTSET1 gives you an extended fontset. Greek characters specificially chars 32 - 255. Not really needed for general case.
See C:\GCB@Syn\GreatCowBasic\Demos\glcd_solutions\glcd_extended_fonts_solutions in your installation, and, I would have hunt through the GLCD folders... there is more on fonts and fonts support.
A picture of Greek fonts using the extended fontset. This was all added in 2014 by Dimitris Katsaounis.
"Its all Greek to me"
Last edit: Anobium 2020-01-10
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well..a space is a space using it. It's not the final frontier....or should that be fonthere?
There's so much I don't know about gcb!
Thanks for the replies.
"Its all Greek to me".... :)
Last edit: stan cartwright 2020-01-11
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I'm driving a SSD1306 0.96" I2C 128X64 OLED Display Module with a PIC16F18326 in GLCD_TYPE_SSD1306_CHARACTER_MODE_ONLY
GCB SynWrite 6.22.2290 version.txt says "12/06/2019:v0.98.06"
The glcd.h file is dated 5/8/2019 8:35 AM
Large font works fine. (GLCDfntDefaultsize = 2)
In the small font (GLCDfntDefaultsize = 1) the "space" charactor 0x20 doesn't appear write the entire font block or cell, only the leftmost vertical column.
When a charactor ("W" for example) is written, then overwritten with a space charactor, only the upper left pixel of the "W" is blanked. With the "X" charactor, only the upper and lower left pixels are blanked.
The GCB command used for writing charactors is "GLCDDrawChar_SSD1306(xposition, yposition, "X", 1 )"
Sample code is attached.
I've stared at the font tables in the .h files but don't understand the organization of the pixels in the tables.
Thanks, Jim
Jim - we should get you on the very latest GLCD drivers. This may already have the fix. We are pretty close to a release and I can release for this issue.
Wopuld that work for you?
Thanks for the instant reply! The latest drivers be great.
I have been quite spoiled by GCB, I may never use PIC Basic or assembly code again.
Thanks, Jim
I will post tomorrow. I am very busy today. Chase me tomorrow
Fantastic, thanks. No hurry!
Jim, never noticed that because I never messed with fonts and ony used SSD1306 as is as the full display with 1K buffer so use uno or nano or anything with enough ram.
I think it's a nice display. Anobioum wrote the include and added graphic commands to read a pixel was on or off...and use xor graphics.
Get a pic with some ram...or a cheap uno..and see what it can do.
I could not find the char 32 ie space in glcd lib problem.
Hi Stan,
I agree, the little OLED displays are sweet. I have driven them with Raspberry Pi and Python libraries and am familiar with their more advanced capabilities. For this project I can't redefine the enviornment or throw more horsepower at the display, so it will be nice having a fix for the only bug I have encountered. The text only mode is fine for this application, and I can likely find a workaround if necessary.
Thanks, Jim
I have no Idea where the data for text chars is kept or if it's scaled for size. Maybe Anobium could advice for like creating new chars ie change "T" to be a smiley...for example.
Jim and I will resolve offline, but, the fonts (as these are OLED fonts) are held in two tables. These two tables use different methods to create the bitmap of the character.
My guess. I have over looked a use case where the space is not incrementing the XPosition.... this is a guess until I look at the issue.
Jim and I will resolve offline, but, the fonts (as these are OLED fonts) are held in two tables. These two tables use different methods to create the bitmap of the character.
My guess. I have over looked a use case where the space is not incrementing the XPosition.... this is a guess until I look at the issue.
Analysis:
Font Table – looks correct as follows, see the second section for definition of the issue.
Section 1
We are using OLED FONT1.
OLED FONT1 is a variable font width. This is called proportional font (not a FIXED width font, the old GCB font is FIXED width)
OLED FONT1 uses tables OLEDFont1Index and OLEDFont1Data.
Where OLEDFont1Index is a pointer to OLEDFont1Data. OLEDFont1Data hold the bitmap data.
If we look at "X" to start with.
Line 6440 in GLCD.H
5 cols wide
Bitmap is 0x42, 0x24, 0x18, 0x24, 0x42 for "X"
So, if you draw an 8*5 matrix of the pixels would be as follows. This shows the Hex values.
So, looking at SPACE in the table
This means the font table is correct.
Section 2
This is a documentation error. That we need to add to the help.
The OLED font 1 is a proportional font. Therefore, you cannot really do what you are trying to do. I will explain.
The Char
Xis 5 characters wide andSPACE is 1 character width. And, you are positioning the character at the incorrect place... 4 pixels out of position as you have assumed that all characters are same width. They are not.However, I have found an issue with the global variable GLCDFontWidth but as you are not using this is not the cause of your issue. I have fixed.
If your goal is to overwrite the existing chars... use filledbox for the extent of the characters... oh you cannot as you are using Text only mode. So, we need to print sufficient
's to overwrite the existing pixel string.The following code show a method in low memory mode to achieve this.
Summary
The root cause was the use of the proportional font but this highlight another issue with the specified font width of the space character.
So, use the technique above to overpaint the string when you are using low memery GLCD mode.
And, get the latest GLCD libraries that have the font width of the space character fix. This will be in the next release.
Anobium
"So, if you draw an 8*5 matrix of the pixels would be as follows. This shows the Hex values.
Col 1 2 3 4 5
Row X _ _ _ X
Row _ X _ X _
Row _ _ X _ _
Row _ X _ X _
Row X _ _ _ X
So, looking at SPACE in the table
Line 6386 in GLCD.H
1 col wide.
Bitmap is 0x00.
So simply a Column of seven pixels of nothing."
Should that be five pixels of nothing?
Does this apply to all glcd or just SSD1306...and then only in text only mode?
This applies to the specific font type - OLED FONT 1. This is a proportional font.
As all fonts are shared. This is across the system.
The GCB font, OLED FONT 2, and other fonts are all monospaced fonts.
Why do it like this? We needed to get more characters onto the OLED displays. So, working on the STARTPIC vendor board.... I figured out a method to use proportional fonts.
Please find the documentation of the StartPIC18 board here. And, you demo folders C:\GCB@Syn\GreatCowBasic\Demos\vendor_boards\startpic18_board
And. You can replace the fonts. You could define you own fonts and fonts come in two types.... proportional and monospaced. So, someone can create a lookup table and then replace a fontset.
There are demos for this, see these folders (all whatever folder you are using).
C:\GCB@Syn\GreatCowBasic\Demos\glcd_solutions\glcd_extended_fonts_solutions
and
C:\GCB@Syn\GreatCowBasic\Demos\glcd_solutions\glcd_demonstration_of_adding_additional_font_solutions
If you do not know the difference bwetween the font types then try two fonts, the same sentence. Arial and Courier New.
In the picture the top font is Courier New - a monospaced font where each character has the same dimensions. The bottom font is Arial - a proportional font where the characters are of varying width.
Last edit: Anobium 2020-01-10
And, before you ask.... the HEX mapping to the pixels.
I had to put ONEs in the SPACE to get it show red... by, the value is 0x00.
Last edit: Anobium 2020-01-10
Wow! interesting. I've never had this space char fault so by default I must be using a mono spaced char set.
Remember pong is just moving a space char--32 around and changing the forground colour.
edit I assumed a space char was 8x8 pixels wide/high.
If not it explains the errors I had. More help needed as my assumptions have been wrong all this time.
Last edit: stan cartwright 2020-01-10
Interesting and clever. I really want someone to write a simple converter to create mote fonts. It is very easy to generate a font and a converter to Great Cow BASIC would be easy also,
See http://oleddisplay.squix.ch/#/home to generate 100s of fonts
To generate the tables from the jump tables would be a simple BASIC converter. There a lots of converters (I guess not many have looked at them) but the new release has a few more for compressing and converting BMP files.
I found I'm using #define GLCD_EXTENDEDFONTSET1.
Can I search for that please? I want to see what I've been "using wrong" for so long... if indeed I have been.
Off track, sinclair basic was design your own charset and store in ram then poke the two bytes system vars that said where the char set started...so it used yours instead. Sorry, memories.
#define GLCD_EXTENDEDFONTSET1gives you an extended fontset. Greek characters specificially chars 32 - 255. Not really needed for general case.See C:\GCB@Syn\GreatCowBasic\Demos\glcd_solutions\glcd_extended_fonts_solutions in your installation, and, I would have hunt through the GLCD folders... there is more on fonts and fonts support.
A picture of Greek fonts using the extended fontset. This was all added in 2014 by Dimitris Katsaounis.
"Its all Greek to me"
Last edit: Anobium 2020-01-10
Well..a space is a space using it. It's not the final frontier....or should that be fonthere?
There's so much I don't know about gcb!
Thanks for the replies.
"Its all Greek to me".... :)
Last edit: stan cartwright 2020-01-11