Digole UART/I2C/SPI Display Library

What @peekay123 said! They don’t have to be 4.7k exactly. Anything between 1k and 47k should work fine.

I would stay below 10k, above that and your square waveforms start to round off with the capacitance associated with breadboards and jumper wires.

That worked! Thanks for the help.

Has anyone got working a rendering bitmap over the net? Weather station for example? I have now moved on a different project as Spark is useless for me right now. I’m on FreeRTOS, ARM Cortex STM32 and for wifi I use nRF24L01. But I’m willing to get back, when the cloud feature and speed issues are solved.

Greetings All. I am not sure if I am on the proper board, but after about 3 hrs of searching for an answer, this group seems to be the most knowledgeable about Digole displays (DS12864OLED-3W), so I just joined! I have a question about addressing the display. I am using a BASIC-programmable PIC32 MCU called Maximite (http://www.circuitgizmos.com/products/cgmmstick1/cgmmstick1.shtml). I am using UART because it should be the easiest to program and needs the least number pf signal pins (just one). The format I have successfully used is:

100  Open "com2:9600,256" As #2             ‘Opens COM Port #2, 9600 Baud, 8n1
150  For a = 1 To 100                       ‘Loop 100 times
180         Print #2,"CLTTTime is:" Time$   ‘Clears scrn then print current time
200         Print #2,"TRT"                  ‘Move Text Cursor to next line 
230         Print #2,"TTDate is:” Date$     ‘Print current date
240         Pause 100                       ‘Introduce delay of 100ms 
300  Next a
310  Close #2                               ‘Close COM port #2

The above program works great. Unfortunately, these three display commands (CL, TRT, and TT) are the ONLY commands which are producing predictable behavior! Other commands such as TTBB (set text position) is not producing the desired results. For example, if I wanted to start the next text output at column 3 and row 3, so I tried:

Print #2,”TT33”
Print #2,”TT 3 3”
Print #2,”TT3 3”
Print #2,”TT 3,3”

None of these worked, they either do not show any subsequent text, or show the text at a spot in the middle of the display, and it does not matter what numbers I put! Could you please tell me what is the actual syntax I should use? I’ve seen examples for Arduino and Raspberry PI using I2C and UART, but the syntax is in C and does not lend itself to BASIC. I’ve spent hours on this with no luck. I also tried some graphical commands (FRBBBB, CCBBBB, LNBBBB) with different formats for BBBB, and no output seems logical. This screen is 128 x 64 in resolution, so I would expect the coordinates to go from 0-127 for x, and 0 to 63 for y, but it seems no matter what I use for the coordinates, it either does not work, or displays something that does not correspond to the coordinates! Again, what is the format I should use for BBBB? For example, if I wanted to draw a filled circle in the middle of the screen, with a radius of 15 pixels, would the format be something like this? I tried all of them and did not work:

            Print #2,”CC 64 32  15 1”

Your help is greatly appreciated!

Warm regards…

mshaltot, I’m not sure if you are a Spark Core user but I would be glad to help. The B in the commands represents a BINARY value, not characters. If you look at their arduino library, text commands use Print::print("some text") format for commands whereas they use “write(some value)” for B values. For serial commands, that translates to Serial.write(value) which puts out a binary value to the serial port whereas Print puts out the character equivalent as if displayed on screen. What you need is to send the “B” data as binary data. I am not sure which version of Basic your product uses so I have to do some googling to find the correct command and get back to you. :smile:

@peekay123 He’s not a Spark user; it seems he found this detailed post through Google. He’s got a PIC32 he’s programming with BASIC.

@mshaltot This forum is for users of the Spark Core WiFi Enabled Microcontroller; that said I’d be happy to help you with your PIC32 code! What brand BASIC compiler are you running? I’ll see if I can pull some demo code together for you.

timb, thanks for the help. I’m trying to figure out what Basic he’s running myself! :smile:

UPDATE: timb, it seems to be MMBasic

I believe MMBasic can output raw data over its serial port with this format:

Print #2, chr$(byte);
where byte is the raw byte to put out and the semicolon suppresses the CR/LF normally included

So, for each "B" required in a Digole command, you would use this format. Let me know if it works! :smile:

Thank you very much indeed, Peekay123 and timb. Indeed, this PIC32 is my first attempt at micro controllers. It has a built-in BASIC interpreter, so I thought it would be easiest to use. The language reference is here (http://www.circuitgizmos.com/files/begmax.pdf). Thank you for being willing to help despite not being a spark user :smile:

Peekay123, it turns out the BASIC command Print #2,chr$(byte) simply prints our the ASCII equivalent (to screen or in this case to the serial port. For example, Print #2,chr$(52) prints the number four (4) to the screen/display. There is a command in BASIC to convert a decimal to binary, which is bin$(), but using it with Print simply prints the binary representation of the decimal number. Using the binary notation for numbers (for example &b11 to signify decimal 3) did not work.

Maybe I need to ask a more fundamental question: If I had the ability to pass to the Digole display what it needed to draw a circle at coordinates (30,30) with a radius of 10 in BASIC, what would the CCBBBB command look like? How is the CC command able to distinguish between the different parameters? Is it expecting a space, a comma, or something else between the BBBB? How does it know the beginning and end of each byte in the BBBB, knowing that they could range from 0 to 127 in x and 0 to 63 in y? According to their programming language reference (http://www.digole.com/images/file/Tech_Data/Digole_Serial_Display_Adapter-Manual.pdf) there is no reference to binary representation, and they mainly talk about decimal coordinates!

Thanks for sticking with me!

mshaltot, I was not able to find ANY documentation on writing pure bytes to the serial port using the PRINT or any other command. When I refer to "binary" I mean a non-text 8-bit byte value.

Nonetheless, the Digole documents refers to B as a byte and BB... as many bytes. A single byte can have a value of 0 to 255 allowing full coordinates to be specified. So, the draw circle command would look like this:

"CC" B B B B
CC x y r f where CC are the ascii charaters "CC" and x,y,r,f are bytes NOT text

From what I understand, PRINT #2, &h55 should print the byte 0x55 to the serial port. I could not find anything on your board's forum to help.

Hello peekay123. Thank you again for your tremendous help. I tried printing in the suggested format you highlighted, but it still did not work. What did work was prompted by your earlier post, in addition to some search related to using Python with Raspberry PI to control the Digole. Seems that Python is similar enough to BASIC, and has a similar chr() command (see http://www.seephar.com/2014/03/oled-display-for-raspberry-pi/). The final syntax which worked for all Digole statements uses multiple CHR$() concatenated with a plus (+) sign (instead of spaces, commas, semicolon, …etc). For example, to draw a circle at coordinates 30, 30, radius 10, I successfully used:

Print #2,"CC" + chr$(30) + chr$(30) + chr$(10)

Or to start writing text at coordinates 3,3, I used:

Print #2,"TP" + chr$(3) + chr$(3)

Thank you again for taking the time to help out a newbie! It was more than I expected…Warmest regards from Phoenix, Arizona :smile:

I’ve been thinking that this icon set might do well on monochrome OLED displays: http://pictos.cc/

Or these: http://pictofoundry.com/

At least as a starting point.

spongefile, great suggestions! The catch is that I have to manually build the icons on a 8x8 or 16x16 bitmap which takes a lot of time. Nonetheless, I have started a 16x16 set that I add to slowly but surely. :smile:

@peekay123 Thanks for posting this process up. I’ll give it a shot and let ya know how it goes.

RWB, if you find a better tool for doing this, let me know. :smile:

@peekay123 So if wanted to just upload a new font to the Digole memory is the process similar?

RWB, let me post the code on my github… stay tuned. :slight_smile:

RWB, you can find the code here. Take a look and let me know if you have any questions.