This doesn't actually set anything. You've defined a stray symbol called GLCD_TYPE_SSD1306_64x32 (with no value), but GCBASIC's GLCD library looks for a constant named GLCD_TYPE to know which driver to load. Since GLCD_TYPE is missing you are trying to redfine a system constant - hence the error.
However, I never got round to testing the GLCD_TYPE_SSD1306_64x32 on low memory chips.
So, try using GLCD_TYPE_SSD1306 to see if the basic work but you may need to sort the library out,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That did it, I screwed up the define. I changed to GLCD_TYPE_SSD1306 , and am back to The array SSD1306_BUFFERALIAS is too large. If I add this: #define GLCD_TYPE_SH1306_LOWMEMORY_GLCD_MODE
finally went back to GLVF_TYPE_64_32, and it compiled ok. Thanks
Last edit: Joe Tannenbaum 2026-07-27
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This library with 64×32 was not implemented or tested for low memory modes. And, your very old microcontroller does not have sufficient ram for a full buffer of 1024 bytes. The easy fix.. get a microcontroller with more RAM will resolve.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
And, I have just test the GLCD library for low memory. I do not have time to test old 16F877A but it works OK, with an updated library, on the 16F1937. This means it should work great.
#Chip 16F1937#Option Explicit#include<glcd.h>// Display configuration#DEFINE GLCD_TYPE GLCD_TYPE_SSD1306_64x32 #DEFINE GLCD_I2C_Address 0x78 // I2C Software settings#DEFINE I2C_MODE Master#DEFINE I2C_DATA PORTC.4#DEFINE I2C_CLOCK PORTC.5#DEFINE I2C_DISABLE_INTERRUPTS ON#define GLCD_TYPE_SSD1306_CHARACTER_MODE_ONLY#define GLCD_TYPE_SSD1306_LOWMEMORY_GLCD_MODE//! This ONLY has pages pic 0,3GLCD_Open_PageTransaction0,3GLCDPrint2,2,"GCBASIC"GLCDPrint2,15,"2026"Box0,0,63,31line0,0,63,31GLCD_Close_PageTransaction
and
#Chip 16F1937, 32#Option Explicit#include<glcd.h>// Display configuration#DEFINE GLCD_TYPE GLCD_TYPE_SSD1306_64x32 #DEFINE GLCD_I2C_Address 0x78 // I2C Software settings#DEFINE I2C_MODE Master#DEFINE I2C_DATA PORTC.4#DEFINE I2C_CLOCK PORTC.5#DEFINE I2C_DISABLE_INTERRUPTS ON#define GLCD_TYPE_SSD1306_CHARACTER_MODE_ONLY#define GLCD_TYPE_SSD1306_LOWMEMORY_GLCD_MODEGLCD_Open_PageTransaction0,3GLCDPrint2,2,"GCBASIC"GLCDPrint2,15,"2026"Box0,0,63,31line0,0,63,31GLCD_Close_PageTransactionWait2s// GLCDCLS //! GLCDCLS is not really needed as the Transactions will clear the screen anywayGLCD_Open_PageTransaction0,3GLCDPrint2,2,"GCBASIC"GLCDPrint2,15,"Page 2"Box0,0,63,31GLCD_Close_PageTransaction
How it works: Hours/Minutes/Seconds are plain bytes that get incremented once per loop iteration, gated by Wait 1 s — same tick mechanism as your example. Each pass builds a zero-padded HH:MM:SS string and redraws it inside a GLCD_Open_PageTransaction/Close block.
A few notes since you'll want to double-check against your GCBASIC version's docs:
Set the starting Hours/Minutes/Seconds values near the top, since there's no RTC here — it's a free-running software clock that will drift over time.
If you have a real RTC (DS1307/DS3231 etc.) wired up, it'd be more accurate to read the time from that each loop instead of incrementing in software — you can adapt this if you're using one.
Some really nice bits in the RTC demo. A few worth highlighting:
1. Freezing the clock during editing instead of fighting it. Setting PIE1.TMR1IE = 0 while in a SET state stops the ISR from incrementing Hours/Minutes behind your back while the pot is also writing to them. That's a real race condition avoided with one line, no mutex/critical-section gymnastics needed.
2. CommitAndRun doubling as a time-sync button. Pressing SW_EXIT doesn't just leave set mode — it resets Seconds to :00 and reloads Timer1 at that exact instant. That turns it into a poor-man's "sync to the pips" feature: hold for the top of the minute, release, and you're dead-on.
3. Change-gated redraw (LastShown). The set screen only repaints when the pot's mapped value actually changes, not every loop pass. Small detail, but on a bit-banged I2C display it's the difference between a responsive knob and a stuttery one.
4. One state machine, one loop, no duplication.ClockMode (RUN / SET_HOURS / SET_MINUTES) lets the same Do...Loop drive three different behaviors without three separate loops or a tangle of flags — it reads almost like a tiny UI framework for a 3-line display.
5 Using the ADC to set the time. Turning a linear pot reading straight into a wall-clock field with one multiply-divide (ADCValue * Range / 1024) skips the usual up/down-button tedium entirely — you get analog, direct-mapped control instead of stepping through 23 hours one click at a time. It also reads naturally: turn the knob a little, the hour barely moves; turn it a lot, it sweeps the whole range.
6. Function PotToRange(Range As Byte) As Byte. One small function does double duty for both fields just by changing its argument — PotToRange(24) for hours, PotToRange(60) for minutes. No copy-pasted scaling math, no separate "hours version" and "minutes version" of the same logic. That's the kind of tiny abstraction that makes the rest of the code (ShowSetScreen too) easy to extend if you ever add a seconds-set or a day/date field later.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Gcstudio ver 1.76.2
glcd.h last update 19/02/25
I include glcd.h
I define: #define GLCD_TYPE_SSD1306_64x32
I get this error:[{
"resource": "/c:/GCstudio/gcbasic/include/glcd.h",
"owner": "gcb",
"severity": 8,
"message": "SCRIPT/Constant: GLCD_TYPE_SSD1306_64X32 cannot reassigned to 38 (Library Include)",
"source": "gcb",
"startLineNumber": 118,
"startColumn": 1,
"endLineNumber": 118,
"endColumn": 2147483647
}]
Is glcd.h corrupted?
Hello,
Not likely to be corrupted.
Post your source program.
Attached
Thanks.
This doesn't actually set anything. You've defined a stray symbol called
GLCD_TYPE_SSD1306_64x32(with no value), but GCBASIC's GLCD library looks for a constant namedGLCD_TYPEto know which driver to load. SinceGLCD_TYPEis missing you are trying to redfine a system constant - hence the error.Fix it like this:
However, I never got round to testing the GLCD_TYPE_SSD1306_64x32 on low memory chips.
So, try using
GLCD_TYPE_SSD1306to see if the basic work but you may need to sort the library out,I tried to re=install gcstudio, but error persists.
This is a syntax issue. Check my post.
That did it, I screwed up the define. I changed to GLCD_TYPE_SSD1306 , and am back to The array SSD1306_BUFFERALIAS is too large. If I add this: #define GLCD_TYPE_SH1306_LOWMEMORY_GLCD_MODE
finally went back to GLVF_TYPE_64_32, and it compiled ok. Thanks
Last edit: Joe Tannenbaum 2026-07-27
This library with 64×32 was not implemented or tested for low memory modes. And, your very old microcontroller does not have sufficient ram for a full buffer of 1024 bytes. The easy fix.. get a microcontroller with more RAM will resolve.
ok, figured I was mis interperting the datasheet. Thank you.
Roger has done some really clever sruff with this little display. He has some cool videos.
See https://sourceforge.net/p/gcbasic/discussion/629990/thread/cfb5ef1913/?limit=250#a629
And, I have just test the GLCD library for low memory. I do not have time to test old 16F877A but it works OK, with an updated library, on the 16F1937. This means it should work great.
and
Last edit: Anobium 2026-07-28
Here is simple clock on the 64x32.
How it works: Hours/Minutes/Seconds are plain bytes that get incremented once per loop iteration, gated by Wait 1 s — same tick mechanism as your example. Each pass builds a zero-padded HH:MM:SS string and redraws it inside a GLCD_Open_PageTransaction/Close block.
A few notes since you'll want to double-check against your GCBASIC version's docs:
Set the starting Hours/Minutes/Seconds values near the top, since there's no RTC here — it's a free-running software clock that will drift over time.
If you have a real RTC (DS1307/DS3231 etc.) wired up, it'd be more accurate to read the time from that each loop instead of incrementing in software — you can adapt this if you're using one.
Here is a RTC Clock using external clock on this little GLCD!
Enjoy
Will try these when I get home. Thank you.
Chose your chip but these should work even on that old chip.
Cool little simple clock project!
Even cooler... you can set the time on the OLED via two switches and a POT.
This is highly customization.
Last edit: Anobium 2026-07-28
I have some pic16f1938's on order.
Last edit: Joe Tannenbaum 2026-07-28
Some really nice bits in the RTC demo. A few worth highlighting:
1. Freezing the clock during editing instead of fighting it. Setting
PIE1.TMR1IE = 0while in a SET state stops the ISR from incrementingHours/Minutesbehind your back while the pot is also writing to them. That's a real race condition avoided with one line, no mutex/critical-section gymnastics needed.2.
CommitAndRundoubling as a time-sync button. PressingSW_EXITdoesn't just leave set mode — it resetsSecondsto:00and reloads Timer1 at that exact instant. That turns it into a poor-man's "sync to the pips" feature: hold for the top of the minute, release, and you're dead-on.3. Change-gated redraw (
LastShown). The set screen only repaints when the pot's mapped value actually changes, not every loop pass. Small detail, but on a bit-banged I2C display it's the difference between a responsive knob and a stuttery one.4. One state machine, one loop, no duplication.
ClockMode(RUN / SET_HOURS / SET_MINUTES) lets the sameDo...Loopdrive three different behaviors without three separate loops or a tangle of flags — it reads almost like a tiny UI framework for a 3-line display.5 Using the ADC to set the time. Turning a linear pot reading straight into a wall-clock field with one multiply-divide (
ADCValue * Range / 1024) skips the usual up/down-button tedium entirely — you get analog, direct-mapped control instead of stepping through 23 hours one click at a time. It also reads naturally: turn the knob a little, the hour barely moves; turn it a lot, it sweeps the whole range.6.
Function PotToRange(Range As Byte) As Byte. One small function does double duty for both fields just by changing its argument —PotToRange(24)for hours,PotToRange(60)for minutes. No copy-pasted scaling math, no separate "hours version" and "minutes version" of the same logic. That's the kind of tiny abstraction that makes the rest of the code (ShowSetScreentoo) easy to extend if you ever add a seconds-set or a day/date field later.I tried these (the first two), but my compiler still gets error 64_32 low memory not tested. Update to program or library?
Last edit: Joe Tannenbaum 2026-07-29
Did you you update your installation wiht the new library above? The .h file.
How do you update a library?
I didn't see any update options.
Replace the existing file in GCSTUDIO\GCBASIC\INCLUDE folder.
I figured that. Where do I get the updated library? Google and github no help.
From the post above. https://sourceforge.net/p/gcbasic/discussion/596084/thread/e833bb5199/?limit=25#2bad