Beruflich Dokumente
Kultur Dokumente
2
BEIJING DWIN TECHNOLOGY CO., LTD. PROFESSIONAL, CREDITABLE, SUCCESSFULL
SOFTWARE
DEVELOPMENT
GUIDE V3.2
2012-03-16
Index
1 TEXT ..................................................................................................................................................... 1
1.1 Display Text in Programs Directly (C & ASM51) ..................................................................... 1
1.2 Textbox Format Control ............................................................................................................ 2
1.3 Adjust ASCII Characters Spacing Automatically ....................................................................... 2
1.4 Display Text Without Its Background....................................................................................... 2
1.5 WordArt Characters (Special characters) Display .................................................................... 3
1.6 Vertical Text Display ................................................................................................................. 3
1.7 Numerical Parameter Display .................................................................................................. 4
1.8 Display Rolling Text ................................................................................................................... 5
2 CURVE .................................................................................................................................................. 8
2.1 Move Curve to AchieveDynamic Curve Display....................................................................... 8
2.2 Dynamic Curve: Zoom and Playback History by the Movement of Windows ........................ 9
3 PICTURE, ICON AND ANIMATION ...................................................................................................... 10
3.1 Progress Bar Display ............................................................................................................... 10
3.2 Analog Dial Display ................................................................................................................. 11
3.3 Picture Overlap Display .......................................................................................................... 11
3.4 Backup and Restore Current Screen....................................................................................... 12
3.5 Pointer and Dashboard Display .............................................................................................. 13
3.6 Flowchart Animation (Auto-execution at fixed time) ........................................................... 14
4 TOUCH SCREEN INTERFACE ............................................................................................................... 15
4.1 Touching Function Interface (Programming-free) Design ..................................................... 15
4.2 Input Parameters on Touch Screen ........................................................................................ 16
4.3 Input Chinese with Touch Screen (GBK font) ......................................................................... 17
5 The System Configuration and Peripherals ....................................................................................... 18
5.1 System Configuration Parameters Specification.................................................................... 18
5.2 RTC .......................................................................................................................................... 18
5.3 Backlight Brightness Adjustment and Screensaver Brightness Setting ................................. 21
5.4 Visual Angle Adjustment ........................................................................................................ 21
5.5 Read/Write Intrinsic Database ............................................................................................... 22
5.6 Video Play ............................................................................................................................... 24
5.7 Buzzer...................................................................................................................................... 24
6 RECOMMENDATION OF USERS PROGRAM DESIGN.........................................
7 SOFTWARE RELATED PARAMETERS INSTRUCTIONS ........................................................................ 26
7.1 Font Specification ................................................................................................................... 26
7.2 Picture Storage Quantity ........................................................................................................ 26
7.3 Executive Time of Typical Commands ................................................................................... 27
APPENDIX 1: DWIN UART LCM COMMANDS TABLE ............................................................................ 28
APPENDIX 2: ASM 51 APPLICATION EXAMPLE: CLOCK ........................................................................ 31
APPENDIX 3: ASM 51 APPLICATION EXAMPLE: SIMPLE OSCILLOSCOPE ............................................. 37
APPENDIX 4: C51 SERIAL COMMUNICATION PROGRAM REFERENCE ................................................. 46
APPENDIX 5: C51 FUNCTION PROTOTYPES REFERENCE ...................................................................... 47
1 TEXT
Command Description
0x40 Set palettes
0x42 Select color to the background palette
0x41 Set the character spacing
0x45 Set/cancel the textbox limitation
The configuration display mode:
PARA1.2: 0=normal display 1= 90display
0xE0
PARA2.4(H600 and K600+ only): 0=automatically restore the background when text is
displayed 1=display text in accordance with the specific background color
0x53 Display the 88 string in ASCII, relating to the 0x00 font.
Display the 1212 Chinese string in GBK, relating to the 0x20 font (Chinese) and the
0x6E
0x00 font (ASCII).
Display 1616 Chinese string in GBK, relating to the 0x21 font(Chinese) and the 0x00
0x54
(ASCII).
Display the 2424 Chinese string in GB2312, relating to the 0x22 font(Chinese) and the
0x6F
0x00 font (ASCII)
Display the 3232 Chinese string in GB2312, relating to the 0x23 font(Chinese) and the
0x55
0x00 font (ASCII)
Display any dot matrix and any encoding string, relating to the custom font library. But
0x98
the 0x00 font is used with ASCII on the GB2312 and GBK mode
Cut icon from the specific picture and the background of picture is automatically
0x9C
filtered out. Automatically restore the current background before paste
Cut icon from the specific picture and the background of picture is automatically
0x9D
filtered out.
Parameters are identified and displayed automatically based on parameters displaying
0xC108
in temporary buffer
LOGOD9D(300,200,6);
LOGOD9D(330,200,2);
LOGOD9D(360,200,0);
Use the 0x98 command to set C_Mode.5=1 in order to achieve the vertical text display as shown in
the picture above.
1.7 Numerical Parameter Display
In many cases, in the users program parameters are saved in HEX mode. But it needs to convert into
ASCII code when it is displayed:
INTDSP(100,200,620);
Tips: Users can also use the 0xC108 command to achieve the synchronous display of mass
parameters. (If the display command is sent separately by each parameter when many parameters
are displayed, communication and data processing will take a lot of time. So it is hard to achieve the
synchronous display. The effect of visual parameters will be inconsecutive.)
1.8 Display Rolling Text
In some applications, because of the limitation of display area size or aiming to draw, it requires to
display rolling text.
The entire text can be seen as a string pointer (Array). In fact, roll means continue to modify the
result of the starting position. The horizontally rolling text (Display rolling textbox in single line) is
achieved with 0x71 and 0x98 commands together. The process is shown as follows:
A. Use 0x71 command to restore the background of display area;
B. Use 0x98 command to display the starting text of specific pointers position (Note: when
C_Mode.6=0, text without background color)
C. Modify the pointers position.
Repeat steps A-C recursively to achieve to display rolling text.
If the background of text area is solid color, use the 0x42 command to select color. When using the
0x98 command, if set the background color to display too, it neednt use the 0x71 command to
restore the background and text is displayed very quickly.
Similarly, if the textbox limitation is set with the 0x42 command and the textbox can be seen as a
segment of the text string, you can easily flip up and down rolling easily by modifying the display
buffer pointer.
void hzroll(uint xs, uint ys, uint xe, uint ye, uchar pos, uchar num, uchar *str)
{ uchar i,j,k;
i=uchar(sizeof(str)); // Find out the pointer tials position
logod71(0,xs,ys,xe,ye,xs,ys); // Restore the background
if(pos>i) pos=0;
txword(0xaa98); // Display text
txxy(xs,ys);
txword(0x2381); // The background color does not displayed with 32*32 Chinese //characters
txbyte(0x03);
txword(0xf800); // The color of typeface is red
txword(0x0000);
k=pos;
for(j=0;j<8;j++) // Characters are displays at most 8 characters in each line
{ txbyte(str+k);
k++;
txbyte(str+k);
k++;
if(k>i) k=0;}
pos=pos+2;} // Move the pointers position to achieve the rolling text. Only one //Chinese character
(2 bytes) is moved each time
ASM51 demonstration
JNB RTCOK,START
LCALL HZROLL //The rolling effect is recursively called
CLR RTCOK
TEST: DB 'Dear Customer: We introduce the latest financial management plan to meet your needs!'0FFH,0FFH
CMD71: DW 0AA71H,0,0,440,271,479,0,440,0CC33H,0C33CH,0FEFEH // The 0x71 command format: //AA 71
<Pic_ID> <Xs> <Ys> //<Xe> <Ye> <X> <Y> CC 33
//C3 3C
CMD98: DW 0AA98H,0,440
DB 23H,81H,03H
DW 0F800H,0000H,0FEFEH
JC HZROLL3
MOV DPTR,#TEST
MOV HZ_DPH,DPH
MOV HZ_DPL,DPL
HZROLL3:MOV DPTR,#CMDTTL // CC 33 C3 3C are the end of string
LCALL TXROMS RET
2 CURVE
Command Description
0x40 Set palettes
0x56 Connection line in accordance with the specific points
0xC106 Zoom and display a two-way line chart of window limited with data in temporary buffer
2.1 Move Curve to Achieve Dynamic Curve Display
Procedure:
A. Use the 0x71 command to
restore the background picture on (X,
Ymin) (X+dX, Ymax) area in order to
erase the previous curve;
B. Use the 0x40 command to set a
red foreground color. Use the 0x56
command to connect a red curve
between (X, Y1now-1) and (X+dX,
Y1now);
C. Use the 0x40 command to set a
green foreground color. Use the 0x56
command to connect a green curve
between (X, Y2now-1) and (X+dX,
^2now);
D. Use the 0xD0 command to
compulsively refresh screen once to
ensure a smoothly moving curve;
E. X=x+dx. Repeat steps A-E.
2.2 Dynamic Curve: Zoom and Playback History with the Movement of Windows
Users can temporarily store curves in temporary buffer. The current display window is just a
segment of the entire curves. It is very convenient to move and playback curves by modifying the
staring address in buffer. The result is shown as above.
Automatically zoom the curve in temporary buffer and check the bounds of curves window with the
0xC106 command:
if(RTCOK) // It is time for A/D sampling
{WRbuffer(Buf_adr,rdad(0x00)); // Store A/D values to the temporary buffer
Buf_adr++;
WRbuffer(Buf_adr,rdad(0x01));
Buf_adr++;
if(Buf_adr>40959) Buf_adr=0;}
void DisBufLine(uint adr,unit num,unit color) //Display curves in temporary buffer with the
//0xC106
{txbyte(0xaa);
txword(0xc106);
txword(adr);
txword(xmin);
txword(ymax); // The zero point position in Y axis. Set (ymin+ymax)/2, if the curve is negative
txword(num);
txword(0x0202) //Address intervals is 2 in temporary buffer. X coordinate intervals is 2
txword(0x0102) // Curve is enlarged by 0x01/0x02=0.5 times
txword(color);
txword(ymin); // Display the limitation of curves window
txword(ymax);
txeof();}
The maximal length of DWIN UART LCM buffer is 40Kword and can store 40960/N sampling points at
maximum (N is the curve number). The historical curves can be saved in a time of 204.8 seconds at a
sampling rate of 200SPS (200 records per second) for one curve.
Refer to Appendix 3 to see detailed applications of ASM51 code.
Beijing DWIN Technology Co., Ltd. www.dwin.com.cn/en Tel400-018-9008 9
PROFESIONAL, CREDITABLE, SUCCESSFULL DWIN_UART LCM SOFTWARE DEVELOPMENT GUIDE V3.2
Command Description
0x70 Display a full screen picture saved in the terminal.
Cut an area from a picture which is stored in the terminal and then paste it on the
0x71
current specific position
Cut an area from a picture which is stored in the terminal and then paste it on the
0x9C
current specific position after filtering the background color
Cut an area from a picture which is stored in the terminal and then paste it on the
current specific position after filtering the background color
0x9D
The 0x71 command is automatically executed once before pasting and restoring the
background by the current page.
Cut an area from a picture which is stored in the terminal and then paste it on the
0x9E current specific position after rotating specific angles. You can select to filter the
background color when pasting. H600 and K600+ only
0x97 Displays an icon in ICON library. K600+ only
0xE2 Save current background picture to terminal.
0x59 Display rectangle with the foreground color.
0x69 Display rectangle with the background color.
0x5A Fill the rectangle area with the background color.
0x5B Fill the rectangle area with the foreground color.
0x5C Reverse the specific rectangular area (Restore the original display by reversing again).
0x64 Fill the specific enclosed area
Open/Close to be automatic commands cycle; the configure files of commands are
0x9A
saved in the 0x1C font.
Theoretically, any complexes GUI can be divided into icon to display because 24bit uncompressed
pictures are supported by DWIN HIM.
3.1 Progress Bar Display
Take the progress bar above as an example. The procedure of achieving progress bar includes 5 steps
(Cut pictures to achieve the crystal progress bar):
A. Use the 0x40 command to set the foreground color (Black frame) and background color (The
white background);
B. Use the 0x59 command to draw a frame and use the 0x5A command to fill the background;
C. Use the 0x40 command to set the foreground color (Black characters) and the background
color (The blue progress bar);
D. Use the 0x5A command to fill according to the progress;
E. Display the progress value using the text display does not have background (0x98,
C_Mode.6=0).
stepdsp(100,100,0x0000,0xffff,0x0000,0x001f,100,75)
// Display a progress bar. ( x,y) is the display position. w is the width of progress bar and height is //22. Font is 16 dots
matrix and st is the progress.
void stepdsp(uint x,uint y,uint color1,uint color2,uint color3,uint color4,uchar w,uchar st) setcolor(color1,color2);
fillw(0x59,x,y,x+2+w, y+22);
fillw(0x5a,x+1,y+1,x+3+w,y+21); // Display a solid rectangle
Beijing DWIN Technology Co., Ltd. www.dwin.com.cn/en Tel400-018-9008 10
PROFESIONAL, CREDITABLE, SUCCESSFULL DWIN_UART LCM SOFTWARE DEVELOPMENT GUIDE V3.2
setcolor(color3,color4);
fillw(0x5a,x+2,y+2,x+2+w*st/100,y+20); // Fill the progress bar
hex2dsp(x+w/2,y+3,st); // Display the progress characters with 0x98 command, C_Mode.6=0
print98(0x21,0x81,0x01,color3,color4,x+24+w/2,y+3,"%");}
3.2 Analog Dial Display
The analog dial is actually a nonlinear special progress bar. Directly use the 0x64 command to fill as
shown in the picture below:
// (x, y) is the seed point. Fill the arbitrary boundary around the area with color
void fillfree(uint x,uint y,uint color);
{ txword(0xaa64);
txxy(x,y);
txword(color);
txeof();}
If the area boundary being filled does not connected by the convex polygon, the user program is
needed to fill every area one by one.
3.3 Overlap Picture
Sometimes, pictures are overlap icons with the 0x9D command (Such as the battery icon in the
left-down picture above)
Firstly, design icons and save them in one picture. Note: The background color must be a solid
color (Such as the gray area in the picture). The result is shown as below
Cut the corresponding area and paste it on the specific position with the 0x9D command based
on the requirement, such as the above example:
logod9d(50,70,0,140,40,0,440); // Assume the battery icons are saved in the 50th picture
Note: Automatically restore the background of current picture with the 0x9D command. So restore
the background with the 0x71 command, if paste the icon which is cut from the other picture, and
then display the icon with the 0x9C command.
Recommend to use the 0x97 command in order to design and call icons easily for K600+ kernel DWIN
screen.
As shown in the picture above, users will often meet the occasion of temporary interrupt in
current screen. The description is shown as followings:
Users often need a dialog box (The keyboard in the picture above for instance) in current non-picture
background (Text and curve). The previous background will be recovered after completing operation.
It will be complex to record and refresh the parameters status.
Users can use the 0xE2 and 0x70 commands to solve this problem.
Use the 0xE2 command to backup and save current screen at a valid picture position (Such as
the fiftieth picture) before pop-up windows;
Pop-up Windows;
After finishing the operating windows, use the 0x70 command to restore the previous saved
picture.
The intrinsic picture memory of DWIN UART LCM uses NAND flash, which can save up to 100
thousand times in one picture location.
Users can cut, rotate and paste any picture with the 0x9E command. So the 0x9E command can be
used in many other applications:
The rotation of icons such as motors, gears and other circular motion;
Design some cartoon icons. Modify the rotating angle and rotating center in order to achieve the
rolling and bounce effect using 0x9E command to cut and paste icons.
The Compass display mode: The display contents always points to operators, using the angle
sensors to feedback, control and adjust (The gravity sensors or encoders).
In the processing of display automated flowchart, we hope to show the dynamic process to users. So
it involves a lot of small areas animation (Update contents at fixed time) in order to show the effect
of the users movement, such as the operation of the conveyor, the flowing liquid in the pipeline and
so on.
If these animations rely on the user program to timing refresh, it will cause three problems:
(1) Clients have to write a mass of codes. But these codes have to be modified in order to bring a lot
of workload.
(2) CPU resources will be occupied when data is sent frequently.
(3) High-speed and large-scale animation effects cannot be easily achieved because of the limited
speed of serial communication.
It would be easy to handle these problems using 0x1C configuration files and 0x9A command. The
specific procedure is shown as follows:
A. Edit the animation to display commands into configuration files (Each command group
includes up to 64 commands, at most 8 groups).
B. Download configuration file to 0x1C font library of DWIN terminal
C. In the users program, open or close command groups are automatically executed according
to the needs. Command groups will be automatically executed in accordance with the setting
interval time after opening command groups. They are not interrupted by the customers programs.
void cmdon(uchar cmd_id)
{ txword(0xaa9a);
txbyte(cmd_id); // Open cmd_id specific command group
txeof();}
void cmdoff()
{ txword(0xaa9a);
txbyte(0xff); //Close command group auto execution
txeof();}
Users want to pop-up the left-up dialog when clicking on the right-down Clock icon, and use this
keyboard dialog to modify the time of clock. In this case, the 0x7C01 touch screen ASCII input
command could be used to achieve this function easily.
uchar CMD7C[]={0xaa,0x7C,0x01,0x00,0x01,0,1,0,34,0,40,12,3,0,0,0xcc,0x33,0xc3,0x3c};
Users need to modify 24 different English/Chinese parameters with the touch screen using the
0x7C02 English/Chinese characters input command. Calling program of 0x7C02 command and
0x7C01 command are basically the same. This is ASM51 codes below:
MOV A,RXCMD ; Valid data frame is received with Serial port
CJNE A,#78H,START2 ;Touching function key code
MOV DPTR,#CMD7C1 ;Open English/Chinese input method
LCALL TXROMS
MOV R0,#RXDAT
MOV R7,#2 ;Use key code as the index of parameter return
LCALL TXREG
MOV DPTR,#CMD7C2
LCALL TXROMS
LJMP STARTE
START2: CJNE A,#7CH,STARTE ;Finish and return the touch screen input
MOV DPTR,#CMD70 LCALL
TXROMS ; Return screen 0
MOV A,RXDAT
CJNE A,#02H,START20
MOV A,RXIDL ; Preinstalled R_ID to direct the parameter to be modified
MOV B,#32
MUL AB
MOV DPH,B
MOV DPL,A
MOV R0,#RXNUM
MOV A,@R0 JZ STARTE ; Length of returned parameters data
LCALL WRXRAM ; Save parameters
0x7C, H600 and k600+ only
Command Description
0x5E Turn off the background or set the backlight mode of touching function
0x5F Adjust backlight brightness
0x79 The specific length time of buzzer
0x9B Clock on/off RTC in current interface
0x9B5A Read RTC time in Gregorian calendar
0x9B5B Read RTC time in Traditional Chinese calendar
0xE7 Adjust RTC time
Modify backlight, buzzer, visual angle and serial port mode. Parameters will be saved
0xE0
when power is off
0x90 Write intrinsic database
0x91 Read intrinsic database
0x7A Shitting between UART LCM and video function
0xD0 Refresh a full screen compulsively once (K600, H600 and K600+ only)
5.1 System Configuration Parameters Specification
The sent and returned commands
Tx: AA E0 55 AA 5A A5 <TFT_ID> <Bode_Set> <Para1> <Para2> CC 33 C3 3C
Rx: AA E0 <TFT_ID> <Bode_Set> <Para1> <Para2> CC 33 C3 3C
The 0xE0 command parameters will not be saved when power is off. Please use the tool software
which is provided by DWIN, if users need to save permanently when power is off.
<TFT_ID>: Configure TFT panel parameters; (V5.3 or later versions are not open to users, please
write 0x00):
<Bode_Set>: <Bode_Set>: Set the baud rate of serial communication:
Bode_set 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07
Baud rate 1200 2400 4800 9600 19200 38400 57600 115200
The following baud rate is not supported by the PC port, please set carefully
Bode_set 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F
Baud rate 28800 76800 62500 125000 250000 230400 345600 691200
The following baud rate is only supported by K600+ kernel serial port setting
Bode_set 0x10
Baud rate 921600
<Para1>: Configure the touch screen and the keyboard work mode as follows:
Para1 Bit Description
0= After clicking on the touch screen, the 0x73 command is automatically
uploaded when releasing the touch screen. It must be set to 0 in the touch
.7 mode.
1= After clicking on the touch screen, it does not upload 0x72 command when
leaving the touch screen.
In the coordinates returning mode:
0=After clicking on the touch screen, the 0x73 command is automatically
uploaded with the interval of time of 100 ms until releasing the touch screen.
.6
1=After clicking on the touch screen, the 0x73 command is automatically
uploaded only once.
On the touch mode, Para1.0=1:
Beijing DWIN Technology Co., Ltd. www.dwin.com.cn/en Tel400-018-9008 18
PROFESIONAL, CREDITABLE, SUCCESSFULL DWIN_UART LCM SOFTWARE DEVELOPMENT GUIDE V3.2
5.2 RTC
Most of DWIN UART LCM has the intrinsic 2000-2099 RTC. RTC can be read and modified with
commands. Or RTC is automatically overplayed on the specific background pictures according to the
users need.
UART LCM has intrinsic backup battery. RTC will run regularly when power is off.
void rtcon(unit x,unit y,unit color,uchar mode,uchar scale) //Activate RTC overlying display on (x,y)
{ txword(0xaa9b);
txbyte(0xff);
txbyte(mode);
txbyte(scale);
txword(color);
txxy(x,y);
txeof();}
void rtcset(uchar *s) //Set RTC, S=YYMMDDHHMMSS, BCD code, such as 0x11 0x07 0x25 0x12
//0x00 0x00
{ txword(0xaae7);
txword(0x55aa);
txword(0x5aa5);
txstr(s);
txeof();}
void rdrtc_en() //Read the Gregorian calendar and return BCD code. The format is YY MM DD
//WW HH MM SS. WW is represented week.
{ txword(0xaa9b);
txbyte(0x5a);
txeof();}
DWIN Technology in the pictures above are written on (0,0) with the text display command. Users
must implement particular settings when downloading pictures. The picture is shown as follows:
Select Toolbar
0 =0and 180
90 =90and 270.
void rddbaser(uint adr,uint len,uchar *s) //Read the random data memory
{uint i;
txword(0xaa91);
txword(0x01de);
txword(adr);
txword(len);
txeof(); //Receive data. Serial port must be big enough if read-back data is excessive. Otherwise take the inquiry
//receiving mode as follows
EA=0; //Close interrupt
while(!(RXDATA==0xaa)) rxbyte(200); //Receive a byte in serial port. Exit if serial port does not received or
//exceed time in 200ms
for(i=0;i<6;i++)
{rxbyte(200);}
for(i=0;i<len;i++)
{rxbyte();
*s=RXDATA;
s++;}
EA=1;}
Beijing DWIN Technology Co., Ltd. www.dwin.com.cn/en Tel400-018-9008 22
PROFESIONAL, CREDITABLE, SUCCESSFULL DWIN_UART LCM SOFTWARE DEVELOPMENT GUIDE V3.2
The users program is basically simplified into two functions for the users who use DWIN UART LCM
as human-machine interface, especially DWIN UART LCM touch screen users:
The user is very familiar with the realization of products algorithm function, such as data
collection, peripheral control and so on.
Normally the user is not very familiar with the realization of human-machine interface
function with DWIN UART LCM.
DWIN UART LCM is communicated through the serial port with user programs which are the
relatively independent system and manage the random cases (communicate with the user). But the
algorithm function deals with fixed cases. So programs should be structured in the method as
following in order to improve the efficiency of the R&D and program stability:
Adopt the program structures of the foreground/background. The applications programs
are put in the foreground to be managed with the query and scan mode. The programs which
directly communicate with hardware are put in the background and managed by interrupt mode,
such as serial port, A/D conversion
The foreground and background programs are exchanged data by memory (The global
variable).
The foreground programs are triggered by background message.
Use a timer to generate intrinsic order to coordinate the different application programs.
All of the programs are designed into the independent parallel subroutines in the
foreground according to functions in order to be tested and transmitted (Several engineers can
work independently at the same time and integrate after testing).
Application 1 Application 2 Application N Message
Processing
System Clock
Hardware Interface
Picture/Icon 0x7B Draw a full screen picture and calculate CRC checksum
0x71 Cut icon from the specific picture and paste to the current page
Cut icon from the specific picture to filter out background and
0x9C paste to the current page. Automatically restore the original
background before paste
Cut icon from the specific picture to filter out the background and
0x9D
paste to the current page.
Cut icon from the specific picture and paste to the current page
0x9E after rotate specific angles. You can select to filter out
background. 0x9E, H600 only
0xE2 Save the current picture to the terminal
0x97 Draw ICON (The maximum size is 255*255). K600+ only
0x99 Users define icon display
Refresh a full screen compulsively once. K600, K600+ and H600
0xD0
only
Animation
0x9A Open/Close automatic execution command set that users presets
Support
0xC0 Write data to temporary buffer
0xC101 Display data points of temporary buffer
0xC102 Display data lines of temporary buffer
Display line chart with date point in temporary buffer (Zoom
0xC103
Temporary dynamic curve)
buffer High-speed no flashing with date point in temporary buffer
0xC104
operation (Oscilloscopes)
(1280*800 and 0xC105 Zoom and display line chart with data in temporary buffer
1365*768 Zoom and display window to limit the two-way line chart with
0xC106
dont data in temporary buffer
supported by 0xC107 Empty the pixel buffer
DWIN) 0xC107 Put pixel in the pixel buffer
0xC107 Restore the pixel buffer to the current page
0xC108 Display parameters with temporary buffer
0xC110 Simultaneous display by the command of temporary buffer
0xC2 Read data back from temporary buffer
0xF2 Download font (Download ICON picture library must use SD card)
Database
0x90 Write date to users database
Operation
0x91 Read date from users database
Keyboard 0x71 Upload key code
Operation 0xE5 Configure the key code interface
After releasing touch screen, upload data the last time (Set to turn
0x72
off with the 0xE0 command)
After press touch screen, upload data (Set to upload only once
0x73
with the 0xE0 command)
Touch Screen
0xE4 Touch screen calibration
Operation
In the touching function interface auto-switch mode, when touch
0x78
screen is released, the default key code is automatically uploaded
In the touch interface auto-switch mode, when touch screen is
0x79
pressed, the default key code is automatically uploaded
Beijing DWIN Technology Co., Ltd. www.dwin.com.cn/en Tel400-018-9008 29
PROFESIONAL, CREDITABLE, SUCCESSFULL DWIN_UART LCM SOFTWARE DEVELOPMENT GUIDE V3.2
Design hands of clock with DMG80600S104_02WT. Rotate the hands with 0x9E command and modify
time with 0x7C command on touch screen.
$include (MOD52)
SYSFLG EQU 20H
TI0FLG BIT SYSFLG.7 ;Send a TI sign back to main programs serial port
RXAAOK BIT SYSFLG.6 ;0xAA frame header is connected to serial port
RXFRMOK BIT SYSFLG.5 ; Data frames are received by serial port
RTCOK BIT SYSFLG.4 ; 250ms timer sign
RTC250 EQU 30H ;The times are counted by timer in 100mS
RTCOLD EQU 31H
RXCC EQU 43H ; Judge the array with the terminator frames which are received by serial port
RX33 EQU 44H
RXC3 EQU 45H
RX3C EQU 46H
RXPOS EQU 47H ; 48H-9FH
RXCMD EQU 48H ;The buffer is received with the serial port 48H-67H, at most
32Byte
RXDAT EQU 49H
RTCYEAR EQU 4AH
RTCMON EQU 4BH
RTCDAY EQU 4CH
RTCWEK EQU 4DH
RTCHR EQU 4EH
RTCMIN EQU 4FH
RTCSEC EQU 50H
ORG 0000H
LJMP MAIN
ORG 000BH
LJMP SYSCLK ;The 10ms timer
ORG 0023H
LJMP UARTPRO ; Serial port interrupt (IRQ)
ORG 0080H
MAIN: CLR EA
MOV SP,#68H
ORL PCON,#80H ;The initialize serial port
Beijing DWIN Technology Co., Ltd. www.dwin.com.cn/en Tel400-018-9008 31
PROFESIONAL, CREDITABLE, SUCCESSFULL DWIN_UART LCM SOFTWARE DEVELOPMENT GUIDE V3.2
MOV SCON,#50H
MOV TMOD,#21H
MOV TH1,#255 ;115200 bps 115200/(256-TH1)
MOV TL1,#255
SETB TR1
MOV TH0,#0B8H ;10ms
MOV TL0,#00H
SETB TR0
MOV RTC250,#200
MOV SYSFLG,#00H
SETB ET0
SETB ES
SETB EA
JNB RTCOK,$
CLR RTCOK ; Delay 2s when power is on
MOV A,#00H
LCALL PICDSP
MOV DPTR,#RTCON
LCALL TXROMS
MOV RTCOLD,#00H
; Different modules are triggered by checking messages in the foreground programs part
START: JNB RTCOK,START1
MOV DPTR,#RDRTC
LCALL TXROMS
CLR RTCOK
START1: JNB RXFRMOK,START
MOV A,RXCMD ;Valid data frames are received by the serial port
CJNE A,#9BH,START2
MOV A,RXDAT
CJNE A,#5AH,STARTE
LCALL RTCDSP ; Display the pointers position
LJMP STARTE
START2: CJNE A,#78H,START3
MOV DPTR,#CMD7C ;Modify the time
LCALL TXROMS
LJMP STARTE
START3: CJNE A,#7CH,STARTE ;The input is over and return
MOV A,#00H
LCALL PICDSP
MOV A,RTCDAY
CJNE A,#12,STARTE
LCALL WRRTC
STARTE: CLR RXFRMOK
LJMP START
LCALL TXROMS
MOV R0,#RTCWEK
MOV R1,#6
WRRTC1: MOV A,@R0
CLR C
SUBB A,#30H
SWAP A
MOV R7,A
INC R0
MOV A,@R0
INC R0
CLR C
SUBB A,#30H
ADD A,R7
LCALL TXBYTE
DJNZ R1,WRRTC1
MOV DPTR,#CMDTTL
LCALL TXROMS
RET
MOV A,@R0
MOV B,#12
MUL AB
MOV R7,B
MOV R6,A
MOV R0,#RTCSEC
MOV A,@R0
MOV B,#5
DIV AB
ADD A,R6
MOV R6,A
CLR A
ADDC A,R7
MOV R7,A
MOV DPTR,#MINPOS
LCALL TXROMS
MOV A,R7
LCALL TXBYTE
MOV A,R6
LCALL TXBYTE
MOV DPTR,#RTCCEN
LCALL TXROMS
; Calculate the angle of SEC
MOV R0,#RTCSEC
MOV A,@R0
MOV B,#12
MUL AB
MOV R7,B
MOV R6,A
MOV DPTR,#SECPOS
LCALL TXROMS
MOV A,R7
LCALL TXBYTE
MOV A,R6
LCALL TXBYTE
MOV DPTR,#RTCCEN
LCALL TXROMS
MOV DPTR,#CMDD0
LCALL TXROMS
RET
; Send a fixed data string to the serial port. 0xFE is the end of the data string
TXROMS: CLR A
MOVC A,@A+DPTR
CJNE A,#0FEH,TXROMS1
RET
TXROMS1:MOV SBUF,A
INC DPTR
JNB TI0FLG,$
CLR TI0FLG
SJMP TXROMS
RET
; The service programs of the interrupt in background
;***************The service programs of serial port interrupt *************
UARTPRO:PUSH ACC
PUSH PSW
SETB RS0
SETB RS1
JB RI,UARTRCV
CLR TI
SETB TI0FLG
LJMP UARTEND
UARTRCV:MOV A,SBUF
CLR RI
JB RXFRMOK,UARTEND ;Data is not processed in the serial port
JB RXAAOK,URCVD
CJNE A,#0AAH,UARTEND
SETB RXAAOK
MOV RXPOS,#RXCMD
LJMP UARTEND
URCVD: MOV R0,RXPOS
MOV @R0,A
INC RXPOS
MOV RXCC,RX33
MOV RX33,RXC3
MOV RXC3,RX3C
MOV RX3C,A
CJNE A,#3CH,UARTEND
MOV A,RXC3
CJNE A,#0C3H,UARTEND
MOV A,RX33
CJNE A,#33H,UARTEND
MOV A,RXCC
CJNE A,#0CCH,UARTEND
SETB RXFRMOK
CLR RXAAOK
UARTEND:POP PSW
POP ACC
RETI
;*************** The service programs of the 10ms timer interrupt***********
SYSCLK: PUSH PSW
CLR TF0
MOV TH0,#0B8H
MOV TL0,#00H
DJNZ RTC250,SYSCLKE
MOV RTC250,#10 ;100ms timer
SETB RTCOK
SYSCLKE:POP PSW
RETI
CMD7C: DB 0AAH,71H,01H ; Switch keyboard on the first page to the current page
DW 0,0,206,344,0,0
DB 0CCH,33H,0C3H,3CH
DB 0AAH,07CH,01H,00H,01H ; Input 12 ASCII characters to modify the clock with English
DW 1,34,40,0C03H,0000H
DB 0CCH,33H,0C3H,3CH,0FEH
CMD71: DB 0AAH,71H,00H
DW 207,96,593,520,207,96,0CC33H,0C33CH,0FEFEH ;Recover the background of the dashboard
HRPOS: DB 0AAH,9EH,00H,00H,01H ;The positions of hour, minute and second hand icons
DW 449,281,494,432,471,382,0FEFEH
MINPOS: DB 0AAH,9EH,00H,00H,01H
DW 383,248,427,434,406,382,0FEFEH
SECPOS: DB 0AAH,9EH,00H,00H,01H
DW 335,232,374,434,356,382,0FEFEH
RTCCEN: DW 386,301,0CC33H,0C33CH,0FEFEH ;The center of the rotation dashboard
CMDTTL: DB 0CCH,33H,0C3H,3CH,0FEH ; Frame terminators
END
Collect electrets Mic output voice signal and display them based on DMG80480C070-01WT with the
C8051F410 which is intrinsic 12bit A/D. Zoom in and zoom out X axis (Time) and Y axis (Amplitude) by
the 0xc106 command.
ORG 0000H
LJMP MAIN
ORG 0023H
LJMP UARTPRO ; The serial port interrupt (IRQ)
ORG 002BH
LJMP SYSCLK ; 0.4ms timer is used for A/D sampling
ORG 0100H
MAIN: CLR EA
MOV SP,#0B0H
LCALL INITCPU ; Set the serial port is 115200bps and 8n1 mode
MOV SYSFLG,#00H
SETB ES0 ; Open the serial port interrupt (IRQ)
SETB ET2 ;Open timer 2 interrupt10ms system timer
MOV ADS_H,#00H
MOV ADS_L,#00H
SETB EA
LCALL ACKLCD ; Check the UART LCM power is on or off.
MOV A,#00H
LCALL PICDSP
CLR EA
MOV ADS_H,#00H
MOV ADS_L,#00H
MOV ADT_H,#00H
MOV ADT_L,#00H
MOV ADN_H,#00H
MOV ADN_L,#00H
MOV C0_DPH,#00H
MOV C0_DPL,#00H
MOV KX,#3
MOV KY,#1
SETB EA
LCALL XYDSP ; Show XY magnification
START: CPL WDT
JNB RXFRMOK,START1
MOV A,RXCMD ; The valid data frames are received by serial port
CJNE A,#78H,START0E ; The touching function command
MOV A,RXDAT1
CJNE A,#00H,START01 ; The X magnification
MOV A,KX
CLR C
SUBB A,#9
JNC START0E
INC KX
LJMP START0E
START01:CJNE A,#01H,START02 ; X Narrow
MOV A,KX
JZ START0E
DEC KX
LJMP START0E
START02:CJNE A,#02H,START03 ; Y magnification
MOV A,KY
CLR C
SUBB A,#9
JNC START0E
INC KY
LJMP START0E
START03:CJNE A,#03H,START0E ; Y Narrow
MOV A,KY
JZ START0E
DEC KY
START0E:CLR RXFRMOK
LCALL XYDSP
START1: MOV DPTR,#60 ; Improve the efficiency of the serial if buffer data is over 120
bytes
CLR C
MOV A,ADN_L
SUBB A,DPL
MOV A,ADN_H
SUBB A,DPH
JC START
CLR EA
MOV A,ADN_L
CLR C
SUBB A,DPL
MOV ADN_L,A
MOV A,ADN_H
SUBB A,DPH
MOV ADN_H,A
SETB EA
MOV A,KX ;Calculated data to display the points of R7:R6 according to
the X axis amplifier
CLR C
RLC A
PUSH ACC
MOV DPTR,#NUM_TAB
MOVC A,@A+DPTR
MOV R7,A
POP ACC
INC A
MOVC A,@A+DPTR
MOV R6,A
MOV A,#0AAH
LCALL TXBYTE
MOV A,#0C0H
LCALL TXBYTE
MOV A,C0_DPH
LCALL TXBYTE
MOV A,C0_DPL
LCALL TXBYTE
MOV DPH,ADT_H
MOV DPL,ADT_L
MOV R1,#60
START11:MOVX A,@DPTR
INC DPTR
LCALL TXBYTE
MOVX A,@DPTR
INC DPTR
LCALL TXBYTE
ANL DPH,#03H
MOV ADT_H,DPH
MOV ADT_L,DPL
MOV A,C0_DPL
ADD A,#01H
MOV C0_DPL,A
CLR A
ADDC A,C0_DPH
MOV C0_DPH,A ;C0_DPTR++
CLR C
MOV A,R6
SUBB A,C0_DPL
MOV A,R7
SUBB A,C0_DPH
JNC START12
SETB NUMOK
MOV C0_DPH,#00H
MOV C0_DPL,#00H
LJMP START13
START12:DJNZ R1,START11
CLR NUMOK
START13:MOV DPTR,#CMDTTL
LCALL TXROMS
JNB NUMOK,START2
MOV DPTR,#CMDC106A ;Show the curve
LCALL TXROMS
MOV A,R7
LCALL TXBYTE ;Show the number of curve
MOV A,R6
LCALL TXBYTE
MOV DPTR,#CMDC106B
Beijing DWIN Technology Co., Ltd. www.dwin.com.cn/en Tel400-018-9008 40
PROFESIONAL, CREDITABLE, SUCCESSFULL DWIN_UART LCM SOFTWARE DEVELOPMENT GUIDE V3.2
LCALL TXROMS
MOV A,KX
INC A
LCALL TXBYTE
MOV A,KY ; amplification rate from 1 to 10
INC A
LCALL TXBYTE
MOV DPTR,#CMDC106C
LCALL TXROMS
MOV DPTR,#CMDD0
LCALL TXROMS
START2: NOP
LJMP START
; Send the 0x00 handshake command to confirm the UART LCM power is on.
ACKLCD: CLR RXFRMOK
ACKLCD1:MOV DPTR,#CMD00
LCALL TXROMS
CLR RTCOK
MOV RTC250,#100
JNB RTCOK,$
CLR RTCOK
JNB RXFRMOK,ACKLCD1
CLR RXFRMOK
MOV A,RXCMD
CJNE A,#00H,ACKLCD1
RET
DW 25,208,0FEFEH
CMDC106B:DB 01H,0FEH
CMDC106C:DB 1
DW 0F800H,8,408,0CC33H,0C33CH,0FEFEH
CMD00: DB 0AAH,00H,0CCH,033H,0C3H,3CH,0FEH
CMDTTL: DB 0CCH,33H,0C3H,3CH,0FEH
; Send a fixed data to the serial port to judge the end data string 0xFE0xFE
TXROMS: CLR A
MOVC A,@A+DPTR
CJNE A,#0FEH,TXROMS1
RET
TXROMS1:MOV SBUF0,A
INC DPTR
JNB TI0FLG,$
CLR TI0FLG
CPL WDT
SJMP TXROMS
RET
MOV R5,A
SYSCK1: MOV DPH,ADS_H
MOV DPL,ADS_L
MOV A,R5
MOVX @DPTR,A
INC DPTR
MOV A,R4
MOVX @DPTR,A
INC DPTR
ANL DPH,#03H
MOV ADS_H,DPH
MOV ADS_L,DPL
MOV A,ADN_L
ADD A,#01H
MOV ADN_L,A
CLR A
ADDC A,ADN_H
MOV ADN_H,A
SYSCK2: DJNZ RTC250,SYSCLKE
MOV RTC250,#250 ;100ms timer
SETB RTCOK
SYSCLKE:POP DPL
POP DPH
POP PSW
RETI
MOV XBR0,#01H
MOV XBR1,#40H
MOV OSCXCN,#00H
MOV OSCICN,#0C7H
CLR A
DJNZ ACC,$
CPL WDT
MOV CLKMUL,#00H
NOP
ORL CLKMUL,#03H
NOP
ORL CLKMUL,#10H
NOP
ORL CLKMUL,#80H
NOP
CLR A
DJNZ ACC,$
NOP
ORL CLKMUL,#0C0H
NOP
OSCWT2:MOV A,CLKMUL
JNB ACC.5,OSCWT2
NOP
MOV CLKSEL,#02H ; 49MHz SYSTEM CLOCK
MOV A,#07H ; Set the baud rate of the serial port, 7=115200
MOV B,#2
MUL AB
MOV DPTR,#BODE_TAB
MOV B,A
MOVC A,@A+DPTR
MOV CKCON,A
MOV A,B
INC DPTR
MOVC A,@A+DPTR
MOV TH1,A
MOV TL1,A
MOV SCON0,#50H
SETB TR1
MOV TMR2RLH,#0F9H ;2ms=0DF73 1ms=EFB9 0.4ms=F97D
MOV TMR2H,#0F9H
MOV TMR2RLL,#07DH
MOV TMR2L,#07DH
MOV TMR2CN,#04H
MOV IE,#00H
MOV EIE1,#00H
MOV REF0CN,#33H
MOV ADC0MX,#0CH ;A/D=P1.4
MOV ADC0CF,#28H ;AD converts the clock to the system clock. The system clock is 10 points
frequency
MOV ADC0CN,#90H ; AD is converted by AD0BUSY
MOV ADC0TK,#0CH ;AD is only converted once
RET
; Baud rate register table 1.2 2.4 4.8 9.6 19.2 38.4 57.6 115.2
; 0=2041667 1=6125000 2=510417
BODE_TAB:DB 2,43 ;2400 00
DB 2,43 ;2400 01
DB 2,150 ;4800 02
DB 0,43 ;9600 03
DB 0,150 ;19200 04
DB 1,96 ;38400 05
DB 1,150 ;57600 06
DB 1,203 ;115200 07
END
bit RXAAOK; // The 0xAA frame header is connected to the serial port
bit RXFRMOK; // A valid data frame is received by serial port
bit TI0FLAG; //Send a TI sign back to the main programs serial port
uchar RXBUF[32]; // Buffer is received and saved by serial port. But the buffer must be remove 0XAA frame head and
//the UART LCM response of un-fixed format has the length return. So it needs to record length
uchar Rx_P; // Data position is received and saved by serial port
if(RXFRMOK) //Check it whether the UART LCM data is received by serial port in foreground //main program
{ if(RXBUF[0]==0x78) //Touching function buttons
{}
if(RXBUF[0]==0x7C) // Pinyin input is over on touch screen
{}
RXFRMOK=0; //Finish and clear messages
}
void T2_ISR(void) interrupt 5 //The system timing and demonstrate are generated with 10ms timer interrupt 2
{ TF2H=0;
RTCOK=1;
if(delay10ms) delay10ms--;} //Delay10ms. RTCOK is the global variable
void acklcd() //When power is on, send the 0x00 handshaking command to check whether LCD is ready.
//Otherwise waiting LCD is ready.
{ RXFRMOK=0;
while(RXFRMOK==0)
{ txword(0xaa00);
txeof();
delay10ms(10);}
RXFRMOK=0;}
void txbyte(uchar i) //A byte is sent to serial port with the query mode
{ SBUF=i;
whilie(TI0FLG==0);
TI0FLG=0;}
void txarea(uint xs,uint ys,uint xe,unit ye) // Send coordinates of the rectangle area to the serial //port
{ txword(xs);
txword(ys);
txword(xe);
txword(ye);}
void txstr(uchar *s) //Send strings to the serial port. 0x00 is the end of string
{ while(*s)
{ txbyte(*s);
s++;}}
void txroms(uchar *s) //Send strings to the serial port. 0xFE is the end of string
{ whilie(!(*s==0xFE))
{ txbyte(*s);
s++;}}
void piccut(uint cmd,uint p,uint xs,uint ys,uint xe,uintye,unit x,uint y) // Display the cutting icons
{ txbyte(0xaa);
txbyte(cmd);
txword(p);
txarea(xs,ys,xe,ye);
txxy(x,y);
txeof();}
void prints(uchar cmd,uint x,uint y,uchar *s) //0x00 is the end of string when string is displayed by other commands
//except the 0x98 command.
{ txbyte(0xaa);
txbyte(cmd);
txxy(x,y);
txstr(s);} // If the frame terminator does not included by the pointer string, it needs to require to additionally
//send the frame terminator.
// 0xfe is the end of string when string is displayed by the 0x98 command
void print98(uchar lib,uchar mode,uchar dot,uint color,uint bcolor,uint x,uint y uchar *s)
{ txword(0xaa98);
txxy(x,y);
txbyte(lib);
txbyte(mode);
txbyte(dot);
txxy(color,bcolor);
txroms(s);} // If the frame terminator does not included by the pointer string, it needs to require to additionally
//send the frame terminator.
void fillw(uchar cmd,uint xs,uint ys,uint xe,uint ye) //Area commands: 0x590x690x5A0x5B0x5C
{ txbyte(0xaa);
txbyte(cmd);
txarea(xs,ys,xe,ye);
txeof()}
Beijing DWIN Technology Co., Ltd. is a leading global company with cutting-edge
technology mainly focuses on UART LCM (Industrial serial port screen) researching,
manufacturing and sales.
DWIN has 150 employees across China. We located in the central area of Zhong Guancun,
where is well-known as Chinese Silicon Valley. Branches and regional offices have
established in Shenzhen, Shanghai, Northern Europe and the United States sales
channels have established in India, Turkey and Brazil around globe. And sterilized
assembly line, enhanced the QC centre, laboratory and aging test workshop have
established in Beijing Shangdi Information Industry Base which are a total area about
5000 m2 .
With the effort of ninth years devotion, we have been following the philosophy of
Professional, Creditable and Successful, and achieving doubled increase in annual
average sales that stressed to create value for customers in order that customers and
our company rapidly improve and develop together. Relying on product function, quality,
service, price and competitive advantage, DWIN focuses on industrial TFT display market,
especially in reliability-em0070hasized industry fields, which include engineering
machinery, medical instruments as well as high-level civilian goods. Our products have
been gained reputation from clients all over the world with satisfactory services, such as
CHINA SANY Group , GM , SIEMENS and other customers.
Our goal is go after Double Win between customers and our company, realizing joint
growth by market-oriented and technology innovations and being as an ideal partner.
Tel: 400-018-9008
You can also call the following telephone:
Product Purchase: 010-62104079 62101462 62104686
Technical Support: 010-62555372 62102321 62102090
Complaint: 010-62101180
Head Office: 010-62102630 62105007 62636805
Fax: (86) 10-62628562
Website: www.dwin.com.cn/en