Digole Smart Display Module (DSDM)! Programmer Manual! #

Digole Digital Solutions
Digole Smart Display
Module (DSDM)!
Programmer Manual!
#
Last Updated: Saturday, June 21, 2014
Page 1 of 31
Digole Digital Solutions
Table of Content
How to design software for Digole Smart Display Modules#........................................4#
1. Introduction of Digole Smart Display Modules (DSDM in following)#...................4#
2. Hardware resource map on modules#..................................................................5#
3. How to use restrict port/pins (Black letter on above table)#.................................6#
4. Design Software for DSDM#.................................................................................7#
4.1 How to reserve program memory space and RAM on C?#..........................7#
4.1.1HI-TECH PICC-18:#............................................................................7#
4.1.2 Microchip C18:#..................................................................................7#
4.1.3 CCS:#.................................................................................................7#
4.1.4 PIC Basic Pro:#..................................................................................7#
4.2 Steps on MPLAB+HI-TECH C-18:#..............................................................8#
4.3 Download .HEX file to DSDM#...................................................................15#
5. API Documentation#...........................................................................................19#
5.1 Memory space map#..................................................................................19#
5.2 DSDM reserved RAM map#.......................................................................20#
5.3 API function list (firmware version 2.7 and later)#......................................23#
5.4 API function description#............................................................................25#
5.4.1 Initialize display hardware and reset all parameters#.......................25#
5.4.2 Set display directions#......................................................................25#
5.4.3 Set current font#...............................................................................25#
5.4.4 Set current color of 256 depth#........................................................25#
5.4.5 Set current color of 65K depth#........................................................25#
5.4.6 Set current color of 262K depth#......................................................26#
5.4.7 Turn screen on/off#...........................................................................26#
5.4.8 Turn backlight on/off#.......................................................................26#
5.4.9 Clear screen use current set of color#..............................................26#
5.4.10 Set text position#............................................................................26#
5.4.11 Set current text position back to previous character#.....................27#
5.4.12 Set the screen contrast#.................................................................27#
5.4.13 Draw a character#..........................................................................27#
5.4.14 Draw a string#.................................................................................27#
Page 2 of 31
Digole Digital Solutions
5.4.15 Draw a pixel#..................................................................................27#
5.4.16 Get a pixel#.....................................................................................27#
5.4.17 Draw a line#....................................................................................28#
5.4.18 Move an area#................................................................................28#
5.4.19 Draw a circle#.................................................................................28#
5.4.20 Draw a box#....................................................................................28#
5.4.21 Draw a frame#................................................................................29#
5.4.22 Display a bitmap image#................................................................29#
5.4.23 Fresh the screen#...........................................................................29#
5.5 Other setting without a API call#.................................................................30#
5.5.1 Set display mode#............................................................................30#
5.5.2 Set Line Pattern#..............................................................................30#
5.5.3 Set Text print position as pixel#........................................................30#
5.5.4 Set graphic position#........................................................................30#
5.6 Other combined function in digole.h#.........................................................31#
void nextTextLine(void); #..........................................................................31#
void setTextPosOffset(signed char xoff, signed char yoff); #.....................31#
void printDEC(int d);#................................................................................31#
void printOCT(int d);#................................................................................31#
void printHEX(int d);#.................................................................................31#
void printFloat(float d, unsigned char a);#.................................................31#
void drawHLine(int x0, int y0, int x1);#.......................................................31#
void drawLineTo(int x, int y);#....................................................................31
Page 3 of 31
Digole Digital Solutions
How to design software for Digole Smart Display Modules!
#
- Selectable polarity#
- Programmable dead time#
- Auto-Shutdown and Auto-Restart#
1. Introduction of Digole Smart Display
Modules (DSDM in following)!
DSDM are special modules which integrated:#
A LCD or OLED display.#
Display driver with identical API interface.#
Boot loader at 57600bps UART, XON flow
control.#
PIC18F26K20 or PIC18F46K20 on board.#
Other accessory parts to support display.#
Futures:!
Available Size: 0.96” to 3.2”.#
Display technology: LCD or OLED.#
Available color: Monochrome to Full Color.#
Available I/O pins: almost all on MCU.#
Extended Watchdog Timer (WDT)#
4 x 10-bit resolution ADC.#
Capture/Compare/PWM (CCP) module#
Flash Memory(for user program and data):
48K bytes.#
Enhanced CCP (ECCP) module:#
- One/Two PWM output (some module
used one to control back light)#
#
Master Synchronous Serial Port (MSSP)
module#
- 3-wire SPI (supports all 4 modes)#
- I2C™ Master and Slave modes with
address mask#
- Enhanced Universal Synchronous
Asynchronous#
Receiver Transmitter (EUSART) module:#
- Supports RS-485, RS-232 and LIN#
- RS-232 operation using internal oscillator#
- Auto-Wake-up on Break#
- Auto-Baud Detect#
E2PROM(Data only): 1K bytes.#
RAM: >=2560 bytes.#
MCU frequency: 31KHz to 64MHz, can be
adjusted dynamically on running time.#
Program code file format: Intel Hex.#
Inventional entering program downloading
mode: double press reset button.
The software can be developed by using: C or assembler program language, such as: XC8, Hi-Tech
C18, CCS, MPASM and more.#
All our DSDM embedded the corresponding display driver with identical interface, so, changing the
module on your product is seamless. The embedded driver can do lot of work for you: display characters
using U8Glib fonts, draw pixels, lines, circles, rectangles and more, all drawing can be operated with
existing contents logically: NOT/OR/AND/XOR, all driver were test completely and tuned carefully.#
By using our DSDM, you can reduce your product developing time significantly, what you need is just
focusing on your product’s functions, then call display driver when you need send output to display.
Page 4 of 31
Digole Digital Solutions
2. Hardware resource map on modules!
Legend:#
Blue: All function available for user, the module didn’t use it internal#
Red: This port/pin was reserved for module, user can’t operate this pin, other wise, the module#
Black: Restrict ports/pin, the user can still use the port, but should be deal with it carefully.#
128x64#
12864LCDS7#
9664COLE 12864OLED3X# Universal#
12864LCDS6#
D20
12864OLED2X (ST7920/
12864LCDS4
KS0108)
I/O Port
Multiplex Function#
on Chip
160128CO
LED35
PA.0 to 3
Analog 0 to 3
√
√
√
√
√
CS
CS
CS
CS
CS
√
√
√
√
√
PA.6
WR
WR
WR
WR
SDI
PA.7
D/C
D/C
D/C
D/C
D/C
PB.0 to 7
DATA I/O
DATA I/O
DATA I/O
DATA I/O
√
PC.0
RD
RD
RD
RD
SCLK
PA.4
PA.5
Analog:4, SPI: SS
PC.1
CCP2
√
Back Light
√
Back Light
Back Light
PC.2
CCP1
√
√
√
√
√
PC.3
I2C/SPI:CLK
√
√
√
√
√
PC.4
I2C:SDA,SPI:SDI
√
√
√
√
√
PC.5
SPI:SDO
√
√
√
√
√
PC.6
UART:TX
√
√
√
√
√
PC.7
UART:RX
√
√
√
√
√
PE.3
RESET
X
X
X
X
X
0-13
0-13
0-9 or#
*0-13
0-9 or#
*0-13
0-9
Free RAM#
(Bank#)
CS: this is the chip selection for display panel, user can use and operation this signal, except want to
operate with the panel directly.#
WR:Write signal on display panel;#
RD: Read signal on display panel;#
D/C: Data/Command signal on display panel;#
DATA I/O: Data write to and read from display panel;#
SCLK: ST7565 LCD panel’s Clock signal;#
SDI: ST7565 LCD panel’s Data in signal;#
* Depends on “digole_monobuffer”;#
#
Page 5 of 31
Digole Digital Solutions
3. How to use restrict port/pins (Black letter on above table)!
3.1: WR (PA.6), RD (PC.0), D/C (PA.7): These 3 signals are output from MCU to display panel
only, and only activated when CS (PA.4) signal at low, so, user can use it as regular I/O when
user’s program didn’t call embedded display function.#
3.2: Back Light (PC.1): if the module used this pin, it will be used to control the backlight on the
module, the user can’t use it any more, other wise the backlight will not working properly.#
3.3: Data I/O (PB.0 to PB.7): on most module (except serial display panel), Port B is used as
data bus to communicate with display panel, user still can use it as regular I/O port if add a data
latch IC (eg. 74HC373) and use another available pin as chip select signal, at this time, WR,RD,D/
C can be used combined with port B either.#
#
Page 6 of 31
Digole Digital Solutions
4. Design Software for DSDM!
Any development tool set will work on our DSDM, such as MPLAB with C/MPASM, CCS, Mikro C and
pure ASM.#
The two important things must be pay attention by User’s program:#
1) Must be shift from 0H to 4000H, the program memory space from 0H to 3FFFH were occupied by
DSDM’s boot loader and display driver.#
2) Don’t use RAM in BANK 14 (RAM address from E00H to EFFH), this BANK RAM used by display
driver.#
4.1 How to reserve program memory space and RAM on C?!
4.1.1HI-TECH PICC-18:!
In the link phase, use the linker directive: -a4000h -L-Psmallconst=f000h!
4.1.2 Microchip C18:!
Edit the Linker script 18f452_c.lkr to protect the boot block, and rebuild the C18 startup objects
c018.o and c018i.o. The Linker script 18f4620_c.lkr must be used for models that use a 2048 boot
block. Also be certain you have not defined absolute code sections in the source code to start in
the boot block. For instance:#
#pragma code InterruptVectorHigh = 0x08#
must be changed to!
#pragma code InterruptVectorHigh = 0x4008!
4.1.3 CCS:!
Add following directives in your .C file#
build(reset=0x4000)#
#build(interrupt=0x4008)#
#org 0x0000,0x3fff#
void bootloader() {#
#asm#
nop#
#endasm#
} // Reserve program space for the bootloader#
#
4.1.4 PIC Basic Pro:!
Had the following line:#
DEFINE RESET_ORG 4000h
Page 7 of 31
Digole Digital Solutions
4.2 Steps on MPLAB+HI-TECH C-18:!
4.2.1 Install any PIC18xx software design tools on computer, our suggestion is MPLAB
IDE + HITECH C for pic18xx (see other manual for install and crack this IDE suit);#
4.2.2 Create new project:#
4.2.2.1 On the menu, Click File->New Project#
4.2.2.2 Select: Microchip Embedded, Standalone Project, then click: Next#
#
Page 8 of 31
Digole Digital Solutions
4.2.2.3 Select :Advanced 8-bit MCUs (PIC18), then PIC18F26K20, click Next#
4.2.2.4 Select a tool to any, here I pick up PICkit3#
#
Page 9 of 31
Digole Digital Solutions
4.2.2.5 Select a compiler, Here is HI-TECH PICC18-PRO(V9.66), click Next#
4.2.2.6 Input project name and select a folder where you want to save to, click: Finish#
#
Page 10 of 31
Digole Digital Solutions
4.2.2.7 Now, the project was created, you need config the PICC18 compiler to PRO
version and config the linker directive:#
On the left project panel, click “Tool” icon:#
#
Page 11 of 31
Digole Digital Solutions
4.2.2.8 Click: Compiler->Operation, select PRO mode#
4.2.2.9 on the Linker: input :-a4000h -L-Psmallconst=f000h#
#
Page 12 of 31
Digole Digital Solutions
4.2.2.10 Now, the project is set up completely, it’s time to write program now.#
We need to create a main .C file in this project: click on the Source Files, then Right
click to pop up the sub menu, select New->C Main File…#
4.2.2.11 type in main file name, here we use the default: new main#
Page 13 of 31
Digole Digital Solutions
4.2.2.12 Input contents like follow, then compile it, the IDE will create a .HEX file, we
need to download this .HEX file to DSDM through a USB to UART converter.#
we already write a digole.h file for PICC18 that include all API function and RAM
reservation, you can copy it into “include” folder of HI-TECH PICC18, then simply use:#
#include <digole.h>#
in your .C file#
#
Page 14 of 31
Digole Digital Solutions
4.3 Download .HEX file to DSDM!
In order to download user program to DSDM, you need an UART port as hardware and
communication software.#
To obtain an UART port, we usually use a USB to UART converter (not a USB to RS232
converter, they use same protocol, but with difference logical voltage level, UART use TTL), you
can find lot of such adapter from ebay and others.#
Connect DSDM to USB-UART converter:#
DSDM #
#
#
USB-UART Converter#
GND# #
<———>#
GND#
VCC(PWR)# <———>#
5V or 3.3V#
RX# #
<———>#
TXD#
TX# #
<———>#
RXD#
#
The communication software we recommend is CoolTerm, this software tool work on
Windows, MAC OS and Linux, very useful and powerful, here is the download link:#
http://freeware.the-meiers.org#
NOTE: We found only CP2102 adapter work at XON correctly, other adapter with which
FT232RL or CH340G will not work at XON, if you use such adapter, you need set 1ms delay after
each character send out.
Page 15 of 31
Digole Digital Solutions
After downloading the CoolTerm, we now to demonstrate how to set up the CoolTerm and
Download user software to DSDM:#
4.3.1 Run CoolTerm: Double click CoolTerm#
4.3.2 Click: Options icon to set up the communication parameters, then click: OK#
#
a) Select the correct Port#
#
b) Set the Baudrate at : 57600#
#
c) Set the Data Bits as: 8#
#
d) Set the Parity as: none#
#
e) Set the Stop Bits to: 1#
#
f) Set the Flow Control to: XON#
Page 16 of 31
Digole Digital Solutions
4.3.3 Click: Connect button on tool bar, it will show the port has been connected at the
status bar (refer above picture)#
4.3.4 Download .HEX file to DSDM:#
#
4.3.4.1 Select : Connection menu then click Send Textfile, it will open an dialog to let
you browser file.#
4.3.4.2 Select the .HEX file which just created by the software development tool set, on
MPLAB with PICC18, it usually under the folder of:#
Page 17 of 31
Digole Digital Solutions
[Project folder]->dist->default->production folder#
4.3.4.3 Double press the RESET button on DSDM quickly, the DSDM will show the 10
seconds countdown screen to wait for the new program(the following pictures are on DSDM160128
Color OLED Module, other modules are similar)#
4.3.4.4 Click the Open button, then the CoolTerm will download the .HEX file to DSDM,
there is a downloading progress bar on the DSDM’s screen:#
4.3.4.5 After finishing of user program downloading, the DSDM will start to run user
program automatically.#
#
Page 18 of 31
Digole Digital Solutions
5. API Documentation!
All DSDM embedded bootloader and display API in the MCU program memory space from 0000H to
3FFFH, that’s why the user’s program only can start from 4000H. User’s program can call the embedded
API to do lots of things such as display letter, draw line, draw circle, change font and more by:#
1) setting the function you want to call to RAM at 0E00H#
2) setting the parameters you want to pass to from 0E01H to 0E3CH#
3) making a call to 80H at program memory#
We will describe it in more details bellow.#
5.1 Memory space map!
#
Page 19 of 31
Digole Digital Solutions
5.2 DSDM reserved RAM map!
User program need to use DSDM reserved RAM to pass parameters to API function, and API also
store return value to the RAM. The reserved RAM is the whole of BANK 14 (E00h to EFFh).#
RAM table for firmware version 2.7 and newer:#
Offset#
in Bank 14
Value type
Name in#
digole.h
Function Description
0
byte
digole_command
Indicate which function the user want, more details see API commands
1
byte
digole_mode
Control the pixel drawing mode, the available values are: ‘|’, ‘!”, ‘&’, ‘^’,
echo represent: OR, NOT, AND, XOR. New value only affect the
following out put
2
byte
digole_dir
Control the output direction on screen, the values are 0,1,2,3, that
represent in 4 directions
digole_color
For mono display: it will do logic operation with existing pixel on
screen(except if digole_mode=‘!’), if the result=1, draw pixel, =0, clear
the pixel.#
For color display: if will control the setting RGB color to do logical
operation with existing color value on screen (except if digole_mode=‘!’)
3
byte
4
integer
digole_x
x position get draw a pixel and get the value of pixel
6
integer
digole_y
y position get draw a pixel and get the value of pixel
8
integer
digole_char_x
x position for current text display in pixel, it will be adjust by API after
display text, user also can set it to position a new x position
10
integer
digole_char_y
y position as above
12
2 bytes pointer
digole_font
User can set a new font for display text by setting this pointer to a
address of u8glib font in user program space, when the value =0, the
following display text will use DSDM’s internal font, the font only effect
after calling setfont API function
15
2 bytes pointer
digole_adr
Reserved by DSDM, don’t use it
18
2 bytes pointer
digole_ROM_ptr
Reserved by DSDM, don’t use it
22
integer
digole_Gx
current x position in pixel for draw line to function, it means to move
current graphic position to digole_Gx
24
integer
digole_Gy
Similar as above, but is y position
26
byte
digole_pattern
For draw line function, effect for all graphic function which user draw
line, such as draw line, draw line to, draw rectangle, the 8 bits in this
byte define which pixel will be draw, use this byte, user can draw dot
line, dash line and more.
27
byte
digole_in
Input parameter when setting backlight on/off, screen on/off, contrast
value, config universal DSDM value.
digole_monobuffer
For mono DSDM, if the LCD controller is ST7920 or KS0108, you can
choose use the RAM screen buffer or not, by using the screen buffer,
the module will do drawing faster than no buffer.The screen buffer is
from RAM bank 10 to 13#
digole_monobuffer=0; Don’t use screen buffer, RAM bank 10 to 13 are
free to user.#
digole_monobuffer=1; Use screen buffer, user can’t user bank 10 to 13
29
30-40
byte
Multiple function of parameters, please see note 1
Page 20 of 31
Digole Digital Solutions
Offset#
in Bank 14
Value type
Name in#
digole.h
42-53
Function Description
Reserved by DSDM, don’t use it
54
byte
digole_RGB.R
For color DSDM only: Red input value when setting color and clear
screen with background color
55
byte
digole_RGB.G
As described above, but for Green color value
56
byte
digole_RGB.B
As described above, but for Blue color value
57
byte
digole_tmpc.R
For color DSDM only:#
1) 256 Color DSDM: This byte include Red/Green/Blue value#
2) 65K Color DSDM: This byte include 5 bits Red value+ 3 bits MSB
Green value#
3) 262K Color DSDM: Red value of pixel (Lower 6 bits only)
58
byte
digole_tmpc.G
For color DSDM only:#
1) 65K Color DSDM: 3 bits LSB Green value+5 bits Blue value#
2) 262K Color DSDM: Green value of pixel (Lower 6 bits only)
59
byte
digole_tmpc.B
For color DSDM only:#
1) 262K Color DSDM: Blue value of pixel (Lower 6 bits only)
60
byte
digole_screen_info.w
Read only, don’t modify it. It indicate the screen width in pixels
61
byte
digole_screen_info.h
Read only, don’t modify it, It indicate the screen height in pixels
62
byte
digole_screen_info.c
Read only, don’t modify it, It indicate the color depth of screen: 0=mono,
1=256color, 2=65K color, 3=262K color
note 1: Multiple function of parameters!
RAM offset: 30 to 40 are used for multiple functions parameters input, the functions include:#
1, display bitmap images, the image can be: mono, 256 color, 65K color, 262K color.#
2, draw circle.#
3, display a character (this is the basic function for display a string).#
4, draw empty or filled rectangle.#
5, move an area on screen.#
6, draw line.#
Display bitmap images parameters:!
Offset#
in Bank 14
Value type
Name in#
digole.h
Function Description
digole_img_format
Indicate the bitmap color depth: 0=mono, 1=256 color, 2=65K color,
3=262K color.
integer
digole_img_x
The x position on the screen of left-top corner of image will be displayed
34
integer
digole_img_y
The y position on the screen of left-top corner of image will be displayed
36
integer
digole_img_width
The bitmap image width
38
integer
digole_img_height
The bitmap image height
30
byte
32
Draw circle parameters:!
Page 21 of 31
Digole Digital Solutions
Offset#
in Bank 14
Value type
Name in#
digole.h
Function Description
30
integer
digole_cc_x0
The x position of circle center on the screen
32
integer
digole_cc_y0
The y position of circle center on the screen
34
integer
digole_cc_r
The radius of the circle
36
byte
digole_cc_fill
Filling option: 0= not filled, 1=fill the circle
Display a character parameters:!
Offset#
in Bank 14
Value type
Name in#
digole.h
30
byte
digole_Text_ch
31
byte
digole_Text_x
32
byte
digole_Text_y
Function Description
The ASCII value for which character will be displayed
These 2 value define the position of character on the screen, it’s not
counted as pixel, the accurate position of pixel is calculated by the font
size, the available values are depends on the screen pixels and font size.#
They are same as the ROW and COLUNM on character display.#
These values take effect after calling “set text position” API function
(digole_command = 11), not working if only set the value.
Draw empty or filled rectangle parameters:!
Offset#
in Bank 14
Value type
Name in#
digole.h
Function Description
30
integer
digole_graph_width
The width of rectangle
32
integer
digole_graph_height
The height of rectangle
34
integer
digole_graph_x0
36
integer
digole_graph_y0
The left-top position of rectangle
Move an area on screen parameters:!
Offset#
in Bank 14
Value type
Name in#
digole.h
Function Description
30
integer
digole_graph_width
The width of moving area
32
integer
digole_graph_height
The height of moving area
34
integer
digole_graph_x0
36
integer
digole_graph_y0
34
integer
digole_graph_x1
36
integer
digole_graph_y1
The original left-top position where you want to move from
The destination left-top position where you want to move to
Page 22 of 31
Digole Digital Solutions
Draw line:!
Offset#
in Bank 14
Name in#
digole.h
Value type
34
integer
digole_graph_x0
36
integer
digole_graph_y0
34
integer
digole_graph_x1
36
integer
digole_graph_y1
Function Description
draw from position on screen
draw to position on screen
#
#
5.3 API function list (firmware version 2.7 and later)!
digole_c
ommand
Description
Input Parameter
0
Initialize the hardware of display, reset all parameters
1
Set the display direction for coming API drawing
digole_dir
2
Set and initialize a user font (u8glib font compatible)
digole_font
3
Set the current color to a 256 color depth
digole_RGB.R
4
Set the current color to a 65K color depth
digole_RGB.R#
digole_RGB.G
5
Set the current color to a 262K color depth
digole_RGB.R#
digole_RGB.G#
digole_RGB.B
6
Turn the screen on/off
digole_in
7
Turn the backlight on/off
digole_in
8
Clear the screen with a preset color, reset all drawing position
digole_RGB.R#
digole_RGB.G#
digole_RGB.B
11
Set the current character display position to ROW and COLUNM.
digole_Text_x#
digole_Text_y
12
Set the current character display position back to last position
13
Set the display panel contrast, this API only applicable for which the panel
accept software contrast setting, such as LCD with ST7565 controller, and
new 0.96”/1.3” mono OLED
14
Reserved by DSDM
15
Display a character, using current color
digole_Text_ch
16
Display a string (character array end with 0), the string can be stored in
program memory space (not modify able on running time) or RAM space
(modify able on running), using current color
*digole_ROM_ptr
20
Draw a pixel, using current color
digole_x#
digole_y
Page 23 of 31
digole_in
Output value
Digole Digital Solutions
digole_c
ommand
Description
Input Parameter
Output value
Get a pixel (it may return 1, 2, 3 bytes depending on the color depth of
screen)
digole_x#
digole_y
digole_tmpc.R#
digole_tmpc.G#
digole_tmpc.B
22
Draw a line, using current color
digole_graph_x0#
digole_graph_y0#
digole_graph_x1#
digole_graph_y1#
digole_pattern
digole_Gx#
digole_Gy
23
Reserved by DSDM
21
24
26
27-30
31
32
40
41-98
99
#
Move an area on the screen
digole_graph_x0#
digole_graph_y0#
digole_graph_x1#
digole_graph_y1#
digole_graph_width#
digole_graph_height
Draw a filled/non filled circel, using current color
digole_cc_x0#
digole_cc_y0#
digole_cc_r#
digole_cc_fill
Reserved by DSDM
Draw a filled rectangle, using current color
digole_graph_x0#
digole_graph_y0#
digole_graph_width#
digole_graph_height
Draw a non-filled rectangle, using current color
digole_graph_x0#
digole_graph_y0#
digole_graph_width#
digole_graph_height
Display mono/256 color/65K color or 262K color image
digole_img_format#
digole_img_x#
digole_img_y#
digole_img_width#
digole_img_height#
*digole_ROM_ptr
Reserved by DSDM
Force screen refreshed from Screen buffer in RAM, only for mono display
Page 24 of 31
Digole Digital Solutions
5.4 API function description!
As described before, all API functions can call by this sequence:#
1) set input parameters#
2) set API function number each correspond to special function#
3) make a call to address of :80h#
#
#
#
#
#
!
#
#
!
#
#
!
#
#
!
5.4.1 Initialize display hardware and reset all parameters!
Input: digole_command=0.#
Initialize display panel, clear screen, set all parameters in RAM to default.#
Function in digole.h: initDisplay(); !
5.4.2 Set display directions!
Input: digole_command = 1;#
digole_dir = dir;#
DSDM can draw text and graphics in 4 different direction on screen, this setting only affect the on
coming drawing. The dir can be 0,1,2,3, the default is 0#
Function in digole.h: setRotation(unsigned char dir); #
5.4.3 Set current font!
Input: digole_command = 2;#
digole_font = userfont;#
All font in u8glib can be used here, the userfont is the pointer to the new font data structure which
you want to use, u8glib fonts are list here: https://code.google.com/p/u8glib/wiki/fontsize, other
languages fonts are here: https://code.google.com/p/u8glib/wiki/fontgroupunifont#
Function in digole.h: setFont(unsigned char *userfont); #
5.4.4 Set current color of 256 depth!
Input: digole_command = 3;#
digole_RGB.R = color;#
Use this API to set the current color in 256 color depth, the API will convert the 256 color format to
maximum color depth to the on board screen, none affecting if the on board screen is
monochrome.#
The 256 color format is: Red:3bits, Green:3bits, Blue: 2bits#
R2R1R0G2G1G0B1B0, MSB to LSB, R=Red, G=Green, B=Blue, eg. E0h is brightness red, 1Ch is
brightness green, and 3 is brightness blue, FFh is white.#
Function in digole.h: setColor256(unsigned char color); #
5.4.5 Set current color of 65K depth!
Input: digole_command = 4;#
digole_RGB.R = color_Hi;#
digole_RGB.G = color_Lo.#
Use this API to set the current color in 65K color depth, the API will convert the 65K color format
to maximum color depth to the on board screen, none affecting if the on board screen is
monochrome.#
Page 25 of 31
Digole Digital Solutions
#
#
!
#
!
#
!
#
!
#
!
The 65K color format is: Red: 5bits, Green: 6bits, Blue: 5bits#
In digole_RGB.R: R4R3R2R1R0G5G4G3, MSB to LSB, R=Red, G=Green.#
In digole_RGB.R: G2G1G0B4B3B2B1B0,MSB to LSB, G=Green, B=Blue.#
Function in digole.h: setColor65K(unsigned int color); #
5.4.6 Set current color of 262K depth!
Input: digole_command = 5;#
digole_RGB.R = color_Red;#
digole_RGB.G = color_Green;#
digole_RGB.B = color_Blue;#
Use this API to set the current color in 262K color depth, the API will convert the 262K color
format to maximum color depth to the on board screen, none affecting if the on board screen is
monochrome.#
The 262K color format is: Red: 6bits, Green: 6bits, Blue: 6bits#
In digole_RGB.R: R5R4R3R2R1R0, MSB to LSB,#
In digole_RGB.R: G5G4G3G2G1G0, MSB to LSB,#
In digole_RGB.B: B5B4B3B2B1B0,MSB to LSB,#
Function in digole.h: setColor262K(unsigned Red, unsigned Green, unsigned Blue); #
5.4.7 Turn screen on/off!
Input: digole_command = 6;#
digole_in=on/off; 1=on, 0=off#
This API will turn the screen on or off according the value in digole_in, if digole_in=1, turn screen
on, if digole_in=0, turn screen off#
Function in digole.h: setScreenOnOff(unsigned char onoff); #
5.4.8 Turn backlight on/off!
Input: digole_command = 7;#
digole_in=on/off; 1=on, 0=off#
This API will turn the backlight for screen on or off according the value in digole_in, if digole_in=1,
turn backlight on, if digole_in=0, turn backlight off#
Function in digole.h: setBackLight(unsigned char onoff); #
5.4.9 Clear screen use current set of color!
Input: digole_command = 8;#
Fill up the screen using current color, set the graphic position and text position to top-left, set
display mode to “COPY”.#
Function in digole.h: clearScreen(unsigned char color256); #
5.4.10 Set text position!
Input: digole_command = 11;#
digole_Text_x = column;#
digole_Text_y = row;#
Page 26 of 31
Digole Digital Solutions
#
!
#
!
#
!
#
!
#
!
#
Set the current text position to (column, row) according the current font information, the column
and row are not count as pixel, the maximum column and row on screen are depends on the font
size. if you want to set current position as pixel, set digole_char_x and digole_char_y directly.#
Function in digole.h: setPrintPos(unsigned char column, unsigned char row, 0); #
5.4.11 Set current text position back to previous character!
Input: digole_command = 12;#
After this API, the next character will display at same position as last character, the data is in
digole_char_x and digole_char_y, modify this 2 parameters, user can draw characters at any
position on the screen.#
Function in digole.h: setTextPosBack(); #
5.4.12 Set the screen contrast!
Input: digole_command = 13;#
digole_in=contrast; contrast=0 to 100.#
This API only work on the DSDM which on board screen’s contrast can be adjusted by software,
the available value is from 0 to 100, 0 is minimum contrast.#
Function in digole.h: setContrast(unsigned char contrast); #
5.4.13 Draw a character!
Input: digole_command = 15;#
digole_Text_ch = ch.#
Draw a ASCII character in digole_Text_ch at current text position, the current text position will be
adjusted after drawing.#
Function in digole.h: printChar(unsigned char ch); #
5.4.14 Draw a string!
Input: digole_command = 16;#
digole_ROM_ptr=*str.#
Draw a ASCII string in pointer of digole_ROM_ptr from current text position, the current text
position will be adjusted after drawing. The str must end by 0.#
The string pointer can be in RAM or ROM, but not in EEPROM.#
Function in digole.h: printString(const unsigned char *str); #
5.4.15 Draw a pixel!
Input: digole_command = 20;#
digole_x = x;#
digole_y = y;.#
Draw a pixel using current color and drawing mode at (x,y), the current graphic position will not be
changed after this call.#
Function in digole.h: drawPixel(int x, int y); #
5.4.16 Get a pixel!
Page 27 of 31
Digole Digital Solutions
!
Input: digole_command = 21;#
digole_x = x;#
digole_y = y;#
Output: digole_tmpc (R,G,B)#
Draw a pixel data on the screen at position of (x,y).#
Function in digole.h: getPixel(int x, int y); #
#
!
#
!
#
!
#
!
5.4.17 Draw a line!
Input: digole_command = 22;#
digole_graph_x0 = x0;#
digole_graph_y0 = y0;#
digole_graph_x1 = x1;#
digole_graph_y1 = y1;#
Draw a line from (x0,y0) to (x1,y1) using current color, pattern and drawing mode, the current
graphic position will move to (x1,y1) after this API.#
Function in digole.h: drawLine( int x0, int y0, int x1, int y1); #
5.4.18 Move an area!
Input: digole_command = 24;#
digole_graph_x0 = x0;#
digole_graph_y0 = y0;#
digole_graph_x1 = x1;#
digole_graph_y1 = y1;#
digole_graph_width = width;#
digole_graph_height = height;#
Move an area content on the screen, from the top-left of (x0,y0) to new top-left of (x1,y1), with the
area width and height.#
Function in digole.h: moveArea(int x0, int y0, int width, int height, char offset_x, char
offset_y); #
5.4.19 Draw a circle!
Input: digole_command = 26;#
digole_cc_x0 = x0;#
digole_cc_y0 = y0;#
digole_cc_r = r;#
digole_cc_fill = fill;#
Draw a filled or non-filled circle on the screen at the center point of (x0,y0) with the radius of r
using current color and drawing mode, the fill=1, the circle will be filled.#
Function in digole.h: drawCircle(int x0, int y0, int r, unsigned char fill); #
5.4.20 Draw a box!
Input: digole_command = 31;#
digole_graph_x0 = x0;#
digole_graph_y0 = y0;#
digole_graph_width = width;#
Page 28 of 31
Digole Digital Solutions
#
!
#
!
#
!
digole_graph_height = height;#
Draw a filled filled rectangle using current color, pattern and drawing mode, the top-left position is
at (x0,y0), the current graphic position will be changed after this call.#
Function in digole.h: drawBox( int x0, int y0, int width, int height); #
5.4.21 Draw a frame!
Input: digole_command = 32;#
digole_graph_x0 = x0;#
digole_graph_y0 = y0;#
digole_graph_width = width;#
digole_graph_height = height;#
Draw a non-filled filled rectangle using current color, pattern and drawing mode, the top-left
position is at (x0,y0), the current graphic position will be changed after this call.#
Function in digole.h: drawFrame( int x0, int y0, int width, int height); #
5.4.22 Display a bitmap image!
Input: digole_command = 40;#
digole_img_x = x;#
digole_img_y = y;#
digole_img_width = width;#
digole_img_height = height;#
digole_ROM_ptr = *data;#
digole_img_format = 0,1,2,3;#
Draw a bitmap image start at top-left (x,y) with the size of (width, height), the image data is stored
from the address of data.#
This function can draw monochrome, 256 color, 65K color and 262K color format images, their
corresponding format number is: 0, 1, 2 and 3, preset it in digole_img_format.#
Function in digole.h: drawBitmap(int x, int y, int width, int height, const unsigned char
*data);!
drawBitmap256(int x, int y, int width, int height, const unsigned char *data);!
drawBitmap65K(int x, int y, int width, int height, const unsigned char *data);!
drawBitmap262K(int x, int y, int width, int height, const unsigned char *data) #
5.4.23 Fresh the screen!
Input: digole_command = 99;#
This API only work for the DSDM using screen RAM buffer, it force the MCU to send screen data
in buffer to screen, if your DSDM is monochrome screen, you can decide to use screen buffer or
not by setting digole_monobuffer, if digole_monobuffer=1, the MCU will use the screen buffer.#
When the screen buffer is enable, you also can set if the MCU will send screen buffer to screen
after each drawing by setting inst_refresh, if inst_refresh=0, the MCU will not send screen buffer
to screen until you call this API, or set inst_refresh=1, then do another drawing.#
This function will accelerate the speed of drawing on screen, not affect to color display, the MCU
alway drawing in the display’s RAM on color screen.#
Function in digole.h: refreshScreen(); Page 29 of 31
Digole Digital Solutions
5.5 Other setting without a API call!
Some setting don’t need to call the API, you can go ahead to change the data in RAM, and then it will
affect the following drawing:#
!
#
#
5.5.1 Set display mode!
Input: digole_mode;#
Will control the on coming drawing, decide how to do logical operation with exist pixel on screen,
the available setting is: ‘C”-copy(over write), ‘!’- NOT exist pixel, ‘|’- OR with exist pixel, ‘&’- AND
with exist pixel, ‘^’- XOR with exist pixel.#
Function in digole.h: setMode(unsigned char mode); #
5.5.2 Set Line Pattern!
Input: digole_pattern;#
One byte of data define the line, if correspond bit is 1, draw the pixel, otherwise, don’t draw the
pixel, use this to draw dotted line, dash line and more.#
Function in digole.h: setPattern(unsigned char pattern);!
!
#
#
!
#
#
!
#
#
5.5.3 Set Text print position as pixel!
Input: digole_char_x;#
digole_char_y;#
Function in digole.h: setTextPosAbs(unsigned char x, unsigned char y);!
5.5.4 Set graphic position!
Input: digole_Gx;#
digole_Gy;#
This function move current graphic position, it affect the function of draw a line to.#
Function in digole.h: setPrintPos(unsigned char x, unsigned char y,1);!
Page 30 of 31
Digole Digital Solutions
5.6 Other combined function in digole.h!
void nextTextLine(void); !
Description: Move text position to the beginning of next row, the command is: printString("\n\r"); #
Usage: nextTextLine();!
void setTextPosOffset(signed char xoff, signed char yoff); !
Description: Adjust the current text position according the offsets, the offsets can be positive and
negative: digole_char_x += xoffset; digole_char_y += yoffset;#
Usage: setTextPosOffset(10,-2);#
void printDEC(int d);!
Description: Print the integer value as Decimal format on screen at current text position, this function
need call sprintf() in stdio.h#
Usage: printDEC(55); will print “55” on screen!
void printOCT(int d);!
Description: Print the integer value as Octal format on screen at current text position, this function
need call sprintf() in stdio.h#
Usage: printDEC(55); will print “67” on screen!
void printHEX(int d);!
Description: Print the integer value as Hex format on screen at current text position, this function need
call sprintf() in stdio.h#
Usage: printDEC(55); will print “37” on screen!
void printFloat(float d, unsigned char a);!
Description: Print the float value screen at current text position, the parameter a define the precision of
print, this function need call sprintf() in stdio.h#
Usage:printFloat(123.4567,2), will print out: “123.46” on screen!
void drawHLine(int x0, int y0, int x1);!
Description: Draw a horizontal line use current color, pattern and drawing mode#
Usage:drawHLine(10,20,40), will draw a line from (10,20) to (40,20)!
void drawLineTo(int x, int y);!
Description: Draw a line from current graphic position to (x,y) use current color, pattern and drawing
mode, the new current graphic position will be moved to (x,y), the current graphic position are stored in:
digole_Gx and digole_Gy.#
Usage: drawLineTo(100,40), will draw a line from (digole_Gx, digole_Gy) to (100, 40)
Page 31 of 31