📄 input.s
字号:
.module input.c
.area lit(rom, con, rel)
_Key_Data::
.word 50
.byte 80
.word 50
.word 50
.byte 30
.byte 30
.byte 28
.word L1
.word L2
.byte 224
.byte 1
.byte 28
.word 110
.byte 80
.word 50
.word 50
.byte 30
.byte 30
.byte 28
.word L3
.word L4
.byte 224
.byte 1
.byte 28
.word 170
.byte 80
.word 50
.word 50
.byte 30
.byte 30
.byte 28
.word L5
.word L6
.byte 224
.byte 1
.byte 28
.word 230
.byte 80
.word 50
.word 50
.byte 30
.byte 30
.byte 28
.word L7
.word L8
.byte 224
.byte 1
.byte 28
.word 50
.byte 113
.word 50
.word 50
.byte 30
.byte 30
.byte 28
.word L9
.word L10
.byte 224
.byte 1
.byte 28
.word 110
.byte 113
.word 50
.word 50
.byte 30
.byte 30
.byte 28
.word L11
.word L12
.byte 224
.byte 1
.byte 28
.word 170
.byte 113
.word 50
.word 50
.byte 30
.byte 30
.byte 28
.word L13
.word L14
.byte 224
.byte 1
.byte 28
.word 230
.byte 113
.word 50
.word 50
.byte 30
.byte 30
.byte 28
.word L15
.word L16
.byte 224
.byte 1
.byte 28
.word 50
.byte 146
.word 50
.word 50
.byte 30
.byte 30
.byte 28
.word L17
.word L18
.byte 224
.byte 1
.byte 28
.word 110
.byte 146
.word 50
.word 50
.byte 30
.byte 30
.byte 28
.word L19
.word L20
.byte 224
.byte 1
.byte 28
.word 170
.byte 146
.word 50
.word 50
.byte 30
.byte 30
.byte 28
.word L21
.word L22
.byte 224
.byte 1
.byte 28
.word 230
.byte 146
.word 50
.word 50
.byte 30
.byte 30
.byte 28
.word L23
.word L24
.byte 224
.byte 1
.byte 28
.word 50
.byte 179
.word 82
.word 82
.byte 30
.byte 30
.byte 28
.word L25
.word L25
.byte 224
.byte 0
.byte 28
.word 197
.byte 179
.word 83
.word 83
.byte 30
.byte 30
.byte 28
.word L26
.word L26
.byte 224
.byte 0
.byte 28
.word 140
.byte 179
.word 50
.word 50
.byte 30
.byte 30
.byte 28
.word L27
.word L27
.byte 224
.byte 1
.byte 28
.dbfile F:\Relations\sf6_system\measure\LCDtest\input.c
.dbstruct 0 17 Command
.dbfield 0 x i
.dbfield 2 y c
.dbfield 3 width i
.dbfield 5 width_e i
.dbfield 7 lenth c
.dbfield 8 lenth_e c
.dbfield 9 color c
.dbfield 10 str pc
.dbfield 12 english pc
.dbfield 14 string_color c
.dbfield 15 font c
.dbfield 16 cursor_color c
.dbend
.dbsym e Key_Data _Key_Data A[255:15]kS[Command]
.area text(rom, con, rel)
.dbfile F:\Relations\sf6_system\measure\LCDtest\input.c
.dbfunc e GetCursor _GetCursor fc
; Cursor_data -> R16,R17
.even
_GetCursor::
.dbline -1
.dbline 28
; #include <iom128v.h>
; #include "lcd.h"
; #include "display.h"
; #include "touch.h"
;
; unsigned char input_buffer[10];
; #define Key_Data_size 15
; struct Command const Key_Data[]=
; {
; {50,80,50,50,30,30,GREEN," 1","1",RED,BIG,GREEN,},//1
; {110,80,50,50,30,30,GREEN," 2","2",RED,BIG,GREEN,},//2
; {170,80,50,50,30,30,GREEN," 3","3",RED,BIG,GREEN,},//3
; {230,80,50,50,30,30,GREEN," 4","4",RED,BIG,GREEN,},//4
; {50,113,50,50,30,30,GREEN," 5","5",RED,BIG,GREEN,},//5
; {110,113,50,50,30,30,GREEN," 6","6",RED,BIG,GREEN,},//6
; {170,113,50,50,30,30,GREEN," 7","7",RED,BIG,GREEN,},//7
; {230,113,50,50,30,30,GREEN," 8","8",RED,BIG,GREEN,},//8
; {50,146,50,50,30,30,GREEN," 9","9",RED,BIG,GREEN,},//9
; {110,146,50,50,30,30,GREEN," 0","0",RED,BIG,GREEN,},//0
; {170,146,50,50,30,30,GREEN," +","+",RED,BIG,GREEN,},//+
; {230,146,50,50,30,30,GREEN," -","-",RED,BIG,GREEN,},//-
; {50,179,82,82,30,30,GREEN,"Backspace","Backspace",RED,SMALL,GREEN,},//Backspace
; {197,179,83,83,30,30,GREEN," Enter"," Enter",RED,SMALL,GREEN,},//Enter
; {140,179,50,50,30,30,GREEN," ."," .",RED,BIG,GREEN,},//.
; };
;
; unsigned char GetCursor(struct Command Cursor_data)
; {
.dbline 31
;
;
; if((cursor.x >Cursor_data.x)&&(cursor.y >Cursor_data.y)&&((cursor.x-Cursor_data.x)<Cursor_data.width)&&((cursor.y - Cursor_data.y) < Cursor_data.lenth))
movw R30,R16
ldd R2,z+0
ldd R3,z+1
lds R4,_cursor
lds R5,_cursor+1
cp R2,R4
cpc R3,R5
brsh L29
ldd R4,z+2
clr R5
lds R6,_cursor+2
clr R7
cp R4,R6
cpc R5,R7
brge L29
lds R6,_cursor
lds R7,_cursor+1
sub R6,R2
sbc R7,R3
movw R30,R16
ldd R2,z+3
ldd R3,z+4
cp R6,R2
cpc R7,R3
brsh L29
lds R2,_cursor+2
clr R3
sub R2,R4
sbc R3,R5
movw R30,R16
ldd R4,z+7
clr R5
cp R2,R4
cpc R3,R5
brge L29
.dbline 32
; {
.dbline 34
; //Dis_Command(Cursor_data);
; cursor.flag = 0;
clr R2
sts _cursor+6,R2
.dbline 35
; return 1;
ldi R16,1
xjmp L28
L29:
.dbline 38
; }
; else
; {
.dbline 39
; return 0;
clr R16
.dbline -2
L28:
.dbline 0 ; func end
ret
.dbsym r Cursor_data 16 pS[Command]
.dbend
.dbfunc e Input_Data _Input_Data fV
.area func_lit(rom, con, rel)
L146:
.word `L62
.word `L68
.word `L74
.word `L80
.word `L86
.word `L92
.word `L98
.word `L104
.word `L110
.word `L116
.word `L122
.word `L128
.word `L141
.word `L60
.word `L135
.area text(rom, con, rel)
.dbfile F:\Relations\sf6_system\measure\LCDtest\input.c
; temp -> R10
; i -> R20,R21
.even
_Input_Data::
xcall push_gset3
sbiw R28,24
.dbline -1
.dbline 47
; }
;
;
; }
; //从显示屏输入口中得到一个数据
;
; void Input_Data(void)
; {
.dbline 50
; unsigned int i;
; unsigned char temp;
; for(i=0;i<9;i++)
clr R20
clr R21
xjmp L38
L35:
.dbline 51
.dbline 52
ldi R24,<_input_buffer
ldi R25,>_input_buffer
movw R30,R20
add R30,R24
adc R31,R25
ldi R24,32
std z+0,R24
.dbline 53
L36:
.dbline 50
subi R20,255 ; offset = 1
sbci R21,255
L38:
.dbline 50
cpi R20,9
ldi R30,0
cpc R21,R30
brlo L35
.dbline 54
; {
; input_buffer[i]= ' ';
; }
; input_buffer[9]= 0;
clr R2
sts _input_buffer+9,R2
.dbline 55
; Dis_Rect(20,20,280,200,BLUE);//画一个外框
ldi R24,3
std y+4,R24
ldi R24,200
std y+2,R24
ldi R24,280
ldi R25,1
std y+1,R25
std y+0,R24
ldi R18,20
ldi R16,20
ldi R17,0
xcall _Dis_Rect
.dbline 56
; Dis_Rect(80,50,150,26,WHITE);//画一个输入框
ldi R24,255
std y+4,R24
ldi R24,26
std y+2,R24
ldi R24,150
ldi R25,0
std y+1,R25
std y+0,R24
ldi R18,50
ldi R16,80
ldi R17,0
xcall _Dis_Rect
.dbline 57
; Dis_Menu(Key_Data,Key_Data_size);
ldi R18,15
ldi R16,<_Key_Data
ldi R17,>_Key_Data
xcall _Dis_Menu
.dbline 58
; cursor.x = cursor.y = 0;
clr R2
sts _cursor+2,R2
clr R3
sts _cursor+1,R3
sts _cursor,R2
.dbline 59
; cursor.flag = 0;
sts _cursor+6,R2
.dbline 60
; Display(80,50,input_buffer,BIG,RED,WHITE);
ldi R24,255
std y+6,R24
ldi R24,224
std y+4,R24
ldi R24,1
std y+2,R24
ldi R24,<_input_buffer
ldi R25,>_input_buffer
std y+1,R25
std y+0,R24
ldi R18,50
ldi R16,80
ldi R17,0
xcall _Display
xjmp L43
L42:
.dbline 62
; while(1)
; {
.dbline 63
; if(cursor.flag == 1)
lds R24,_cursor+6
cpi R24,1
breq X3
xjmp L45
X3:
.dbline 64
; {
.dbline 65
; cursor.flag = 0;
clr R2
sts _cursor+6,R2
.dbline 66
; for(i = 0;i<Key_Data_size;i++)
clr R20
clr R21
xjmp L52
L49:
.dbline 67
; {
.dbline 68
; if(GetCursor(Key_Data[i]))
ldi R16,17
ldi R17,0
movw R18,R20
xcall empy16s
movw R2,R16
ldi R24,<_Key_Data
ldi R25,>_Key_Data
add R2,R24
adc R3,R25
movw R24,R28
adiw R24,7
ldi R16,17
ldi R17,0
st -y,R25
st -y,R24
st -y,R3
st -y,R2
xcall asgncblk
movw R16,R28
subi R16,249 ; offset = 7
sbci R17,255
xcall _GetCursor
tst R16
breq L53
.dbline 69
; {
.dbline 70
; temp=i;
mov R10,R20
.dbline 71
; break;
xjmp L51
L53:
.dbline 73
L50:
.dbline 66
subi R20,255 ; offset = 1
sbci R21,255
L52:
.dbline 66
cpi R20,15
ldi R30,0
cpc R21,R30
brlo L49
L51:
.dbline 74
; }
; }
; if(i!=temp)
mov R2,R10
clr R3
cp R20,R2
cpc R21,R3
breq L55
.dbline 75
; {
.dbline 76
; continue;
xjmp L43
L55:
.dbline 78
; }
; if(i == 13)
cpi R20,13
ldi R30,0
cpc R21,R30
brne L57
.dbline 79
; {
.dbline 81
;
; break;
xjmp L44
L57:
.dbline 84
; }
; //if(temp==12) temp=15;
; switch (temp)
mov R22,R10
clr R23
cpi R22,0
ldi R30,0
cpc R23,R30
brge X4
xjmp L60
X4:
ldi R24,14
ldi R25,0
cp R24,R22
cpc R25,R23
brge X5
xjmp L60
X5:
ldi R16,2
ldi R17,0
movw R18,R22
xcall empy16s
movw R30,R16
ldi R24,<L146
ldi R25,>L146
add R30,R24
adc R31,R25
elpm R0,Z+
elpm R1,Z
movw R30,R0
ijmp
X0:
.dbline 85
; {
L62:
.dbline 86
; case 0: for(i = 0;i<8;i++)
clr R20
clr R21
xjmp L66
L63:
.dbline 87
.dbline 88
ldi R24,<_input_buffer
ldi R25,>_input_buffer
movw R30,R20
adiw R30,1
add R30,R24
adc R31,R25
ldd R2,z+0
movw R30,R20
add R30,R24
adc R31,R25
std z+0,R2
.dbline 89
L64:
.dbline 86
subi R20,255 ; offset = 1
sbci R21,255
L66:
.dbline 86
cpi R20,8
ldi R30,0
cpc R21,R30
brlo L63
.dbline 90
; {
; input_buffer[i] = input_buffer[i+1];
; }
; input_buffer[8] = '1';
ldi R24,49
sts _input_buffer+8,R24
.dbline 91
; Display(80,50,input_buffer,BIG,RED,WHITE);
ldi R24,255
std y+6,R24
ldi R24,224
std y+4,R24
ldi R24,1
std y+2,R24
ldi R24,<_input_buffer
ldi R25,>_input_buffer
std y+1,R25
std y+0,R24
ldi R18,50
ldi R16,80
ldi R17,0
xcall _Display
.dbline 92
; break;
xjmp L60
L68:
.dbline 93
; case 1: for(i = 0;i<8;i++)
clr R20
clr R21
xjmp L72
L69:
.dbline 94
.dbline 95
ldi R24,<_input_buffer
ldi R25,>_input_buffer
movw R30,R20
adiw R30,1
add R30,R24
adc R31,R25
ldd R2,z+0
movw R30,R20
add R30,R24
adc R31,R25
std z+0,R2
.dbline 96
L70:
.dbline 93
subi R20,255 ; offset = 1
sbci R21,255
L72:
.dbline 93
cpi R20,8
ldi R30,0
cpc R21,R30
brlo L69
.dbline 97
; {
; input_buffer[i] = input_buffer[i+1];
; }
; input_buffer[8] = '2';
ldi R24,50
sts _input_buffer+8,R24
.dbline 98
; Display(80,50,input_buffer,BIG,RED,WHITE);
ldi R24,255
std y+6,R24
ldi R24,224
std y+4,R24
ldi R24,1
std y+2,R24
ldi R24,<_input_buffer
ldi R25,>_input_buffer
std y+1,R25
std y+0,R24
ldi R18,50
ldi R16,80
ldi R17,0
xcall _Display
.dbline 99
; break;
xjmp L60
L74:
.dbline 100
; case 2: for(i = 0;i<8;i++)
clr R20
clr R21
xjmp L78
L75:
.dbline 101
.dbline 102
ldi R24,<_input_buffer
ldi R25,>_input_buffer
movw R30,R20
adiw R30,1
add R30,R24
adc R31,R25
ldd R2,z+0
movw R30,R20
add R30,R24
adc R31,R25
std z+0,R2
.dbline 103
L76:
.dbline 100
subi R20,255 ; offset = 1
sbci R21,255
L78:
.dbline 100
cpi R20,8
ldi R30,0
cpc R21,R30
brlo L75
.dbline 104
; {
; input_buffer[i] = input_buffer[i+1];
; }
; input_buffer[8] = '3';
ldi R24,51
sts _input_buffer+8,R24
.dbline 105
; Display(80,50,input_buffer,BIG,RED,WHITE);
ldi R24,255
std y+6,R24
ldi R24,224
std y+4,R24
ldi R24,1
std y+2,R24
ldi R24,<_input_buffer
ldi R25,>_input_buffer
std y+1,R25
std y+0,R24
ldi R18,50
ldi R16,80
ldi R17,0
xcall _Display
.dbline 106
; break;
xjmp L60
L80:
.dbline 107
; case 3: for(i = 0;i<8;i++)
clr R20
clr R21
xjmp L84
L81:
.dbline 108
.dbline 109
ldi R24,<_input_buffer
ldi R25,>_input_buffer
movw R30,R20
adiw R30,1
add R30,R24
adc R31,R25
ldd R2,z+0
movw R30,R20
add R30,R24
adc R31,R25
std z+0,R2
.dbline 110
L82:
.dbline 107
subi R20,255 ; offset = 1
sbci R21,255
L84:
.dbline 107
cpi R20,8
ldi R30,0
cpc R21,R30
brlo L81
.dbline 111
; {
; input_buffer[i] = input_buffer[i+1];
; }
; input_buffer[8] = '4';
ldi R24,52
sts _input_buffer+8,R24
.dbline 112
; Display(80,50,input_buffer,BIG,RED,WHITE);
ldi R24,255
std y+6,R24
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -