Spin code needed for OLED display "28087"
ThomasK
Posts: 6
Hello there, I need some help.
I just started to learn the spin language weeks ago and I have passed through all the given lessons on the parallax homepage.
I can now write simple codes and from day to day I learn more - so far so good...
I have bought the new OLED display 96x64 (order number 28087) where I please need some code for it to keep this working.
I have read some projects and I have found C language code sequences only, but this (as a beginner) it is to strong for me to understand right now.
Ask me one year later - I just want to get knowledge on the Spin first...
So where can I get some simple codes for it?
What I want is simple. I have 2 voltages to measure and I want to display them at the same time at the display. Well, for now and if this will succeed, I can continue the basic code to more if I want...
Any proposal here?
(sorry for my english, I live in Germany, close to Hamburg. Thank you so much...
I just started to learn the spin language weeks ago and I have passed through all the given lessons on the parallax homepage.
I can now write simple codes and from day to day I learn more - so far so good...
I have bought the new OLED display 96x64 (order number 28087) where I please need some code for it to keep this working.
I have read some projects and I have found C language code sequences only, but this (as a beginner) it is to strong for me to understand right now.
Ask me one year later - I just want to get knowledge on the Spin first...
So where can I get some simple codes for it?
What I want is simple. I have 2 voltages to measure and I want to display them at the same time at the display. Well, for now and if this will succeed, I can continue the basic code to more if I want...
Any proposal here?
(sorry for my english, I live in Germany, close to Hamburg. Thank you so much...
Comments
Thank you for pointing out the SPIN code gap in the Documentation and Downloads of Product 28087.
Actually Parallax lost a sale here - I wanted to buy the OLED module, but passed when I saw there was no official SPIN code associated with it.
I know that I can probably find the SPIN code by dredging through OBEX and the Forum, but I really just wanted to get going quickly and surely with the OLED module.
Please could Parallax consider adding SPIN kickstart code to Product 28087 Documentation and Downloads.
Many thanks.
I was going to quote this source of spin code for that gps module, although now I see you wrote and contributed it
http://obex.parallax.com/object/844
@ThomasK if you decide to have a go writing your own driver, please share to obex too! In fact, share here along the way too- you might find other users able to offer advice or test code.
1. A lot of people don't know to or don't want to dredge through OBEX and the forums to find code.
2. The material on OBEX and the forums isn't necessarily vetted by Parallax. To my mind, that means it is not "official".
(ups...)
Well, I will dig in and see if I can make it display *SOMETHING* with PASM and Spin. Just disappointing, because it's a cool display and I don't want to rewrite all of my projects in C.
Thanks for making the point ke4pjw, a lot of us feel the same way.
It would be greatly appreciated if you can share your findings and code.
I hope the lack of spin examples will not be the new normal. Before I purchase a product from Parallax, I usually check for code examples, to get an understanding of the item before I receive it. That lack of example will effect my purchase. I hope spin isn't getting pushed aside, or last thing someone worries about. It's one of the most attractive aspects of the P1, they are made for each other.
P.S.: I may one day have the expertise to write driver object's in spin or PASM. But the hunt and peck programmer in me can only follow one path at a time. Boards like Propeller Activity sit gathering dust, because I don't want to clutter my mind.
http://obex.parallax.com/object/48
If you change it to the following so that the pins match the pins used for the C demo
it will produce garbage on the screen. (After waiting 45 seconds) This looks promising as way to hack together a spin driver.
This code is for the SSD1306 as opposed to the SSD1331 that is the Parallax 28087.
I highly suspect I can take this code, change the commands sent to the display, update the built in font, and we will have a usable display driver accessible from spin.
Santa is on his way here, so I most likely won't be able to work on this much more tonight.
Here is what we have so far:
The display has it's own video RAM.
There are two data transfer modes. One is command mode, the other is data mode.
When in command mode you set the address mode and other information.
When in data mode, data is moved into the display's RAM and the display's memory pointer is updated automatically.
The same appears to be true for the SSD1306, but the memory map is different. If I get more time, I will look closer to what the c driver is doing and see if we can transpose the commands and fonts into PASM/Spin for this object.
However, the font may be more complicated than I first thought, as they appear to be located in the prop's EEPROM. That's ok. I still think we a unspool this thing and transpose much of it into PASM/Spin. At lease enough to produce something on the screen.
If anyone has any pointers, I am all ears.
--Terry
I used the SSD1331 driver's data commands to attempt to display the propeller beanie hat, and had some success. This was all done in spin. I just need to determine why colors and xy is wrong. I think I can figure it out if I can find the time.
--Terry
I think I will implement the draw and copy functions that are native to the display first. Then I will attempt to implement the font/text printing routines.
I am having a lot of fun with this
--Terry
Great going Terry. Fun+++
The downside to the frame buffer is it uses 12K of RAM.
The upside to the frame buffer is you can manipulate the buffer and then update the screen all at once. The update could be super fast, as the whole thing could be done in PASM.
If I do use a frame buffer, I will use the beanie hat as the default values in the buffer. That would be a cool because on initialization, you would see that image.
Excellent!
:-)
Internal fonts work! Check it!
The code to do the "Spin Code !" message is as follows:
Now, this font is not practical on this screen. It's WAY too big. I will attempt to implement the 5x7 font next.
--Terry
Code to display 5x7font text is as follows:
Let me do some code cleanup and I will post the source in this thread. Still a lot of features to implement, but we be spinnin' baby! W00T!
Hopefully I will have some time tomorrow to implement the graphic acceleration features of the display.
Happy New Year!
(Demo deleted, see current version below)
I agree.
@ ke4pjw, That beanie hat is a work of art.
Currently I am in the process of ripping out the useless SSD1306-isms (constants,names,buffer,etc) and am about to implement the accelerated graphics commands. Hopefully I will have another publish this evening.
Ok, question guys. Do we *REALLY* need 65,535 colors? It would help for speed to drop the display to 256 colors. What say ye?
So, it looks like I am going to have to do some bit twiddling with colors to make everything simple to use. I think I am going to just put the colors in a long and call it a day. I have constants with friendly names setup for colors at this point, time to start using them.
I will say this, the line and rectangle drawing are *FAST*.
Hopefully tomorrow I can have this cleaned up to a point that a code publish into the OBEX can be done.
It has been interesting researching this. There are drivers available for using this display in parallel mode for the prop, but not serial.
I would be interested to know if anyone got the demo running on their workbench.
--Terry
The applications I have for the prop would not need more than 256 colors. In fact I could get by with 16 colors.
Unfortunately, That SPIN code does not compile. Too many discrepancies between constants in the Demo program and the ASM program.
Great work Terry!
Rectangles and lines have been added. Take a close look at the code to see how quickly it draws lines.
@Publison Let me know if this version does not compile. I suspect there were competing file names.
**File Deleted**
New version below.
Just changed the PIN assigment to what I had hooked up.. Works GREAT. Nice work Terry.
Be sure to use web safe colors as my 16bit to 24bit interpolation is brain dead. I just multiply Red by 8, Green by 4, and Blue by 8. I will circle back to this.
Todo maybe:
Background colors for fonts? What say ye?
Validate the scroll commands. I didn't change these from the ssd1306 code.
Possibly implement the dim command. Not sure there is much value here, but easy to implement.
Enjoy!
--Terry
Update: Code has been moved to the OBEX.
http://obex.parallax.com/object/858