📄 lcmdisp.s
字号:
.module lcmdisp.c
.area lit(rom, con, rel)
_ICO1::
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 255,0
.byte 0,0
.byte 7,0
.byte 224,0
.byte 0,24
.byte 0,24
.byte 0,0
.byte 48,0
.byte 12,0
.byte 0,64
.byte 0,2
.byte 0,0
.byte 128,0
.byte 1,0
.byte 1,0
.byte 0,0
.byte 128,3
.byte 0,0
.byte 0,192
.byte 2,1
.byte 129,128
.byte 64,4
.byte 3,195
.byte 192,32
.byte 4,3
.byte 195,192
.byte 32,4
.byte 3,195
.byte 192,32
.byte 8,3
.byte 195,192
.byte 16,8
.byte 3,195
.byte 192,16
.byte 8,1
.byte 129,128
.byte 16,8
.byte 8,0
.byte 16,16
.byte 8,8
.byte 0,16
.byte 16,8
.byte 16,0
.byte 8,16
.byte 8,240
.byte 0,15
.byte 16,8
.byte 8,0
.byte 16,16
.byte 4,4
.byte 0,32
.byte 32,4
.byte 6,0
.byte 96,32
.byte 4,3
.byte 129,192
.byte 32,2
.byte 1,126
.byte 128,64
.byte 3,0
.byte 129,0
.byte 192,1
.byte 0,'B
.byte 0,128
.byte 0,128
.byte 60,1
.byte 0,0
.byte 64,0
.byte 2,0
.byte 0,48
.byte 0,12
.byte 0,0
.byte 24,0
.byte 24,0
.byte 0,7
.byte 0,224
.byte 0,0
.byte 0,255
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.dbsym e ICO1 _ICO1 A[200:200]kc
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
_log_pin::
.blkb 2
.area idata
.word 40
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.word 30
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.word 60
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.word 60
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.word 80
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.word 30
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.word 100
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.word 60
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.dbsym e log_pin _log_pin A[16:4]X
.area lit(rom, con, rel)
_poly6::
.word 750
.word 55
.word 85
.word 40
.word 90
.word 45
.word 100
.word 42
.word 115
.word 55
.word 75
.word 55
.dbsym e poly6 _poly6 A[24:12]ki
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
_hz0::
.blkb 2
.area idata
.byte 16,32
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.byte 16,32
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.byte 253,254
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.byte 16,32
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.byte 124,32
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.byte 'D,252
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.byte 124,32
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.byte 'D,32
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.byte 125,254
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.byte 16,34
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.byte 254,34
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.byte 16,34
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.byte 16,42
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.byte 16,36
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.byte 16,32
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.blkb 2
.area idata
.byte 16,32
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.dbsym e hz0 _hz0 A[32:32]c
.area text(rom, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.dbfunc e Port_Init _Port_Init fV
.even
_Port_Init::
.dbline -1
.dbline 49
; /****************************************************************************************
; * 文件名:LCMDISP.C
; * 功能:GUI测试及演示程序。
; * 作者:黄绍斌
; * 日期:2003.09.09
; ****************************************************************************************/
; #include "config.h"
;
;
; // 一个单色图标的数据,宽度x高度=40x40
; uint8 const ICO1[] =
; {
; 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x07,0x00,0xE0,0x00,0x00,0x18,
; 0x00,0x18,0x00,0x00,0x30,0x00,0x0C,0x00,0x00,0x40,0x00,0x02,0x00,0x00,0x80,0x00,
; 0x01,0x00,0x01,0x00,0x00,0x00,0x80,0x03,0x00,0x00,0x00,0xC0,0x02,0x01,0x81,0x80,
; 0x40,0x04,0x03,0xC3,0xC0,0x20,0x04,0x03,0xC3,0xC0,0x20,0x04,0x03,0xC3,0xC0,0x20,
; 0x08,0x03,0xC3,0xC0,0x10,0x08,0x03,0xC3,0xC0,0x10,0x08,0x01,0x81,0x80,0x10,0x08,
; 0x08,0x00,0x10,0x10,0x08,0x08,0x00,0x10,0x10,0x08,0x10,0x00,0x08,0x10,0x08,0xF0,
; 0x00,0x0F,0x10,0x08,0x08,0x00,0x10,0x10,0x04,0x04,0x00,0x20,0x20,0x04,0x06,0x00,
; 0x60,0x20,0x04,0x03,0x81,0xC0,0x20,0x02,0x01,0x7E,0x80,0x40,0x03,0x00,0x81,0x00,
; 0xC0,0x01,0x00,0x42,0x00,0x80,0x00,0x80,0x3C,0x01,0x00,0x00,0x40,0x00,0x02,0x00,
; 0x00,0x30,0x00,0x0C,0x00,0x00,0x18,0x00,0x18,0x00,0x00,0x07,0x00,0xE0,0x00,0x00,
; 0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
; };
; unsigned char KeyNew,KeyDown;
; char* p;
; // 样条曲线的4个端点
; PointXY log_pin[] = { {40, 30},
; {60, 60},
; {80, 30},
; {100, 60}
; };
;
; // 封闭多边形的各个顶点
; uint32 const poly6[] = {750,55, 85,40, 90,45, 100,42, 115,55, 75,55};
; unsigned char hz0[]= //韩
;
; {
; 0x10, 0x20, 0x10, 0x20, 0xfd, 0xfe, 0x10, 0x20, 0x7c, 0x20, 0x44, 0xfc, 0x7c, 0x20, 0x44, 0x20,
; 0x7d, 0xfe, 0x10, 0x22, 0xfe, 0x22, 0x10, 0x22, 0x10, 0x2a, 0x10, 0x24, 0x10, 0x20, 0x10, 0x20
;
; };
;
; WINDOWS *first_win;
;
; void Port_Init()
; {
.dbline 50
; PORTD = 0XFF;
ldi R24,255
out 0x12,R24
.dbline 51
; DDRD = 0XFF;
out 0x11,R24
.dbline 52
; PORTB = 0XFF;
out 0x18,R24
.dbline 53
; DDRB = 0X00;
clr R2
out 0x17,R2
.dbline 54
; PORTF = 0x00;
sts 98,R2
.dbline 55
; DDRF = 0x1F;
ldi R24,31
sts 97,R24
.dbline 56
; PORTE = 0x0F;
ldi R24,15
out 0x3,R24
.dbline 57
; DDRE = 0x00;
out 0x2,R2
.dbline -2
L7:
.dbline 0 ; func end
ret
.dbend
.dbfunc e init_devices _init_devices fV
.even
_init_devices::
.dbline -1
.dbline 61
; }
; //call this routine to initialize all peripherals
; void init_devices(void)
; {
.dbline 63
; //stop errant interrupts until set up
; CLI(); //disable all interrupts
cli
.dbline 64
; XDIV = 0x00; //xtal divider
clr R2
out 0x3c,R2
.dbline 65
; XMCRA = 0x00; //external memory
sts 109,R2
.dbline 66
; Port_Init();
xcall _Port_Init
.dbline 68
;
; MCUCR = 0x00;
clr R2
out 0x35,R2
.dbline 69
; EICRA = 0x00; //extended ext ints
sts 106,R2
.dbline 70
; EICRB = 0x00; //extended ext ints
out 0x3a,R2
.dbline 71
; EIMSK = 0x00;
out 0x39,R2
.dbline 72
; TIMSK = 0x00; //timer interrupt sources
out 0x37,R2
.dbline 73
; ETIMSK = 0x00; //extended timer interrupt sources
sts 125,R2
.dbline 74
; SEI(); //re-enable interrupts
sei
.dbline -2
L8:
.dbline 0 ; func end
ret
.dbend
.dbfunc e key_scan _key_scan fV
; shift -> <dead>
; j -> <dead>
; i -> R20
.even
_key_scan::
xcall push_gset1
.dbline -1
.dbline 78
; //all peripherals are now initialized
; }
; void key_scan(void)
; {
.dbline 83
; unsigned char i,j,shift;
;
; //if (key_scan_begin==0) return;
; //key_scan_begin=0;
; PORTE|=0X0f;//UP PULL
in R24,0x3
ori R24,15
out 0x3,R24
.dbline 84
; PORTF|=0x1f;//OUT
lds R24,98
ori R24,31
sts 98,R24
.dbline 85
; for (i=0;i<5;i++)
clr R20
xjmp L13
L10:
.dbline 86
; {
.dbline 87
; PORTF&=~(1<<i); //键盘线扫描
ldi R16,1
mov R17,R20
xcall lsl8
mov R2,R16
com R2
lds R3,98
and R3,R2
sts 98,R3
.dbline 89
; //delay_us(1);
; KeyNew=PINE&0x0f;//读取键盘扫描信号,屏蔽高四位PC0~3
in R24,0x1
andi R24,15
sts _KeyNew,R24
.dbline 90
; if (KeyNew!=0x0f)//如果有键按下,延时10ms消抖
cpi R24,15
breq L14
.dbline 91
; {
.dbline 93
; //key_up=0;
; KeyDown = 1;
ldi R24,1
sts _KeyDown,R24
.dbline 94
; KeyNew=KeyNew<<4;
lds R24,_KeyNew
andi R24,#0x0F
swap R24
sts _KeyNew,R24
.dbline 95
; KeyNew=KeyNew|i;//get key scan code
mov R2,R24
or R2,R20
sts _KeyNew,R2
.dbline 96
; return;
xjmp L9
L14:
.dbline 100
L11:
.dbline 85
inc R20
L13:
.dbline 85
cpi R20,5
brlo L10
.dbline -2
L9:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym l shift 1 c
.dbsym l j 1 c
.dbsym r i 20 c
.dbend
.dbfunc e Hex2Ascii _Hex2Ascii fI
; ascii -> y+0
; temp -> R20
; h -> R16
.even
_Hex2Ascii::
xcall push_gset1
sbiw R28,2
.dbline -1
.dbline 103
; //putchar(KeyNew);
; }
; //memmove(&key_buf[0],&key_buf[1],KEY_BUF_LEN-1);
; }//for (i=0;i<5;i++)
; }
; Hex2Ascii(unsigned char h)
; {
.dbline 107
; unsigned char ascii[2];
; unsigned char temp;
;
; temp = (h&0xf0)>>4;
mov R20,R16
andi R20,240
swap R20
andi R20,#0x0F
.dbline 108
; if(temp<0x0a){ascii[0] = temp + 0x30;}
cpi R20,10
brsh L17
.dbline 108
.dbline 108
mov R24,R20
subi R24,208 ; addi 48
std y+0,R24
.dbline 108
xjmp L18
L17:
.dbline 109
; else {ascii[0] = temp + 0x37;}
.dbline 109
mov R24,R20
subi R24,201 ; addi 55
std y+0,R24
.dbline 109
L18:
.dbline 111
;
; temp = h&0x0f;
mov R20,R16
andi R20,15
.dbline 112
; if(temp<0x0a){ascii[1] = temp + 0x30;}
cpi R20,10
brsh L19
.dbline 112
.dbline 112
mov R24,R20
subi R24,208 ; addi 48
std y+1,R24
.dbline 112
xjmp L20
L19:
.dbline 113
; else {ascii[1] = temp + 0x37;}
.dbline 113
mov R24,R20
subi R24,201 ; addi 55
std y+1,R24
.dbline 113
L20:
.dbline 114
; p = &ascii[0];
movw R24,R28
sts _p+1,R25
sts _p,R24
.dbline -2
L16:
adiw R28,2
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym l ascii 0 A[2:2]c
.dbsym r temp 20 c
.dbsym r h 16 c
.dbend
.area lit(rom, con, rel)
L24:
.word 0
.word 0
.word 128
.word 32
.word L25
.word L26
.area text(rom, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
.dbfunc e main _main fI
; win -> y+2
.even
_main::
sbiw R28,14
.dbline -1
.dbline 122
; //return (ascii);
; }
; /***********************************************************************
; * 名称:main()
; * 功能:主程序,用于GUI测试及演示。
; ***********************************************************************/
; main(void)
; {
.dbline 123
; WINDOWS win={0, 0, 128, 32,"my", "first" };
ldi R24,<L24
ldi R25,>L24
movw R30,R28
adiw R30,2
ldi R16,12
ldi R17,0
st -y,R31
st -y,R30
st -y,R25
st -y,R24
xcall asgncblk
.dbline 124
; first_win = &win;
movw R24,R28
adiw R24,2
sts _first_win+1,R25
sts _first_win,R24
.dbline 125
; init_devices();
xcall _init_devices
.dbline 127
;
; GUI_Initialize(); // 初始化LCM
xcall _GUI_Initialize
.dbline 128
; GUI_SetColor(1, 0); // 设置前景色及背景色
clr R18
ldi R16,1
xcall _GUI_SetColor
.dbline 134
; //LCD_FillAll(0x01);
; //GUI_LoadPic(0,0, (uint8 *)ICO1, 40, 40); // 显示40×40的图标
; //GUI_Spline(log_pin, 4, 1); // 画样条曲线
; //GUI_LineS(poly6, 6, 1); // 画封闭的多边形
; //GUI_FloodFill(0,0, 1); // 填充多边形
; GUI_PutString(0,0,"09:23 01/10/07"); // 显示字符串
ldi R24,<L27
ldi R25,>L27
std y+1,R25
std y+0,R24
clr R18
clr R19
clr R16
clr R17
xcall _GUI_PutString
.dbline 145
; //GUI_PutChar24_32(48,32,'8');
; //GUI_PutChar8_8(0,0,'8');
; //GUI_PutHZ(0,0,hz0,16,16);
; //GUI_PutNoStr(0,0,"3244",4);
; //GUI_WindowsDraw(first_win);
; //while(1);
; //return(0);
; //GUI_PutChar8_8(0,8,'p');
; //GUI_PutChar8_8(0,16,'m');
; //GUI_PutChar8_8(0,24,'s');
; GUI_DrawBat(86,0,0);
clr R2
clr R3
std y+1,R3
std y+0,R2
clr R18
clr R19
ldi R16,86
ldi R17,0
xcall _GUI_DrawBat
.dbline 146
; GUI_PutChar16_16(0,8,'P');
ldi R24,80
std y+0,R24
ldi R18,8
ldi R19,0
clr R16
clr R17
xcall _GUI_PutChar16_16
.dbline 147
; GUI_PutChar16_16(0,24,'M');
ldi R24,77
std y+0,R24
ldi R18,24
ldi R19,0
clr R16
clr R17
xcall _GUI_PutChar16_16
.dbline 148
; GUI_PutChar16_16(0,40,'S');
ldi R24,83
std y+0,R24
ldi R18,40
ldi R19,0
clr R16
clr R17
xcall _GUI_PutChar16_16
xjmp L29
L28:
.dbline 151
;
; while(1)
; {
.dbline 152
; key_scan();
xcall _key_scan
.dbline 153
; if(KeyDown)
lds R2,_KeyDown
tst R2
breq L31
.dbline 154
; {
.dbline 158
; //Hex2Ascii(KeyNew);
; //GUI_PutString(0,0,p);
;
; KeyDown = 0;
clr R2
sts _KeyDown,R2
.dbline 159
; }
L31:
.dbline 160
L29:
.dbline 150
xjmp L28
X0:
.dbline -2
L23:
adiw R28,14
.dbline 0 ; func end
ret
.dbsym l win 2 X
.dbend
.area bss(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
_first_win::
.blkb 2
.dbsym e first_win _first_win pX
_p::
.blkb 2
.dbsym e p _p pc
_KeyDown::
.blkb 1
.dbsym e KeyDown _KeyDown c
_KeyNew::
.blkb 1
.dbsym e KeyNew _KeyNew c
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
L27:
.blkb 15
.area idata
.byte 48,57,58,50,51,32,48,49,47,49,48,47,48,55,0
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
L26:
.blkb 6
.area idata
.byte 'f,'i,'r,'s,'t,0
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
L25:
.blkb 3
.area idata
.byte 'm,'y,0
.area data(ram, con, rel)
.dbfile G:\IccPro\mega128_lcd\lcmdisp.c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -