Page 2 of 5
Re: SSD1306 I2C with Pic16f1937!
Posted: Mon Sep 02, 2024 10:16 pm
by mnfisher
Thanks to Ben and Jorgen,
I got up and running on an ATTiny85 - but not on ATTiny13. Seems that i2c is not supported. Have to find a 24 or something with USI support

For the '85 - I added a small delay to the beginning of initialise to allow the power to stablilise to the display (not sure if it's actually needed)
I clocked the MCU at 16MHz (internal - this isn't an option in FC but set the fuses from Arduino IDE). I notice the clock options in build properties are a bit odd (lots of ATTiny15 options?)
I also shrank the charset lookup and PrintChar displays lower case characters as upper case (not sure if this is really needed).
Have a PIC16LF15313 with 3.5KB flash and 256bytes of RAM - will give it a whirl too
Will also try and find one of the larger (64 pixel height) displays to test.
Martin
Re: SSD1306 I2C with Pic16f1937!
Posted: Thu Sep 05, 2024 10:41 am
by jgu1
hi Martin!
As promised a test with your program. I have change the SDA to A0 And SCL to A1. I can compile without memory error, but no lifet in the display
To ensure that the program run, I added one sec flasher for test in the program, it work.
Br jorgen
Re: SSD1306 I2C with Pic16f1937!
Posted: Thu Sep 05, 2024 10:45 am
by mnfisher
Which display do you have (32 or 64 pixel). Ca you check the i2c output on an oscilloscope (when I tried the ATTiny I had SDA and SCL the wrong way round - which took longer to notice than I like to admit)
I'll try with a PIC this evening if I get time...
Martin
Re: SSD1306 I2C with Pic16f1937!
Posted: Thu Sep 05, 2024 11:20 am
by chipfryer27
Hi
Pretty sure I have a 1937 and I know I have a 32p 1306. If you still need testing I can probably have a look at the weekend.
Regards
Re: SSD1306 I2C with Pic16f1937!
Posted: Thu Sep 05, 2024 11:41 am
by mnfisher
Thanks Iain.
Jorgen - try adding a 100ms delay to the start of initialise - the display needs a short delay after VDD is applied - and if the chip starts quickly (unlike Arduino) it might start sending data too soon?
Martin
Re: SSD1306 I2C with Pic16f1937!
Posted: Thu Sep 05, 2024 12:17 pm
by chipfryer27
Hi
I'm pretty sure the 32p version works with a 1939 as that chip is pretty much a resident in one of my multi-programmers and would certainly have been used with the display at some point (as too a 18877). Those would have either been operating from the on-board crystal (8MHz or 19.xxMHz) or set internally probably to 8MHz or 32MHz.
The 1937 isn't too disimilar to the 39 so hopefully there isn't any issue.
Regards
Re: SSD1306 I2C with Pic16f1937!
Posted: Thu Sep 05, 2024 12:35 pm
by jgu1
Hi Martin and Lian
Sorry, my fault, SDA and SCL I have forgot to flip. Sorry now it work

And wow, what a speed,superfast
Is it possible to create a component macro based on your way to handle this display Martin?
Jorgen
Re: SSD1306 I2C with Pic16f1937!
Posted: Thu Sep 05, 2024 12:42 pm
by mnfisher
Cool - glad it's working.
Yes - it could be made into a component easily.. Will have a try tonight (or have a go - all the source is there?)
Martin
Re: SSD1306 I2C with Pic16f1937!
Posted: Thu Sep 05, 2024 10:14 pm
by mnfisher
As a tiny component.
I added a PrintNumber.
Changed Interlaced to inverted - since on my display this is what it seems to do.
And - I allowed myself the luxury of a 9 byte buffer - so now a charqcter is sent as one transaction of 9 bytes instead of 8 of 2.
Added a tiny test program. Displays a rotating string - it really needs a delay in the loop - I used 50ms - adjust to suit your eyes. Then clears the display and draws some numbers and text.
Now seems to work at 400kHz.
To add the component - save the .fcpx file to a location (say c:\FC_Components) - and add this location to Customise - locations - look for components in. Restart FC and you should be able to find the new component (search for SSD1396 - it's called SSD1306 Text or look in Displays - Alphanumeric)
Simulation doesn't do anything - the source is there if anyone would like to play...
Martin
Re: SSD1306 I2C with Pic16f1937!
Posted: Thu Sep 05, 2024 10:17 pm
by mnfisher
I tried (and failed) to display the alternate pins option for i2c pins. ?
Also note that the i2c address of 0x3C is different to the SSD1306 component (which has 2 x 0x3C) - the docs show the unshifted value and I used this - the FC component uses the shifted value.