📄 main.s
字号:
.byte 219,219
.byte 223,251
.byte 215,251
.byte 239,251
.byte 255,255
.byte 255,239
.byte 255,'o
.byte 128,'w
.byte 223,183
.byte 253,211
.byte 245,179
.byte 237,181
.byte 221,214
.byte 221,'w
.byte 254,247
.byte 255,255
.byte 223,'k
.byte 182,235
.byte 183,233
.byte 240,31
.byte 255,255
.byte 255,247
.byte 192,47
.byte 223,239
.byte 223,251
.byte 223,251
.byte 216,27
.byte 219,219
.byte 219,219
.byte 219,219
.byte 216,27
.byte 223,251
.byte 223,251
.byte 223,251
.byte 223,251
.byte 215,251
.byte 239,251
.byte 255,247
.byte 192,'w
.byte 239,247
.byte 247,247
.byte 251,192
.byte 251,219
.byte 251,219
.byte 128,27
.byte 251,221
.byte 251,217
.byte 251,231
.byte 251,239
.byte 251,215
.byte 251,155
.byte 250,221
.byte 253,254
.dbsym e hello _hello A[256:256]kc
_sw::
.byte 9,10
.byte 11,12
.byte 13,14
.byte 15,16
.byte 17,18
.byte 19,20
.byte 21,22
.byte 23,8
.dbfile E:\wuyong\ICC_study\latest_program\LED128x64\LED128x64\main.c
.dbsym e sw _sw A[16:16]kc
.area data(ram, con, rel)
.dbfile E:\wuyong\ICC_study\latest_program\LED128x64\LED128x64\main.c
_hanzi_size_S::
.blkb 1
.area idata
.byte 79
.area data(ram, con, rel)
.dbfile E:\wuyong\ICC_study\latest_program\LED128x64\LED128x64\main.c
.dbsym e hanzi_size_S _hanzi_size_S c
_display_flag::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile E:\wuyong\ICC_study\latest_program\LED128x64\LED128x64\main.c
.dbsym e display_flag _display_flag c
.area text(rom, con, rel)
.dbfile E:\wuyong\ICC_study\latest_program\LED128x64\LED128x64\main.c
.dbfunc e HC595_send_2byte _HC595_send_2byte fV
; i -> R20
; byte2 -> R18
; byte1 -> R16
.even
_HC595_send_2byte::
st -y,R20
.dbline -1
.dbline 63
; // ICC-AVR application builder : 2008-03-28
; // Target : M16
; // Crystal: 8.0000Mhz
; // 编写:wuyong Email:wuyong_ah@163.com
;
; // 自做LED点阵屏专用驱动板与LED 点阵屏接口定义
; // A ---> PA0 B ---> PA1
; // C ---> PA2 D! ---> PA3
; // D ---> PA4 SC ---> PC7(595_clk)
; // RC ---> PC6(595_lock) DATA1---> PD7(595_data)
; // DATA2---> PD6(595_data)
; // 上屏数据输出 ---> 下屏数据输入
;
; #include <iom16v.h>
; #include <macros.h>
; #include <delay.h>
; #include "hanzi.h"
;
; #define uchar unsigned char
; #define uint unsigned int
;
; extern const uchar QQ[]; //QQ图片
; extern const uchar OURAVR[]; //OURAVR
; extern const uchar hello[]; //hello
;
; const uchar sw[16]={0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,
; 0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x08,}; //156的驱动代码,根据138的真值表计算而来。
;
; #pragma data: data
;
; #define screen_size 8 //半屏显示汉字个数:8 32*128
; uchar hanzi_size_S = 79; //上屏移动显示汉字总个数
;
; uchar BUFF[screen_size*2]; //缓存
; uchar BUFF_1[screen_size*2]; //缓存
; uchar disrow; //disrow 为16行变量
; uchar Move;
; uchar speed;
; uchar flash_cnt;
; uchar flash_flag;
; uint zimo;
; uchar display_flag=0;
;
; void Move_L(const uchar *p,uint f); //左调整数据
; void display_chinese(const uchar *p,uchar num);//静态显示
; void display (void); //显示数据刷新
;
; #define HC595_data1_H() PORTD |= BIT(PD7)
; #define HC595_data1_L() PORTD &=~BIT(PD7)
; #define HC595_data2_H() PORTD |= BIT(PD6)
; #define HC595_data2_L() PORTD &=~BIT(PD6)
;
; #define HC595_clk_H PORTC |= BIT(PC7)
; #define HC595_clk_L PORTC &=~BIT(PC7)
;
; #define HC595_lock_H PORTC |= BIT(PC6)
; #define HC595_lock_L PORTC &=~BIT(PC6)
;
; /********************************************************
; * 函数说明:595发送一个字节数据 *
; ********************************************************/
; void HC595_send_2byte(uchar byte1,uchar byte2)
; {
.dbline 66
; uchar i;
;
; HC595_lock_L;
cbi 0x15,6
.dbline 67
; for (i=0x01;i!=0;i=i<<1)
ldi R20,1
xjmp L21
L18:
.dbline 68
; {
.dbline 69
; if(byte1&i)
mov R2,R16
and R2,R20
breq L22
X3:
.dbline 70
; HC595_data1_H();
sbi 0x12,7
xjmp L23
L22:
.dbline 72
; else
; HC595_data1_L();
cbi 0x12,7
L23:
.dbline 73
; if(byte2&i)
mov R2,R18
and R2,R20
breq L24
X4:
.dbline 74
; HC595_data2_H();
sbi 0x12,6
xjmp L25
L24:
.dbline 76
; else
; HC595_data2_L();
cbi 0x12,6
L25:
.dbline 78
;
; HC595_clk_L;
cbi 0x15,7
.dbline 79
; HC595_clk_H;
sbi 0x15,7
.dbline 80
; }
L19:
.dbline 67
lsl R20
L21:
.dbline 67
tst R20
brne L18
X5:
.dbline -2
L17:
.dbline 0 ; func end
ld R20,y+
ret
.dbsym r i 20 c
.dbsym r byte2 18 c
.dbsym r byte1 16 c
.dbend
.dbfunc e Move_L _Move_L fV
; s -> R20
; f -> R18,R19
; p -> R10,R11
.even
_Move_L::
xcall push_xgset300C
movw R10,R16
.dbline -1
.dbline 90
; }
;
; /*********************************************************
; 函数名:void Move_L(const uchar *p,uint f)
; 功能:缓存数据 左移
; 输入:
; 输出:
; /*********************************************************/
; void Move_L(const uchar *p,uint f)
; {
.dbline 92
; signed char s;
; for(s=screen_size;s>=0;s--) //
ldi R20,8
xjmp L30
L27:
.dbline 93
; {
.dbline 94
; BUFF[2*s+1]=p[f+32*s+2*disrow];
ldi R16,32
mov R17,R20
muls R16,R17
movw R30,R18
add R30,R0
adc R31,R1
lds R2,_disrow
clr R3
lsl R2
rol R3
add R30,R2
adc R31,R3
add R30,R10
adc R31,R11
lpm R2,Z
ldi R24,<_BUFF+1
ldi R25,>_BUFF+1
mov R30,R20
clr R31
sbrc R30,7
com R31
lsl R30
rol R31
add R30,R24
adc R31,R25
std z+0,R2
.dbline 95
; BUFF[2*s]=p[f+1+32*s+2*disrow];
muls R16,R17
movw R30,R18
adiw R30,1
add R30,R0
adc R31,R1
lds R2,_disrow
clr R3
lsl R2
rol R3
add R30,R2
adc R31,R3
add R30,R10
adc R31,R11
lpm R2,Z
ldi R24,<_BUFF
ldi R25,>_BUFF
mov R30,R20
clr R31
sbrc R30,7
com R31
lsl R30
rol R31
add R30,R24
adc R31,R25
std z+0,R2
.dbline 96
; }
L28:
.dbline 92
dec R20
L30:
.dbline 92
cpi R20,0
brlt X7
xjmp L27
X7:
X6:
.dbline -2
L26:
.dbline 0 ; func end
xjmp pop_xgset300C
.dbsym r s 20 C
.dbsym r f 18 i
.dbsym r p 10 pkc
.dbend
.dbfunc e display_chinese _display_chinese fV
; s -> R20
; num -> R18
; p -> R16,R17
.even
_display_chinese::
st -y,R20
.dbline -1
.dbline 106
; }
;
; /*********************************************************
; 函数名:void display_chinese(const uchar *p,uchar num)
; 功能:显示汉字
; 输入:
; 输出:
; /*********************************************************/
; void display_chinese(const uchar *p,uchar num)
; {
.dbline 108
; uchar s;
; for(s=0;s<screen_size;s++)
clr R20
xjmp L36
L33:
.dbline 109
; {
.dbline 110
; BUFF_1[2*s]=p[1+32*(s+num)+2*disrow];
mov R2,R20
add R2,R18
ldi R24,32
mul R24,R2
movw R30,R0
adiw R30,1
lds R2,_disrow
clr R3
lsl R2
rol R3
add R30,R2
adc R31,R3
add R30,R16
adc R31,R17
lpm R2,Z
ldi R24,<_BUFF_1
ldi R25,>_BUFF_1
mov R30,R20
clr R31
lsl R30
rol R31
add R30,R24
adc R31,R25
std z+0,R2
.dbline 111
; BUFF_1[2*s+1]=p[32*(s+num)+2*disrow];
mov R2,R20
add R2,R18
ldi R24,32
mul R24,R2
movw R30,R0
lds R2,_disrow
clr R3
lsl R2
rol R3
add R30,R2
adc R31,R3
add R30,R16
adc R31,R17
lpm R2,Z
ldi R24,<_BUFF_1+1
ldi R25,>_BUFF_1+1
mov R30,R20
clr R31
lsl R30
rol R31
add R30,R24
adc R31,R25
std z+0,R2
.dbline 112
; }
L34:
.dbline 108
inc R20
L36:
.dbline 108
cpi R20,8
brsh X9
xjmp L33
X9:
X8:
.dbline -2
L32:
.dbline 0 ; func end
ld R20,y+
ret
.dbsym r s 20 c
.dbsym r num 18 c
.dbsym r p 16 pkc
.dbend
.dbfunc e display _display fV
; inc -> R22
; temp -> R14
; temp1 -> R12
; i -> R20
; tempyid -> R14
; s -> R10
.even
_display::
xcall push_xgsetF0FC
.dbline -1
.dbline 122
; }
;
; /*********************************************************
; 函数名:void display(void)
; 功能:显示刷新
; 输入:
; 输出:
; /*********************************************************/
; void display(void)
; {
.dbline 123
; uchar i = Move;
lds R20,_Move
.dbline 125
; uchar s;
; uchar inc,tempyid,temp,temp1=0;
clr R12
.dbline 127
;
; if(i<8)
cpi R20,8
brsh L39
X10:
.dbline 128
; inc=0;
clr R22
xjmp L40
L39:
.dbline 130
; else
; inc=1;
ldi R22,1
L40:
.dbline 131
; for(s=0+inc;s<screen_size*2+inc;s++) //发送16字节数据
mov R10,R22
xjmp L44
L41:
.dbline 132
; {
.dbline 133
; if(i<8)
cpi R20,8
brsh L45
X11:
.dbline 134
; tempyid=i;
mov R14,R20
xjmp L46
L45:
.dbline 136
; else
; tempyid=i-8;
mov R24,R20
subi R24,8
mov R14,R24
L46:
.dbline 137
; temp=((BUFF[s]>>tempyid)|(BUFF[s+1]<<(8-tempyid)));
ldi R17,8
sub R17,R14
ldi R24,<_BUFF+1
ldi R25,>_BUFF+1
mov R30,R10
clr R31
add R30,R24
adc R31,R25
ldd R16,z+0
xcall lsl8
mov R2,R16
ldi R24,<_BUFF
ldi R25,>_BUFF
mov R30,R10
clr R31
add R30,R24
adc R31,R25
ldd R16,z+0
mov R17,R14
xcall lsr8
mov R14,R16
or R14,R2
.dbline 138
; HC595_send_2byte(temp,BUFF_1[temp1]); //发送数据
ldi R24,<_BUFF_1
ldi R25,>_BUFF_1
mov R30,R12
clr R31
add R30,R24
adc R31,R25
ldd R18,z+0
mov R16,R14
xcall _HC595_send_2byte
.dbline 139
; temp1++;
inc R12
.dbline 140
; }
L42:
.dbline 131
inc R10
L44:
.dbline 131
mov R24,R22
subi R24,240 ; addi 16
cp R10,R24
brlo L41
X12:
.dbline -2
L38:
.dbline 0 ; func end
xjmp pop_xgsetF0FC
.dbsym r inc 22 c
.dbsym r temp 14 c
.dbsym r temp1 12 c
.dbsym r i 20 c
.dbsym r tempyid 14 c
.dbsym r s 10 c
.dbend
.dbfunc e port_init _port_init fV
.even
_port_init::
.dbline -1
.dbline 145
; }
;
;
; void port_init(void)
; {
.dbline 146
; PORTA = 0x00;
clr R2
out 0x1b,R2
.dbline 147
; DDRA = 0xFF;
ldi R24,255
out 0x1a,R24
.dbline 149
;
; PORTB = 0x00;
out 0x18,R2
.dbline 150
; DDRB = 0xFF;
out 0x17,R24
.dbline 152
;
; PORTC = 0x00; //m103 output only
out 0x15,R2
.dbline 153
; DDRC = 0xFF;
out 0x14,R24
.dbline 155
;
; PORTD = 0x00;
out 0x12,R2
.dbline 156
; DDRD = 0xFF;
out 0x11,R24
.dbline -2
L48:
.dbline 0 ; func end
ret
.dbend
.dbfunc e init_devices _init_devices fV
.even
_init_devices::
.dbline -1
.dbline 161
; }
;
; //call this routine to initialize all peripherals
; void init_devices(void)
; {
.dbline 163
; //stop errant interrupts until set up
; CLI(); //disable all interrupts
cli
.dbline 164
; port_init();
xcall _port_init
.dbline 166
;
; MCUCR = 0x00;
clr R2
out 0x35,R2
.dbline 167
; GICR = 0x00;
out 0x3b,R2
.dbline 168
; TIMSK = 0x00; //timer interrupt sources
out 0x39,R2
.dbline 169
; SEI(); //re-enable interrupts
sei
.dbline -2
L49:
.dbline 0 ; func end
ret
.dbend
.dbfunc e main _main fV
.even
_main::
.dbline -1
.dbline 175
; //all peripherals are now initialized
; }
;
;
; void main(void)
; {
.dbline 176
; init_devices();
xcall _init_devices
xjmp L52
L51:
.dbline 180
; //insert your functional code here...
;
; while(1) //重复循环显示
; {
.dbline 181
; for(disrow=0;disrow<16;disrow++)
clr R2
sts _disrow,R2
xjmp L57
L54:
.dbline 182
; {
.dbline 183
; PORTA=0x18; //关闭显示,消影
ldi R24,24
out 0x1b,R24
.dbline 185
;
; Move_L(OURAVR,zimo); //上屏移动显示OURAVR
lds R18,_zimo
lds R19,_zimo+1
ldi R16,<_OURAVR
ldi R17,>_OURAVR
xcall _Move_L
.dbline 187
;
; if(flash_flag==0)
lds R2,_flash_flag
tst R2
brne L58
X13:
.dbline 188
; display_chinese(hello,0);//下屏显示hello
clr R18
ldi R16,<_hello
ldi R17,>_hello
xcall _display_chinese
xjmp L59
L58:
.dbline 190
; else
; display_chinese(QQ,0); //下屏picture
clr R18
ldi R16,<_QQ
ldi R17,>_QQ
xcall _display_chinese
L59:
.dbline 192
;
; display(); //刷新显示数据
xcall _display
.dbline 194
;
; HC595_lock_H; //锁存为高,595锁存信号
sbi 0x15,6
.dbline 195
; PORTA=sw[disrow]; //输出行信号
ldi R24,<_sw
ldi R25,>_sw
lds R30,_disrow
clr R31
add R30,R24
adc R31,R25
lpm R2,Z
out 0x1b,R2
.dbline 197
;
; delay_nus(200);
ldi R16,200
ldi R17,0
xcall _delay_nus
.dbline 198
; }
L55:
.dbline 181
lds R24,_disrow
subi R24,255 ; addi 1
sts _disrow,R24
L57:
.dbline 181
lds R24,_disrow
cpi R24,16
brlo L54
X14:
.dbline 200
;
; if(speed++>=0) //控制上屏移动显示速度
lds R2,_speed
clr R3
mov R24,R2
subi R24,255 ; addi 1
sts _speed,R24
mov R24,R2
cpi R24,0
brlo L60
X15:
.dbline 201
; {
.dbline 202
; speed=0 ;
clr R2
sts _speed,R2
.dbline 203
; if(Move++>=15)
lds R2,_Move
clr R3
mov R24,R2
subi R24,255 ; addi 1
sts _Move,R24
mov R24,R2
cpi R24,15
brlo L62
X16:
.dbline 204
; {
.dbline 205
; Move=0; //16列移位计数器清零
clr R2
sts _Move,R2
.dbline 206
; zimo=zimo+32; //取字模计数器加32,准备下一个字
lds R24,_zimo
lds R25,_zimo+1
adiw R24,32
sts _zimo+1,R25
sts _zimo,R24
.dbline 207
; if(zimo>=(hanzi_size_S*32)) //字模是否到最后来。
lds R2,_hanzi_size_S
ldi R24,32
mul R24,R2
lds R2,_zimo
lds R3,_zimo+1
cp R2,R0
cpc R3,R1
brlo L64
X17:
.dbline 208
; zimo=0; //从头在来。
clr R2
clr R3
sts _zimo+1,R3
sts _zimo,R2
L64:
.dbline 209
; }
L62:
.dbline 210
; }
L60:
.dbline 212
;
; if(flash_cnt++>=100)//下屏显示切换时间
lds R20,_flash_cnt
clr R21
mov R24,R20
subi R24,255 ; addi 1
sts _flash_cnt,R24
cpi R20,100
brlo L66
X18:
.dbline 213
; {
.dbline 214
; flash_cnt=0;
clr R2
sts _flash_cnt,R2
.dbline 215
; if(flash_flag==0)
lds R2,_flash_flag
tst R2
brne L68
X19:
.dbline 216
; flash_flag=1;
ldi R24,1
sts _flash_flag,R24
xjmp L69
L68:
.dbline 218
; else
; flash_flag=0;
clr R2
sts _flash_flag,R2
L69:
.dbline 219
; }
L66:
.dbline 221
;
; }
L52:
.dbline 179
xjmp L51
X20:
.dbline -2
L50:
.dbline 0 ; func end
ret
.dbend
.area bss(ram, con, rel)
.dbfile E:\wuyong\ICC_study\latest_program\LED128x64\LED128x64\main.c
_zimo::
.blkb 2
.dbsym e zimo _zimo i
_flash_flag::
.blkb 1
.dbsym e flash_flag _flash_flag c
_flash_cnt::
.blkb 1
.dbsym e flash_cnt _flash_cnt c
_speed::
.blkb 1
.dbsym e speed _speed c
_Move::
.blkb 1
.dbsym e Move _Move c
_disrow::
.blkb 1
.dbsym e disrow _disrow c
_BUFF_1::
.blkb 16
.dbsym e BUFF_1 _BUFF_1 A[16:16]c
_BUFF::
.blkb 16
.dbsym e BUFF _BUFF A[16:16]c
;
; }
;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -