📄 display.s
字号:
.module DISPLAY.C
.area text(rom, con, rel)
.dbfile D:\CANBUS\数据帧\查询\单向通讯\结点1-串口\DISPLAY.C
.area lit(rom, con, rel)
_NUMBER_ROM::
.byte 63,6
.byte 91,'O
.byte 'f,'m
.byte 125,7
.byte 127,'o
.dbsym e NUMBER_ROM _NUMBER_ROM A[10:10]kc
.area text(rom, con, rel)
.dbfile D:\CANBUS\数据帧\查询\单向通讯\结点1-串口\DISPLAY.C
.dbfunc e Separate_Integer_Of_Bit _Separate_Integer_Of_Bit fV
; Q -> R10,R11
; Array -> R14,R15
; num -> R12,R13
.even
_Separate_Integer_Of_Bit::
xcall push_xgset00FC
movw R14,R18
movw R12,R16
.dbline -1
.dbline 7
; #include "AT90CAN128.H"
;
; uint8 dis[2];
; const uint8 NUMBER_ROM[10] = {0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
;
; void Separate_Integer_Of_Bit(int16 num,uint8 *Array)
; {
.dbline 8
; int8 *Q = Array;
movw R10,R14
.dbline 10
;
; num %= 100;
ldi R18,100
ldi R19,0
movw R16,R12
xcall mod16s
movw R12,R16
.dbline 11
; *Q++ = num / 10;
ldi R18,10
ldi R19,0
xcall div16s
movw R30,R10
st Z+,R16
movw R10,R30
.dbline 12
; *Q = num % 10;
ldi R18,10
ldi R19,0
movw R16,R12
xcall mod16s
movw R30,R10
std z+0,R16
.dbline -2
L3:
.dbline 0 ; func end
xjmp pop_xgset00FC
.dbsym r Q 10 pc
.dbsym r Array 14 pc
.dbsym r num 12 I
.dbend
.dbfunc e DISPLAY_Init _DISPLAY_Init fV
; i -> <dead>
; digit -> y+0
; num -> R10,R11
.even
_DISPLAY_Init::
st -y,R10
st -y,R11
movw R10,R16
sbiw R28,2
.dbline -1
.dbline 20
; }
;
;
; ///////////////////////////////////////////////////////////////////////////////////////////////
; //1.dot=0 无小数点 2.dot=1 小数点在十位数 3.dot=2 小数点在百位数 4.dot=3 小数点在千位数
; ///////////////////////////////////////////////////////////////////////////////////////////////
; void DISPLAY_Init(int16 num)
; {
.dbline 24
; uint8 i;
; uint8 digit[2];
;
; Separate_Integer_Of_Bit(num,digit);
movw R18,R28
movw R16,R10
xcall _Separate_Integer_Of_Bit
.dbline 25
; if (digit[0] > 0)
ldi R24,0
ldd R2,y+0
cp R24,R2
brsh L5
X0:
.dbline 26
; digit[0] = NUMBER_ROM[digit[0]];
ldi R24,<_NUMBER_ROM
ldi R25,>_NUMBER_ROM
mov R30,R2
clr R31
add R30,R24
adc R31,R25
elpm R2,Z
std y+0,R2
L5:
.dbline 27
; digit[1] = NUMBER_ROM[digit[1]];
ldi R24,<_NUMBER_ROM
ldi R25,>_NUMBER_ROM
ldd R30,y+1
clr R31
add R30,R24
adc R31,R25
elpm R2,Z
std y+1,R2
.dbline 28
; OS_ENTER_CRITICAL();
cli
.dbline 29
; dis[0] = digit[0];
ldd R2,y+0
sts _dis,R2
.dbline 30
; dis[1] = digit[1];
ldd R2,y+1
sts _dis+1,R2
.dbline 31
; OS_EXIT_CRITICAL();
sei
.dbline -2
L4:
.dbline 0 ; func end
adiw R28,2
ld R11,y+
ld R10,y+
ret
.dbsym l i 1 c
.dbsym l digit 0 A[2:2]c
.dbsym r num 10 I
.dbend
.dbfunc e DISPLAY_CODE _DISPLAY_CODE fc
; ptr -> R16
.even
_DISPLAY_CODE::
.dbline -1
.dbline 36
; }
;
;
; uint8 DISPLAY_CODE(uint8 ptr)
; {
.dbline 37
; return (dis[ptr]);
ldi R24,<_dis
ldi R25,>_dis
mov R30,R16
clr R31
add R30,R24
adc R31,R25
ldd R16,z+0
.dbline -2
L11:
.dbline 0 ; func end
ret
.dbsym r ptr 16 c
.dbend
.area bss(ram, con, rel)
.dbfile D:\CANBUS\数据帧\查询\单向通讯\结点1-串口\DISPLAY.C
_dis::
.blkb 2
.dbsym e dis _dis A[2:2]c
; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -