Log in

View Full Version : ssd1306 Include Question



PaulMaker
- 7th May 2026, 11:41
Greetings,

Have been using Richard's include for the SSD1306 (32*128) display with sucess.
I was now trying to display a single dot which would move on the display according to an X and Y coordinate variable.

Using the command GLCDDHL 0,0,1,1 works to display a single dot and for a fixed X and Y value but not if I want to use something like Xvar and Yvar.

How can I do this?

Thanks

richard
- 8th May 2026, 00:21
I was now trying to display a single dot which would move on the display according to an X and Y coordinate variable.

The ssd1306 has no support for setting individual pixels because the smallest write sets 8 pixels as a minimum and the i2c versions have no method to read back displayed data.
so my small footprint models that have no display buffer cannot support single pixel writes in any practical way

the fully buffered graphics versions can do it easily.
gl_setdot: 'Set a pixel to colour given gl_x,gl_y
ie set a pixel @30,33 and clear pixel at @31,33


gl_y=33
gl_x=30
colour=1
gosub gl_setdot
gl_x=31
colour=0
gosub gl_setdot
gosub show

PaulMaker
- 8th May 2026, 08:46
Thanks Richard for your reply,

I was trying to do something like the image attached where it's used one of the small SSD1306 displays.
Is there a workaround to do something like this?

10052

richard
- 8th May 2026, 09:05
There is no workaround needed. Use the full feature version

PaulMaker
- 8th May 2026, 10:38
Sorry Richard...I think i'm a bit confused...

I'm currently using the includes:

ssd1306_I2C.INC
font7x5_18.bas

Which should i add or replace?

richard
- 8th May 2026, 11:05
Look at topic "graphical displays with pbp"

PaulMaker
- 8th May 2026, 12:37
Was checking that exact post :)

From what i could see, i removed my previous includes and added the following:



#DEFINE colours 1 ;1 mono 2 rg or 3 rgb width con 128
height con 32

include "grx.pbpMOD"
include "SSD1306.pbpMOD"
include "font.bas"
include "bignum.bas"
include "bigchr.bas"


While compiling for the 18F2580, i get the error "WHILE SSP1STAT.2 = 1 : WEND ; SSPSTAT = 1 Transmit in progress" (line that is in the SSD1306.pbpMOD file).

I'm guessing that it's because the 18F2580 does not have the SSP1STAT.

Same thing happens with the line SSP1CON2 "While SSP1CON2.6 = 1 : WEND ; Wait for Acknowledge from slave".

Should I replace it with SSPSTAT.2 and SSPCON2 or just delete these 2 lines?

richard
- 8th May 2026, 23:40
I'm guessing that it's because the 18F2580 does not have the SSP1STAT.


if your mssp port differs from the example demo then you must ensure all mssp register references in the SSD1306.pbpmod include are edited to match your hardware.

also make sure you have the latest versions of the files

PaulMaker
- 11th May 2026, 08:38
Thanks Richard,

got it working :)

In the meantime I have another question...
I was looking for the user commands in the include and found the "DRAWLINE" ;X1,Y1,X2,Y2 , {colour} command.
However, if I want to use variable coordinates instead of constant numbers, i get an error while compiling.

The only exception is when using the variable on Y2 which compiles fine (DRAWLINE 0,0,0,J).
Is there a way i can use variables to draw a vertical line?

richard
- 11th May 2026, 08:55
Its all been done before. See original post#12 where process is elaborated from that post

PaulMaker
- 11th May 2026, 21:26
Thank you Richard for pointing me to the right direction.
Everything is working now :)

Cheers