📄 main.s
字号:
.module main.c
.area data(ram, con, rel)
_hz0::
.blkb 65
.area idata
.byte 214,199,196,220,188,210,181,231,191,216,214,198,207,181,205,179
.byte 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32
.byte 202,228,200,235,32,32,32,32,32,32,32,32,32,32,32,32
.byte 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32
.byte 0
.area data(ram, con, rel)
.dbfile F:\programme\RF905\main.c
.dbsym e hz0 _hz0 A[65:65]c
_times::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile F:\programme\RF905\main.c
.dbsym e times _times c
.area text(rom, con, rel)
.dbfile F:\programme\RF905\main.c
.dbfunc e spi_init _spi_init fV
.even
_spi_init::
.dbline -1
.dbline 15
; #include <stdio.h>
; #include <iom8v.h>
; #include <macros.h>
; #include "nrf905.h"
;
; unsigned char hz0[65]={"智能家电控制系统 输入 "};
; unsigned char KeyV,KeyFlag;
; extern uchar TxBuf[],RxBuf[];
; unsigned char value_T,set_data;
; unsigned char times=0;
; //unsigned char KeyD[5];
; //unsigned char KeyI=0;
;
; void spi_init(void)
; {
.dbline 16
; SPCR = 0x51; //setup SPI
ldi R24,81
out 0xd,R24
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbend
.dbfunc e print_temp _print_temp fV
; wendu -> y+4
; temp -> y+0
; address -> R10
.even
_print_temp::
rcall push_gset3
mov R10,R16
sbiw R28,16
.dbline -1
.dbline 21
; //SPSR = 0x00; //setup SPI
; }
;
; void print_temp(unsigned char address)
; {
.dbline 25
;
; float wendu;
; unsigned long int temp;
; wendu=GetTemp()*0.0625;
rcall _GetTemp
movw R2,R16
ldi R16,<L3
ldi R17,>L3
rcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
movw R16,R2
rcall int2fp
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall empy32f
movw R30,R28
std z+4,R16
std z+5,R17
std z+6,R18
std z+7,R19
.dbline 26
; temp=wendu*10000;
ldi R16,<L6
ldi R17,>L6
rcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
movw R30,R28
; stack offset 4
ldd R2,z+8
ldd R3,z+9
ldd R4,z+10
ldd R5,z+11
st -y,R5
st -y,R4
st -y,R3
st -y,R2
rcall empy32f
movw R30,R28
std z+12,R16
std z+13,R17
std z+14,R18
std z+15,R19
movw R30,R28
ldd R2,z+12
ldd R3,z+13
ldd R4,z+14
ldd R5,z+15
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L7
ldi R17,>L7
rcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall cmp32f
brlt L4
movw R30,R28
ldd R2,z+12
ldd R3,z+13
ldd R4,z+14
ldd R5,z+15
st -y,R5
st -y,R4
st -y,R3
st -y,R2
ldi R16,<L7
ldi R17,>L7
rcall lpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
rcall sub32f
rcall fp2long
movw R2,R16
movw R4,R18
ldi R20,0
ldi R21,0
ldi R22,0
ldi R23,128
add R2,R20
adc R3,R21
adc R4,R22
adc R5,R23
movw R30,R28
std z+8,R2
std z+9,R3
std z+10,R4
std z+11,R5
rjmp L5
L4:
movw R30,R28
ldd R16,z+12
ldd R17,z+13
ldd R18,z+14
ldd R19,z+15
rcall fp2long
movw R30,R28
std z+8,R16
std z+9,R17
std z+10,R18
std z+11,R19
L5:
movw R30,R28
ldd R2,z+8
ldd R3,z+9
ldd R4,z+10
ldd R5,z+11
movw R30,R28
std z+0,R2
std z+1,R3
std z+2,R4
std z+3,R5
.dbline 28
;
; lcd_write_comm(0x30);
ldi R16,48
ldi R17,0
rcall _lcd_write_comm
.dbline 29
; lcd_write_comm(address);
mov R16,R10
clr R17
rcall _lcd_write_comm
.dbline 30
; lcd_write_data((temp/1000000)%10+0x30);
ldi R20,64
ldi R21,66
ldi R22,15
ldi R23,0
movw R30,R28
ldd R2,z+0
ldd R3,z+1
ldd R4,z+2
ldd R5,z+3
st -y,R23
st -y,R22
st -y,R21
st -y,R20
movw R16,R2
movw R18,R4
rcall div32u
ldi R20,10
ldi R21,0
ldi R22,0
ldi R23,0
st -y,R23
st -y,R22
st -y,R21
st -y,R20
rcall mod32u
movw R2,R16
movw R4,R18
ldi R20,48
ldi R21,0
ldi R22,0
ldi R23,0
add R2,R20
adc R3,R21
adc R4,R22
adc R5,R23
movw R16,R2
movw R18,R4
rcall _lcd_write_data
.dbline 31
; lcd_write_data((temp/100000)%10+0x30);
ldi R20,160
ldi R21,134
ldi R22,1
ldi R23,0
movw R30,R28
ldd R2,z+0
ldd R3,z+1
ldd R4,z+2
ldd R5,z+3
st -y,R23
st -y,R22
st -y,R21
st -y,R20
movw R16,R2
movw R18,R4
rcall div32u
ldi R20,10
ldi R21,0
ldi R22,0
ldi R23,0
st -y,R23
st -y,R22
st -y,R21
st -y,R20
rcall mod32u
movw R2,R16
movw R4,R18
ldi R20,48
ldi R21,0
ldi R22,0
ldi R23,0
add R2,R20
adc R3,R21
adc R4,R22
adc R5,R23
movw R16,R2
movw R18,R4
rcall _lcd_write_data
.dbline 32
; lcd_write_data((temp/10000)%10+0x30);
ldi R20,16
ldi R21,39
ldi R22,0
ldi R23,0
movw R30,R28
ldd R2,z+0
ldd R3,z+1
ldd R4,z+2
ldd R5,z+3
st -y,R23
st -y,R22
st -y,R21
st -y,R20
movw R16,R2
movw R18,R4
rcall div32u
ldi R20,10
ldi R21,0
ldi R22,0
ldi R23,0
st -y,R23
st -y,R22
st -y,R21
st -y,R20
rcall mod32u
movw R2,R16
movw R4,R18
ldi R20,48
ldi R21,0
ldi R22,0
ldi R23,0
add R2,R20
adc R3,R21
adc R4,R22
adc R5,R23
movw R16,R2
movw R18,R4
rcall _lcd_write_data
.dbline 33
; lcd_write_data('.');
ldi R16,46
ldi R17,0
rcall _lcd_write_data
.dbline 34
; lcd_write_data((temp/1000)%10+0x30);
ldi R20,232
ldi R21,3
ldi R22,0
ldi R23,0
movw R30,R28
ldd R2,z+0
ldd R3,z+1
ldd R4,z+2
ldd R5,z+3
st -y,R23
st -y,R22
st -y,R21
st -y,R20
movw R16,R2
movw R18,R4
rcall div32u
ldi R20,10
ldi R21,0
ldi R22,0
ldi R23,0
st -y,R23
st -y,R22
st -y,R21
st -y,R20
rcall mod32u
movw R2,R16
movw R4,R18
ldi R20,48
ldi R21,0
ldi R22,0
ldi R23,0
add R2,R20
adc R3,R21
adc R4,R22
adc R5,R23
movw R16,R2
movw R18,R4
rcall _lcd_write_data
.dbline 35
; lcd_write_data((temp/100)%10+0x30);
ldi R20,100
ldi R21,0
ldi R22,0
ldi R23,0
movw R30,R28
ldd R2,z+0
ldd R3,z+1
ldd R4,z+2
ldd R5,z+3
st -y,R23
st -y,R22
st -y,R21
st -y,R20
movw R16,R2
movw R18,R4
rcall div32u
ldi R20,10
ldi R21,0
ldi R22,0
ldi R23,0
st -y,R23
st -y,R22
st -y,R21
st -y,R20
rcall mod32u
movw R2,R16
movw R4,R18
ldi R20,48
ldi R21,0
ldi R22,0
ldi R23,0
add R2,R20
adc R3,R21
adc R4,R22
adc R5,R23
movw R16,R2
movw R18,R4
rcall _lcd_write_data
.dbline 36
; lcd_write_data((temp/10)%10+0x30);
ldi R20,10
ldi R21,0
ldi R22,0
ldi R23,0
movw R30,R28
ldd R2,z+0
ldd R3,z+1
ldd R4,z+2
ldd R5,z+3
st -y,R23
st -y,R22
st -y,R21
st -y,R20
movw R16,R2
movw R18,R4
rcall div32u
ldi R20,10
ldi R21,0
ldi R22,0
ldi R23,0
st -y,R23
st -y,R22
st -y,R21
st -y,R20
rcall mod32u
movw R2,R16
movw R4,R18
ldi R20,48
ldi R21,0
ldi R22,0
ldi R23,0
add R2,R20
adc R3,R21
adc R4,R22
adc R5,R23
movw R16,R2
movw R18,R4
rcall _lcd_write_data
.dbline 37
; lcd_write_data(temp%10+0x30);
ldi R20,10
ldi R21,0
ldi R22,0
ldi R23,0
movw R30,R28
ldd R2,z+0
ldd R3,z+1
ldd R4,z+2
ldd R5,z+3
st -y,R23
st -y,R22
st -y,R21
st -y,R20
movw R16,R2
movw R18,R4
rcall mod32u
movw R2,R16
movw R4,R18
ldi R20,48
ldi R21,0
ldi R22,0
ldi R23,0
add R2,R20
adc R3,R21
adc R4,R22
adc R5,R23
movw R16,R2
movw R18,R4
rcall _lcd_write_data
.dbline -2
L2:
adiw R28,16
rcall pop_gset3
.dbline 0 ; func end
ret
.dbsym l wendu 4 D
.dbsym l temp 0 l
.dbsym r address 10 c
.dbend
.dbfunc e main _main fV
; detect -> <dead>
; kk -> R22
; KeyValue -> R10
.even
_main::
sbiw R28,2
.dbline -1
.dbline 41
; }
;
; void main(void)
; { unsigned char KeyValue,kk,detect;
.dbline 42
; CLI(); //disable all interrupts
cli
.dbline 44
;
; spi_init();
rcall _spi_init
.dbline 47
;
;
; DDRB=0x6f; //0110 1111b
ldi R24,111
out 0x17,R24
.dbline 48
; PORTB=0xd4; //1101 0100b
ldi R24,212
out 0x18,R24
.dbline 51
; //SET(PORTB,CSN);
;
; DDRC=0x00;
clr R2
out 0x14,R2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -