📄 sms_controller.lst
字号:
AVRASM ver. 1.57 D:\avr 05-09-03\Projects\sms_controller\sms_controller.asm Mon Nov 17 19:26:00 2003
warning : Register already defined by the .DEF directive
warning : Register already defined by the .DEF directive
warning : Register already defined by the .DEF directive
warning : Register already defined by the .DEF directive
warning : Register already defined by the .DEF directive
warning : Register already defined by the .DEF directive
D:\avr 05-09-03\Projects\sms_controller\sms_controller.asm(393): warning: A .db segment with an odd number of bytes is detected. A zero byte is added.
;
;
; REMOTE CONTROL WITH SMS, FOR ERICSSON T10 GSM MOBILE PHONES
;
; This circuit can handle 8 devices by sending SMS message with a mobile phone.
; 30-oct-2002 v1.0
; 04.10.2003 v1.01 --- I have change some routines to be more workable
; writed with AVR studio 4.2
;
;
; by Serasidis Vasilis
;
; Home: http://www.serasidis.gr
; email: info@serasidis.gr
;
;
; Target: AT90S2313 with 8 MHz crystal
; PD0= RxD
; PD1= TxD
; PB0-PB7= 8 bit output. You can drive with this port, 8 relays, 1 to eatch pin.
; Send SMS message to T10, like this format: 11100101
; That its mean, arm the relays No 1,3,6,7,8 and disarm the relays 2,4 and 5.
;
;
;
.nolist ;Suppress listing of include file
.equ BAUD =51 ;9600 bps at 8.00 MHz.
.def temp =R16 ;temporary storage register
.def EEard =R17 ;EEPROM address to read from
.def Txbyte =R18 ;Data to be transmitted
.def Rxbyte =R19 ;Received data
.def temp2 =R20
.def temp3 =R21
.def temp4 =R25
.def temp5 =R29
.def temp6 =R30
.def ramtemp =r24 ;temporary storage register
.def ramsize =r22 ;size of block to be copied
.def EEard =R23 ;EEPROM address to read from
.def RamAdr =R26
.def delay1 =R27
.def delay2 =R28
.def delay3 =R31
.cseg
.org 0
;========================================================================
reset:
; Setup buffers and pointers
000000 ed0f ldi temp,RAMEND
000001 bf0d out SPL,temp ;Init Stack Pointer
000002 ef0f ldi temp,0b11111111
000003 bb07 out DDRB,temp
000004 e303 ldi temp,BAUD
000005 b909 out UBRR,temp ;Set baud rate generator
;=========== Set UART, as Transmiter =====================
000006 e108 ldi temp,0b00011000
000007 b90a out UCR,temp ;Enable UART Tx w/o interrupts
;==============================================================
000008 d0b8 rcall long_delay
000009 e177 ldi EEard,0x17
load:
00000a d09f rcall eeread
00000b 2322 tst Txbyte ;see if at end of message
00000c f011 breq br1 ;if zero found, start over
00000d d0ab rcall b_transmit ;sent out char
00000e cffb rjmp load
00000f e6a0 br1:ldi ramadr,96 ;Its the first byte of RAM
000010 e140 ldi temp2,16 ;16 bytes ram
uart2ram:
000011 d0ab rcall receive ;call getchar
000012 2fca mov YL,ramadr ;init Z-pointer
000013 9339 st Y+,rxbyte ;store data to RAM
000014 95a3 inc ramadr ;
000015 954a dec temp2
000016 f7d1 brne uart2ram ;if not done, loop more
000017 e6a0 ldi ramadr,96 ;
;--------------------------------------------------------
000018 e6a6 ldi ramadr,102 ;Memory potition for letter 'G' in ram
000019 2fca mov YL,ramadr ;Send the ram address
00001a 9129 ld txbyte,Y+ ;load the contain of selected potition
00001b 3427 cpi txbyte,'G' ;Look if its 'G' letter
00001c f031 breq aa ;If yes, go to read all message from the phone
;--------------------------------------------------------
00001d e275 ldi EEard,37
00001e d0a7 rcall delay
00001f d0a6 rcall delay
000020 d0a5 rcall delay
000021 d0a4 rcall delay
000022 cfe7 rjmp load
;===================================================================
000023 e275 aa: ldi EEard,37
load2:
000024 d085 rcall eeread
000025 d093 rcall b_transmit ;sent out char
000026 2322 tst Txbyte ;see if at end of message
000027 f7e1 brne load2 ;if zero found, start over
000028 e6a0 ldi ramadr,96 ;Its the first byte of RAM
000029 e547 ldi temp2,87 ;87 bytes ram
uart2ram2:
00002a d092 rcall receive ;call getchar
00002b 2fca mov YL,ramadr ;init Z-pointer
00002c 9339 st Y+,rxbyte ;store data to RAM
00002d 95a3 inc ramadr ;
00002e 954a dec temp2
00002f f7d1 brne uart2ram2 ;if not done, loop more
;===================================================================
000030 d083 rcall nextline ;\
000031 e22b ldi txbyte,'+' ; \
000032 d086 rcall b_transmit ; \
000033 e745 ldi temp2,117 ; / Print the service center number
000034 e056 ldi temp3,6 ; /
000035 d067 rcall read ;/
000036 d07d rcall nextline ;\
000037 e22b ldi txbyte,'+' ; \
000038 d080 rcall b_transmit ; \
000039 e847 ldi temp2,135 ; / Print the sender`s number
00003a e056 ldi temp3,6 ; /
00003b d061 rcall read ;/
00003c d077 rcall nextline ;\
00003d e947 ldi temp2,151 ; \
00003e e051 ldi temp3,1 ; \
00003f d05d rcall read ; \
000040 e22d ldi txbyte,'-' ; \
000041 d077 rcall b_transmit ; \
000042 e051 ldi temp3,1 ; \
000043 d059 rcall read ; |
000044 e22d ldi txbyte,'-' ; |
000045 d073 rcall b_transmit ; |
000046 e051 ldi temp3,1 ; |
000047 d055 rcall read ; \
000048 e220 ldi txbyte,' ' ; / Print the date and the time of the received message.
000049 d06f rcall b_transmit ; |
00004a e051 ldi temp3,1 ; |
00004b d051 rcall read ; |
00004c e32a ldi txbyte,':' ; |
00004d d06b rcall b_transmit ; /
00004e e051 ldi temp3,1 ; /
00004f d04d rcall read ; /
000050 e32a ldi txbyte,':' ; /
000051 d067 rcall b_transmit ; /
000052 e051 ldi temp3,1 ; /
000053 d049 rcall read ;/
;=================================================================================
; Here its the routine for convert the ASCII to HEX and stored to RAM address 185
;=================================================================================
000054 eb49 ldi temp2,185 ;
000055 e058 ldi temp3,8 ;8 bytes message
000056 eaa7 ldi ramadr,167 ;First byte of the message in the RAM (message like this 11001101)
septet:
000057 2fca mov YL,ramadr ;
000058 9129 ld txbyte,Y+ ;
000059 5320 subi txbyte,0x30
00005a 2f72 mov eeard,txbyte
00005b d04e rcall eeread
00005c 9522 swap txbyte
00005d 2f92 mov temp4,txbyte
00005e 95a3 inc ramadr
00005f 2fca mov YL,ramadr ;
000060 9129 ld txbyte,Y+ ;
000061 5320 subi txbyte,0x30
000062 2f72 mov eeard,txbyte
000063 d046 rcall eeread
000064 0f92 add temp4,txbyte
000065 2f29 mov txbyte,temp4
000066 95a3 inc ramadr
000067 2fc4 mov YL,temp2 ;init Z-pointer
000068 9329 st Y+,txbyte ;store data to RAM
000069 9543 inc temp2
00006a 955a dec temp3
00006b f759 brne septet
;==============================================================
; convert the HEX values to septets
;==============================================================
00006c 2733 clr Rxbyte
00006d d046 rcall nextline ;
00006e e057 ldi temp3,7 ; Number of septets (characters).
00006f eba9 ldi ramadr,185 ;Load the 9 hex bytes from...
000070 e0d7 ldi temp5,7
000071 e0e1 ldi temp6,1
000072 2f0e mov temp,temp6
000073 2fbd mov delay1,temp5
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -