📄 sms_controller.lst
字号:
000074 2fca mov YL,ramadr ;\
000075 9129 ld txbyte,Y+ ; \ print the 1st septet
000076 772f cbr txbyte,0x80 ; /
000077 d041 rcall b_transmit ;/
000078 3321 cpi txbyte,0x31 ;Check if txbyte is 0x31
000079 f409 brne more ;If not...
00007a 6031 sbr Rxbyte,1 ;
more:
00007b 0f33 lsl Rxbyte
00007c 2fca mov YL,ramadr ;
00007d 9149 ld temp2,Y+ ;
00007e 95a3 inc ramadr ;
00007f 2fca mov YL,ramadr ;
000080 9129 ld txbyte,Y+ ;
dec6:
000081 0f22 lsl txbyte ;
000082 950a dec temp
000083 f7e9 brne dec6
dect:
000084 9546 lsr temp2 ;rotate n times
000085 95ba dec delay1 ;
000086 f7e9 brne dect ;
000087 0f24 add txbyte,temp2 ;
000088 772f cbr txbyte,0x80 ;
000089 3321 cpi txbyte,0x31 ;Check
00008a f409 brne aaa ;If not go to
00008b 6031 sbr Rxbyte,1
aaa:
00008c d02c rcall b_transmit
00008d 95e3 inc temp6
00008e 2f0e mov temp,temp6
00008f 95da dec temp5
000090 2fbd mov delay1,temp5
000091 955a dec temp3
000092 f741 brne more
000093 bb38 out portB,Rxbyte ;output the message from GSM to PortB
000094 d02c rcall long_delay
000095 e371 ldi EEard,49 ;Set the eeprom address to "Delete SMS" command
load3:
000096 d013 rcall eeread
000097 2322 tst Txbyte ;see if at end of message
000098 f011 breq br2 ;if zero found, start over
000099 d01f rcall b_transmit ;sent out char
00009a cffb rjmp load3
;rcall nextline ;
00009b e275 br2:ldi EEard,37
00009c cf6d rjmp load
;=====================================================
read:
00009d 9543 inc temp2
00009e 2fa4 mov ramadr,temp2
00009f 2fca mov YL,ramadr
0000a0 9129 ld txbyte,Y+
0000a1 d017 rcall b_transmit
0000a2 95aa dec ramadr
0000a3 2fca mov YL,ramadr
0000a4 9129 ld txbyte,Y+
0000a5 d013 rcall b_transmit
0000a6 9543 inc temp2
0000a7 955a dec temp3
0000a8 f7a1 brne read
0000a9 9508 ret
;=============================================================
;=============================================================
EERead:
0000aa 99e1 sbic EECR,EEWE ;if EEWE not clear
0000ab cffe rjmp EERead ; wait more
0000ac bb7e out EEAR,EEard ;output address
;***** Issue EEPROM read strobe twice due to a bug in AVR!
0000ad 9ae0 sbi EECR,EERE ;set EEPROM Read strobe 2nd time
;This instruction takes 4 clock cycles since
;it halts the CPU for two clock cycles
0000ae b32d in Txbyte,EEDR ;get data
0000af d016 rcall delay
0000b0 9573 inc EEard ;point to next EE address
0000b1 9508 ret
0000b2 cff7 rjmp EERead
0000b3 9508 ret
;=============================================>
nextline:
0000b4 e02d ldi txbyte,0x0d
0000b5 d003 rcall b_transmit
0000b6 e02a ldi txbyte,0x0a
0000b7 d001 rcall b_transmit
0000b8 9508 ret
;========================================================================
;***************************************************************************
; Transmiting routine (The data from the eeprom through the AVR are going to
; the PC computer)
;***************************************************************************
b_transmit:
0000b9 9b5d sbis USR,UDRE ;is UART transmitter ready?
0000ba cffe rjmp b_transmit
0000bb b92c out UDR,txbyte ;sent out char
0000bc 9508 ret
;*************************************************************************
; Receiving routine (The data from PC computer through to the AVR are going
; to the eeprom)
;*************************************************************************
receive:
0000bd 9b5f sbis USR,RXC
0000be cffe rjmp receive
0000bf b13c in Rxbyte,UDR
0000c0 9508 ret
;*******************************************************************
; Stop and Delay routines
;*******************************************************************
long_delay:
0000c1 e2f0 ldi delay3,32
waitmore2:
0000c2 d003 rcall delay
0000c3 95fa dec delay3
0000c4 f7e9 brne waitmore2
0000c5 9508 ret
delay:
0000c6 efcf ldi delay2,0xff
waitsome:
0000c7 efbf ldi delay1,0xff
waitmore:
0000c8 95ba dec delay1
0000c9 f7f1 brne waitmore
0000ca 95ca dec delay2
0000cb f7d9 brne waitsome
0000cc 9508 ret
.eseg
000000 msg: .db 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,"-------"
000000 00
000001 01
000002 02
000003 03
000004 04
000005 05
000006 06
000007 07
000008 08
000009 09
00000a 2d
00000b 2d
00000c 2d
00000d 2d
00000e 2d
00000f 2d
000010 2d
.db 0x0A,0x0B,0x0C,0x0D,0x0E,0x0F
000011 0a
000012 0b
000013 0c
000014 0d
000015 0e
000016 0f
000017 msg2: .db "AT+CPMS=",'"',"ME",'"' ,0x0d,0x0a ;Select the phone memory ("ME")
000017 41
000018 54
000019 2b
00001a 43
00001b 50
00001c 4d
00001d 53
00001e 3d
00001f 22
000020 4d
000021 45
000022 22
000023 0d
000024 0a
.db "AT+CMGR=1" ,0x0d,0x0a, 0 ;read the received message(Memory possition 1)
000025 41
000026 54
000027 2b
000028 43
000029 4d
00002a 47
00002b 52
00002c 3d
00002d 31
00002e 0d
00002f 0a
000030 00
.db "AT+CMGD=1" ,0x0d,0x0a, 0 ;delete the received message (Memory possition 1)
000031 41
000032 54
000033 2b
000034 43
000035 4d
000036 47
000037 44
000038 3d
000039 31
00003a 0d
00003b 0a
00003c 00
Assembly complete with no errors.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -