sorry - I didn't hit re-post, computer did.
The ASM is now clean:
;I2C pins need to be input for SSP module when used on Microchip PIC device
;Dir HI2C_DATA in
banksel TRISA
bsf TRISA,2
;Dir HI2C_CLOCK in
bsf TRISA,1
but the APFCON register (11D, 285 decimal) doesn't seem to get defined - none of those 3 search terms find anything. It only needs to be cleared, so maybe that happens within a loop, clearing all the peripheral control registers, dunno.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Brilliant work, well done - 2 out of 3 displays working, the dead one probably has a different I2C address, will investigate. The font is really tiny, but again, now it works I can mess with that possibly... - does character mode support different font sizes?
I'll add the code you mention - maybe it just works without this because UUUU is normally 0000 on a cold power-up.
Would you like me to post a photo, or is that too much?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here's a not very good picture of SSD1306 driver working on a 256-byte RAM part PIC12LF1552, with 2kW ROM, in character mode.
- the top OLED is 96 x 16, CPC part SC15656
- the middle one is 128 x 32, alibaba £1 part.
- the lower OLED doesn't work, possibly an I2C address jumper is wrong.
- Praise be to Anobium.
Further reports...
I'm trying to understand the driver directives, there are 8 possibilities - two drivers and 2 flags each - (low-mem and character-only) - and of course there are 2 fonts.
- the two drivers are...
- GLCD_TYPE GLCD_TYPE_SSD1306
- GLCD_TYPE GLCD_TYPE_SSD1306_32
not sure what is different about the _32 driver, versus the original with GLCD_HEIGHT set to 32 rather than 64.
the _32 driver increases the apparent font size.
however, both consume the same resources, at least in the case where GLCD_TYPE_SSD1306_CHARACTER_MODE_ONLY is defined.
similarly, disabling font2, which is an option, has no effect on resource either.
If CHARACTER_MODE_ONLY is defined (my only test case so far) then both drivers draw the same resource, and again the same whether GLCD_TYPE_SSD1306_LOWMEMORY_GLCD_MODE is true or false.
It appears that GLCD_TYPE_SSD1306_LOWMEMORY_GLCD_MODE gets set whenever GLCD_TYPE_SSD1306_CHARACTER_MODE_ONLY is defined. - it does make a difference to the errors, I'm pretty sure I only get the warning:
Warning: Selected MCU requires use of GLCD Open&Close Page Transaction.
if LOWMEMORY is not declared - but operation and resource are the same.
I can definitely state that the ifDEV directives that test for LOWMEMORY in the program, always finds it true.
This would be true. See this segment of code from C:\GCstudio\GreatCowBasic\include\glcd_ssd1306.h
Essentially, this will ensure low RAM chip use only LM mode.
'Setup code for SSD1306 controllers#script ' This script set the capabilities based upon the amount of RAMIGNORE_SPECIFIED_GLCD_TYPE_SSD1306_CHARACTER_MODE_ONLY=0ifIGNORE_GLCD_TYPE_SSD1306_LOW_MEMORY_WARNINGSthenIGNORE_SPECIFIED_GLCD_TYPE_SSD1306_CHARACTER_MODE_ONLY=1endififGLCD_TYPE=GLCD_TYPE_SSD1306thenIfChipRAM<1024ThenGLCD_TYPE_SSD1306_CHARACTER_MODE_ONLY=TRUEGLCD_TYPE_SSD1306_LOWMEMORY_GLCD_MODE=TRUEIfChipRAM<225ThenIfChipFamily=14ThenError"Selected MCU has insufficient contiguous RAM to support GLCD operations"EndifEndifIfChipRAM>225ThenifNODEF(IGNORE_SPECIFIED_GLCD_TYPE_SSD1306_CHARACTER_MODE_ONLY)thenWarning"Memory < 1024 bytes."Warning"Selected MCU requires use of GLCD Open&Close Page Transaction."Warning"See Help for usage."Warning"Define a constant IGNORE_GLCD_TYPE_SSD1306_LOW_MEMORY_WARNINGS to remove this message."endifEndifEndIfendififGLCD_TYPE=GLCD_TYPE_SSD1306_32thenIfChipRAM<512ThenGLCD_TYPE_SSD1306_CHARACTER_MODE_ONLY=TRUEGLCD_TYPE_SSD1306_LOWMEMORY_GLCD_MODE=TRUEIfChipRAM<256ThenError"Chip has insufficient RAM to support this specific GLCD"EndifEndIfendif#endscript
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks Anobium - I will look into the Font control.
Just to round-off the discussion, I understand from your post above that the compiler forces the flags "LOWMEMORY" and "CHARACTER_MODE" - and that character mode is a subset of low memory operation. It all makes sense.
I find that Font1 renders ever so much faster that Font2 - but needs to be used with the _32 driver or else the font is really tiny .
For general info, here is the resource usage :
Chip resource usage:
Chip Model: 12LF1552
Program Memory: 1743/2048 words (85.11%)
RAM: 202/256 bytes (78.91%)
OSC: INTOSC, 16Mhz (Internal oscillator)
Not much room for user program on top of this, enough for a nifty little voltmeter certainly (watch this space) - which will fit well into this 8 pin device. There are bigger parts - I'd recommend 4kW minimum program memory.
However, the intention here was just to see what overhead is needed to drive an OLED, and what font options you get - ultimately to see if we can get to a low-resource "improved character-only display" sort of thing. The answer is a definite yes, and I'm only starting to tinker with the font options, there are many more to try.
I can't believe the level of support I've had, and the speed of it - many thanks to the GCB Gods!
Spare SSD1306 128x32 is in the post, with a board to go with it like in the photo below.
The PIC12LF1552 ROM (2kw) was filled by the time I added print statements for 3 screens, all with different fonts. - but hey, makes for a really neat greeting card message thingy running off a CR2032 battery...
I was using both fonts 1 and 2 - maybe could get more screens by dropping Font2,
But that's not the point anyway...
The 3-screen greeting card is a stake in the ground, a calibration point, using standard GCBASIC - it's 2kw ROM and 202B RAM - without any attempt at further optimisation.
I'd be interested to know what resources Arduino needs, to do the same thing.
I'll post more screens later. The one below is GLCDFontWidth= 5, font1 - and is the best density. The default is GLCDFontWidth= 6, and just adds another column of kerning (2 pixels between characters not 1 pixel) - and reads better.
sorry - I didn't hit re-post, computer did.
The ASM is now clean:
;I2C pins need to be input for SSP module when used on Microchip PIC device
;Dir HI2C_DATA in
banksel TRISA
bsf TRISA,2
;Dir HI2C_CLOCK in
bsf TRISA,1
but the APFCON register (11D, 285 decimal) doesn't seem to get defined - none of those 3 search terms find anything. It only needs to be cleared, so maybe that happens within a loop, clearing all the peripheral control registers, dunno.
Yes - still got the programmer attached - I'll try it with just 3V3 PSU.
both SCL and SDA are pulled-up with 4k7.
Genius you - it's now chucking out lots of data - will connect to OLEDs shortly///
Add the following to ensure I2C Is setup ok
This will ensure the afpcon register is set befire the init of the I2C.
IT WORKS !!
Brilliant work, well done - 2 out of 3 displays working, the dead one probably has a different I2C address, will investigate. The font is really tiny, but again, now it works I can mess with that possibly... - does character mode support different font sizes?
I'll add the code you mention - maybe it just works without this because UUUU is normally 0000 on a cold power-up.
Would you like me to post a photo, or is that too much?
pictures are always good!
Here's a not very good picture of SSD1306 driver working on a 256-byte RAM part PIC12LF1552, with 2kW ROM, in character mode.
- the top OLED is 96 x 16, CPC part SC15656
- the middle one is 128 x 32, alibaba £1 part.
- the lower OLED doesn't work, possibly an I2C address jumper is wrong.
- Praise be to Anobium.
Progress report:
I commented out the FONT2 disable, and set font 2 as the default:
'#DEFINE GLCD_DISABLE_OLED_FONT2
GLCDfntDefaultsize= 2 'A larger 10 width * 16 height pixel font.
and here is a very pleasing result on the 128 x 32 tiny OLED:
(picture)
Further reports...
I'm trying to understand the driver directives, there are 8 possibilities - two drivers and 2 flags each - (low-mem and character-only) - and of course there are 2 fonts.
- the two drivers are...
- GLCD_TYPE GLCD_TYPE_SSD1306
- GLCD_TYPE GLCD_TYPE_SSD1306_32
not sure what is different about the _32 driver, versus the original with GLCD_HEIGHT set to 32 rather than 64.
the _32 driver increases the apparent font size.
however, both consume the same resources, at least in the case where GLCD_TYPE_SSD1306_CHARACTER_MODE_ONLY is defined.
similarly, disabling font2, which is an option, has no effect on resource either.
If CHARACTER_MODE_ONLY is defined (my only test case so far) then both drivers draw the same resource, and again the same whether GLCD_TYPE_SSD1306_LOWMEMORY_GLCD_MODE is true or false.
It appears that GLCD_TYPE_SSD1306_LOWMEMORY_GLCD_MODE gets set whenever GLCD_TYPE_SSD1306_CHARACTER_MODE_ONLY is defined. - it does make a difference to the errors, I'm pretty sure I only get the warning:
Warning: Selected MCU requires use of GLCD Open&Close Page Transaction.
if LOWMEMORY is not declared - but operation and resource are the same.
I can definitely state that the ifDEV directives that test for LOWMEMORY in the program, always finds it true.
This would be true. See this segment of code from C:\GCstudio\GreatCowBasic\include\glcd_ssd1306.h
Essentially, this will ensure low RAM chip use only LM mode.
Here's the base driver (not the 32-row version) and the bigger Font2
And here's the _32 version with the smaller Font1, looks very nice and fits a lot on the screen.
It's John Cooper Clarke's first Haiku:
Nice fotos! There is another thread on Font control.
Lots of fonts options. :=)
https://sourceforge.net/p/gcbasic/discussion/579125/thread/0f10731cc9/#7afc
Thanks Anobium - I will look into the Font control.
Just to round-off the discussion, I understand from your post above that the compiler forces the flags "LOWMEMORY" and "CHARACTER_MODE" - and that character mode is a subset of low memory operation. It all makes sense.
I find that Font1 renders ever so much faster that Font2 - but needs to be used with the _32 driver or else the font is really tiny .
For general info, here is the resource usage :
Chip resource usage:
Chip Model: 12LF1552
Program Memory: 1743/2048 words (85.11%)
RAM: 202/256 bytes (78.91%)
OSC: INTOSC, 16Mhz (Internal oscillator)
Not much room for user program on top of this, enough for a nifty little voltmeter certainly (watch this space) - which will fit well into this 8 pin device. There are bigger parts - I'd recommend 4kW minimum program memory.
However, the intention here was just to see what overhead is needed to drive an OLED, and what font options you get - ultimately to see if we can get to a low-resource "improved character-only display" sort of thing. The answer is a definite yes, and I'm only starting to tinker with the font options, there are many more to try.
I can't believe the level of support I've had, and the speed of it - many thanks to the GCB Gods!
Oh, and the part I used is this https://www.aliexpress.com/item/32777216785.html
They're about £1.50 all told if you get 5.
Really great to here the progress.
Send me one of the SSD's. I need a spare.
Evan
Spare SSD1306 128x32 is in the post, with a board to go with it like in the photo below.
The PIC12LF1552 ROM (2kw) was filled by the time I added print statements for 3 screens, all with different fonts. - but hey, makes for a really neat greeting card message thingy running off a CR2032 battery...
I was using both fonts 1 and 2 - maybe could get more screens by dropping Font2,
But that's not the point anyway...
The 3-screen greeting card is a stake in the ground, a calibration point, using standard GCBASIC - it's 2kw ROM and 202B RAM - without any attempt at further optimisation.
I'd be interested to know what resources Arduino needs, to do the same thing.
I'll post more screens later. The one below is GLCDFontWidth= 5, font1 - and is the best density. The default is GLCDFontWidth= 6, and just adds another column of kerning (2 pixels between characters not 1 pixel) - and reads better.