View previous topic :: View next topic |
Author |
Message |
georgestheking
Joined: 06 May 2005 Posts: 134
|
Posted: Thu Feb 23, 2023 2:55 pm Post subject: SSD1306 128 X 32 |
|
|
Thanks for your suport
Here is the program
'-------------------------------------------------------------------------------
' SSD1306-I2C_V2x2.BAS
' (c) MCS Electronics 1995-2015
' Sample to demo the 128x64 I2C OLED display [V2]
' (2-Displays version)
'-------------------------------------------------------------------------------
$regfile = "m328pdef.dat"
$hwstack = 50
$swstack = 50
$framesize = 50
$crystal = 16000000
Config Clockdiv = 1 ' make sure the chip runs at 8 MHz
$lib "i2c_twi.lbx" ' we do not use software emulated I2C but the TWI
Config Scl = Portc.5 ' used i2c pins
Config Sda = Portc.4
Config Twi = 400000 ' i2c speed
I2cinit
Dim _contrast As Byte ' Contrast value of OLED. [0-255]
Dim I2c_addr As Byte ' I2C slave address selection. [&H78 or &H7A]
Const Ssd1306_rotate = 1 ' Display rotation. [connection cable is lower side = 0, upper side = 1]
$lib "glcdSSD1306-I2C_V2x2.lib" ' override the default lib with this special one
Config Graphlcd = Custom , Cols = 128 , Rows =32 , Lcdname = "SSD1306"
I2c_addr = &H78 ' Select device [1]
Cls
Setfont Font8x8tt ' select font
I2c_addr = &H78 ' Select device [1]
Lcdat 1 , 1 , "BASCOM-AVR"
Lcdat 2 , 10 , "1995-2015"
Lcdat 3 , 5 , "MCS Electronics" , 1 ' Optional invert
Lcdat 5 , 1 , " Device [1] " , 2 ' Optional solid underline
Lcdat 7 , 1 , " Device [1] " , 3 ' Optional dotted underline
End
$include "font8x8TT.font"
here is the display :
Best regards
Georges |
|
Back to top |
|
|
O-Family
Joined: 23 May 2010 Posts: 320 Location: Japan
|
Posted: Fri Feb 24, 2023 12:45 am Post subject: |
|
|
Although it is not a solution for display problems, we recommend using [glcdSSD1306-I2C_V2.lib] for single OLED.
The OLED you are using has 32 vertical dots, so you cannot specify a Y address of 5 or more in the LCDAT command.
The internal memory of the OLED may wrap around and overlap the display.
Your picture is not clear, so I don't know the details. |
|
Back to top |
|
|
georgestheking
Joined: 06 May 2005 Posts: 134
|
Posted: Fri Feb 24, 2023 11:34 am Post subject: SSD1306 128 X 32 |
|
|
Please find here a better picture,
Best regards
Georges |
|
Back to top |
|
|
georgestheking
Joined: 06 May 2005 Posts: 134
|
Posted: Fri Feb 24, 2023 11:51 am Post subject: SSD1306 128 X 32 |
|
|
Hi,
Here is a more simple code with the other library and a print screen.
Thanks for your help,
Georges
Code: |
$regfile = "m328pdef.dat"
$hwstack = 100
$swstack = 100
$framesize = 100
$crystal = 16000000
Config Clockdiv = 1 ' make sure the chip runs at 8 MHz
$lib "i2c_twi.lbx" ' we do not use software emulated I2C but the TWI
Config Scl = Portc.5 ' used i2c pins
Config Sda = Portc.4
Config Twi = 400000 ' i2c speed
I2cinit
Dim _contrast As Byte ' Contrast value of OLED. [0-255]
Dim I2c_addr As Byte ' I2C slave address selection. [&H78 or &H7A]
Const Ssd1306_rotate = 1 ' Display rotation. [connection cable is lower side = 0, upper side = 1]
$lib "glcdSSD1306-I2C_V2.lib" ' override the default lib with this special one
Config Graphlcd = Custom , Cols = 128 , Rows =32 , Lcdname = "SSD1306"
I2c_addr = &H78 ' Select device [1]
Cls
Setfont Font8x8tt ' select font
I2c_addr = &H78 ' Select device [1]
Lcdat 1 , 1 , "BASCOM-AVR 012345"
End
$include "font8x8TT.font"
|
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|