Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Wich AT commends are set for sms controller

Status
Not open for further replies.
Yes Friend I think problem is uc program I am Right?

- - - Updated - - -

Yes friend I think problem is uc program I am Right?
 

Hi,

I don't understand what is your problem, and what you have to do with your project.
Please describe in detail that What is your actual problem?

Regards,
 
Hi,

first compile ASM file as it is get from Web, and check your AVR environment is properly set for ASM file compilation.
If there is not any compilation error found then replace existing line in ASM file
" select_phone_memory: .db "AT+CPMS=",'"',"ME",'"',0x0d,0 ;Select the phone memory ("ME") "
with
" select_phone_memory: .db "AT+CPMS=",'"',"SM",'"',0x0d,0 ;Select the phone memory ("ME") "
or try with this line also
" select_phone_memory: .db "AT",0x0d,0 ; "

You need some ASM programming knowledge....

Regards,

Friend I have to Compiled as you say but nothing change
Friend I think problem is uc side it will sending AT commends but not decoding the received message I have to send the hyper Terminal report in 19th post please refer this Excuse Me I am poor in English Please try to understand my Language :roll:
 
Last edited:

Hi,

you can use some kind of trap circuit. Trap circuit means one type of MAX232 circuit whose one end connect to PC serial port and other side use only RX line which connect to Micro TX - Modem RX line. Using this type of trap circuit, you can watch command send by micro to module on your computer screen.
One other MAX232 trap circuit, you can use, whose one end connect to your second PC serial port if you have, and other side use only RX line which connect to Module Tx - Micro Rx line. by this you can also watch parallel how modem reply to micro on your computer screen.
------------RX----- RX Trap MAX232 to PC
------------|------- |
------------|------- |
Micro TX ---|------- |---------- RX Modem
RX ----------------- |---------- TX

Regards,
 
Hi,

you can use some kind of trap circuit. Trap circuit means one type of MAX232 circuit whose one end connect to PC serial port and other side use only RX line which connect to Micro TX - Modem RX line. Using this type of trap circuit, you can watch command send by micro to module on your computer screen.
One other MAX232 trap circuit, you can use, whose one end connect to your second PC serial port if you have, and other side use only RX line which connect to Module Tx - Micro Rx line. by this you can also watch parallel how modem reply to micro on your computer screen.
------------RX----- RX Trap MAX232 to PC
------------|------- |
------------|------- |
Micro TX ---|------- |---------- RX Modem
RX ----------------- |---------- TX

Regards,

Hi,

you can use some kind of trap circuit. Trap circuit means one type of MAX232 circuit whose one end connect to PC serial port and other side use only RX line which connect to Micro TX - Modem RX line. Using this type of trap circuit, you can watch command send by micro to module on your computer screen.
One other MAX232 trap circuit, you can use, whose one end connect to your second PC serial port if you have, and other side use only RX line which connect to Module Tx - Micro Rx line. by this you can also watch parallel how modem reply to micro on your computer screen.
------------RX----- RX Trap MAX232 to PC
------------|------- |
------------|------- |
Micro TX ---|------- |---------- RX Modem
RX ----------------- |---------- TX

Regards,

Friend I have to tested like that Only I don't know how to take screen shot That's why I have to send capture text of Hyper Terminal
EXPLANATION
First uc sending command AT+CPMS="SM"
Modem giving reply +CPMS: 1,30,1,30,1,30
uc AT+CMGF=1
modem OK
uc AT+CSDH=0
modem OK
uc AT+CMGR=1
modem +CMGR: "REC UNREAD","+917702002684",,"13/06/18,17:03:33+22"
1234 Relay1=1 Relay2=0 Relay3=1 Relay4=1 Status

OK
uc AT+CMGR=1
+CMGR: "REC READ","+917702002684",,"13/06/18,17:03:33+22"
modem 1234 Relay1=1 Relay2=0 Relay3=1 Relay4=1 Status

OK
uc AT+CMGD=1
modem OK

ERROR

AGAIN ALSO SAME LIKE THIS
AT+CPMS="SM"
+CPMS: 0,30,0,30,0,30

OK
AT+CMGF=1
OK
AT+CSDH=0
OK
AT+CMGR=1
OK
AT+CMGR=1
OK
AT
ERROR

But uc not decoding the Message and not try to send reply Message......
 
Last edited:

Hi,

Tell me
1) Does your relay on circuit board work according to your SMS? means
For below SMS, Does your relay1 On, Relay2 Off like wise...
+CMGR: "REC READ","+918978903145",,"13/06/15,20:40:04+22"
1234 Relay1=1 Relay2=0 Relay3=1 Relay4=1 Status

2) For reply SMS, Does your SIM card (SIM card in Modem) has enough balance to send SMS? Check with another SIM Card or your mobile SIM card insert in Modem and check.

Regards,
 
Friend NO ....... That SIM card working perfectly all right anyway I have to checked with "3" sim cards one by one But nothing change
One more thing "uc" out put Means("4" Relay's )are in disarm condition only any time That's why I think "uc" Try to read the Message but not decoding the Message I am Right are wrong ? please tell me
 
Last edited:

Friend NO ....... That SIM card working perfectly all right anyway I have to checked with "3" sim cards one by one But nothing change
One more thing "uc" out put Means("4" Relay's )are in disarm condition only any time That's why I think "uc" Try to read the Message but not decoding the Message I am Right are wrong ? please tell me

Friend Please check the "ASM" ......... My "uc"Not decoding the receiving Message
Code:
;	
;	
;	SMS REMOTE CONTROL, WITH VISIONTEK GSM MODEM 82GM
;
;
;	written with AVR studio 4.12
; 
;
;	by Serasidis Vasilis 
;
;	Home: [url]https://www.serasidis.gr[/url]
;	email: [email]info@serasidis.gr[/email] - [email]avrsite@yahoo.gr[/email]
;	
;	
;	Target: ATtiny2313 with 4 MHz crystal
;	PD0 = RxD
;	PD1 = TxD
;	PD2-PD5 = 4 RELAYS
;	PB0-PB7 = 8 INPUTS.
;	
;   Created at 04.Jan.2006 by Vassilis Serasidis
;   This source code is distributed under GNU public license (License file is included in the zip file).
;	If you don't agree with the license, please do not use this file.
;	
;	



.equ	BAUD		=25 	;9600 bps at 4.00 MHz.
.equ	RamStart	=96		;First RAM address byte.
.equ	SMSC		=100	;RAM address for SMS Service Center 
.equ	TPDA		=118	;RAM address for Sender's number 
.equ	TimeDate	=134	;RAM address for Time and date of received SMS
.equ	ASCII_HEX 	=185	;RAM address for ASCII to HEX conversion
.equ	SMScommand	=150	;RAM address for encoded SMS command (11001010)
.equ	Relay1		=2	
.equ	Relay2		=3
.equ	Relay3		=4
.equ	Relay4		=5
.equ	good		=$10
.equ	error		=$20

.def	eeadr	=R17
;.def	backup_status_register = r5
.def	temp	=R16		;temporary storage register
.def	Txbyte	=R18		;Data to be transmitted
.def	Rxbyte	=R19		;Received data
.def	temp2	=R20
.def	temp3	=R21
.def	temp4	=R22
.def	No_of_relay	=R22
.def	output	=R23
.def	Byte_counter	=R24
.def	No_Of_ignore_bytes		=R25		;
.def	status =r26

.def	delay1	=R26
.def	delay2	=R27
.def	YLramadr=R28
.def	YHramadr=R29
.def	delay3	=R29
.def	ZLramadr=R30
.def	ZHramadr=R31

.include "tn2313def.inc"		;Define chip particulars


;========================================================================


.org	0
	rjmp	reset

;.org	OVF0addr			; Timer/Counter0 Overflow
;	clr		interrupt
;	in 		backup_status_register,SREG
;	inc		interrupt
;
;	ldi		temp,0b11001100
;	out		portb,temp
;	out 	SREG,backup_status_register
;	reti


;*******************************************************************

;read_module_ID:			.db "ATI" ,0x0d, 0					;Show module's ID (SIMCOM_Ltd)
;enable_clip:			.db "AT+CLIP=1" ,0X0d, 0			;enable CLIP
select_phone_memory:	.db	"AT+CPMS=",'"',"SM",'"',0x0d,0	;Select the phone memory ("SM")
set_text_mode:			.db "AT+CMGF=1" ,0x0d,0,0			;Select text mode
;enable_RI_on_SMS:		.db "AT*E2SMSRI=1000" ,0x0d, 0		;Enable Ring pin after incomming SMS.
Hide_SMS_details:		.db "AT+CSDH=0", 0x0d,0,0			;Show only phone number, date-time, text of SMS.
Read_received_sms:		.db	"AT+CMGR=1" ,0x0d,0,0 			;read the received message(Memory possition 1)
Send_SMS_command:		.db "AT+CMGS=",0,0					;Send SMS command
Delete_SMS:				.db	"AT+CMGD=1" ,0x0d,0,0			;delete the received message (Memory possition 1)
Relay:					.db	"Relay", 0
cmdOut:					.db	"Input", 0								   	

.db "SMS REMOTE CONTROL, FOR SIMCOM_Ltd SIMCOM_SIM300 "
.db "Written by Serasidis Vasilis at December 2005 "
.db	"http://www.serasidis.gr [email]info@serasidis.gr[/email] - [email]avrsite@yahoo.gr[/email]"


.cseg
reset:

;	Setup buffers and pointers


	ldi		temp,RAMEND
	out		SPL,temp			;Init Stack Pointer


	ldi		temp,0b00000000
	out		DDRB,temp
	ldi		temp,0b11111111
	out		portB,temp

	ldi		temp,0b11111110
	out		DDRD,temp
	ldi		temp,0b00000000
	out		portD,temp

	;ldi	temp,(1<<CS02)+(0<<CS01)+(1<<CS00)
	;out	TCCR0,temp			; Set clock to count on CK/1024
	;ldi	temp,(1<<TOIE0)
	;out	TIMSK,temp			; enable timer 0 overflow interrupt

	ldi		temp,BAUD
	out		UBRR,temp			;Set baud rate generator


;===========   Set UART, as Transmiter   ======================

	ldi		temp,0b00011000
	out		UCR,temp			;Enable UART Tx and Rx 
;==============================================================


;==============================================================
;		Send command to module
;==============================================================
	
	rcall	long_delay

Start:
	;ldi		zl,low(read_module_ID*2)	;
	;ldi		zh,high(read_module_ID*2)	;
	;rcall	send_command
	;ldi		No_Of_ignore_bytes,1
	;rcall	receive2					;Read all response bytes.

	;ldi		zl,low(enable_clip*2)	;
	;ldi		zh,high(enable_clip*2)	;
	;rcall	send_command
	;rcall	receive

select_phone_mem:
	ldi		zl,low(select_phone_memory*2)	;
	ldi		zh,high(select_phone_memory*2)	;
	rcall	send_command
	rcall	receive2
	rcall	check_for_command_error
	cpi		temp,good
	brne	select_phone_mem

set_text_mod:
	ldi		zl,low(set_text_mode*2)		;
	ldi		zh,high(set_text_mode*2)	;
	rcall	send_command
	rcall	receive2
	rcall	check_for_command_error
	cpi		temp,good
	brne	set_text_mod

	;ldi		zl,low(enable_RI_on_SMS*2)		;
	;ldi		zh,high(enable_RI_on_SMS*2)	;
	;rcall	send_command
	;rcall	receive

Hide_SMS_detail:
	ldi		zl,low(Hide_SMS_details*2)		;
	ldi		zh,high(Hide_SMS_details*2)	;
	rcall	send_command
	rcall	receive2
	rcall	check_for_command_error
	cpi		temp,good
	brne	Hide_SMS_detail


	ldi		zl,low(Read_received_sms*2)		;
	ldi		zh,high(Read_received_sms*2)	;
	rcall	send_command
	rcall	receive2
	rcall	check_for_command_error
	cpi		temp,good
	brne	start


Read_receiv_sms:
	ldi		zl,low(Read_received_sms*2)		;
	ldi		zh,high(Read_received_sms*2)	;
	rcall	send_command

	ldi		No_Of_ignore_bytes,71	;ignore first 71 bytes of received SMS (part: +CMGR: "REC READ","+917702002684",,"05/11/29,14:17:12+08"[CR][LF] )
	rcall	from_read_phone_number	

	rcall	check_for_command_error
	cpi		temp,good
	brne	exit_from_here

;==============================================================
;
;==============================================================

;	ldi		txbyte,'a'
;	rcall	b_transmit
;	ldi		txbyte,'t'
;	rcall	b_transmit
;	ldi		YL,RamStart
;
;send_all_rambytes:
;	ld		txbyte,Y+
;	tst		txbyte		;test if txbyte is zero
;	breq	loop		;if yes, go to loop	
;	rcall	b_transmit
;	out		portb,txbyte
;	rjmp	send_all_rambytes

;------------ Check password --------------

	ldi		YL,ramstart
	clr		eeadr
	ldi		byte_counter,4
check_password:
	rcall	eeread
	ld		temp2,Y+
	cp		temp2,temp
	brne	check_for_recovery_password				;If is not the same, go to check it is the recovery password.
	dec		byte_counter
	brne	check_password
	rjmp	read_next

;------------ Check for recovery password --------------
check_for_recovery_password:
	ldi		YL,ramstart
	ldi		byte_counter,4
	ldi		eeadr,5	;eeprom address after '*' character.

check_next_recovery_byte:
	rcall	eeread
	ld		temp2,Y+
	cp		temp2,temp
	brne	exit_from_this_routine
	dec		byte_counter
	brne	check_next_recovery_byte
	rjmp	recovery_password
	
exit_from_this_routine:	
;	delete_received_message:
	ldi		zl,low(Delete_SMS*2)	;
	ldi		zh,high(Delete_SMS*2)	;
	rcall	send_command

exit_from_here:

	ldi		txbyte,'A'
	rcall	b_transmit
	ldi		txbyte,'T'
	rcall	b_transmit
	rjmp	Send_ESC_sequence


read_next:
;------------ Check for <password change> symbol "*" --------------

	ld		temp,Y+
	cpi		temp,'*'	;check for password change symbol "*"
	brne	read_next2

	ldi		byte_counter,4
	clr		eeadr
write_all_password_bytes_to_ram:
	ld		temp,Y+
	rcall	eewrite
	dec		byte_counter
	brne	write_all_password_bytes_to_ram

;------------ Check for relay status and arm or disarm the relays --------------
read_next2:

	clr		output
	ldi		YL,ramstart

;========
check_for_1st_relay:

	cpi		YL,252
	breq	check_for_2nd_relay
	ld		txbyte,Y+
	cpi		txbyte,'1'
	brne	check_for_1st_relay
	ld		txbyte,Y+
	cpi		txbyte,'='
	brne	check_for_1st_relay
	ld		txbyte,Y+
	cpi		txbyte,'1'
	brne	check_for_zero
	sbi		portd,Relay1
	rjmp	check_for_2nd_relay
check_for_zero:
	cpi		txbyte,'0'
	brne	check_for_2nd_relay
	cbi		portd,Relay1

;========
check_for_2nd_relay:
	ldi		YL,ramstart
check_for_2nd_relayb:

	cpi		YL,252
	breq	check_for_3rd_relay
	ld		txbyte,Y+
	cpi		txbyte,'2'
	brne	check_for_2nd_relayb
	ld		txbyte,Y+
	cpi		txbyte,'='
	brne	check_for_2nd_relayb
	ld		txbyte,Y+
	cpi		txbyte,'1'
	brne	check_for_zero2
	sbi		portd,Relay2
	rjmp	check_for_3rd_relay
check_for_zero2:
	cpi		txbyte,'0'
	brne	check_for_3rd_relay
	cbi		portd,Relay2

;========
check_for_3rd_relay:
	ldi		YL,ramstart
check_for_3rd_relayb:

	cpi		YL,252
	breq	check_for_4th_relay
	ld		txbyte,Y+
	cpi		txbyte,'3'
	brne	check_for_3rd_relayb
	ld		txbyte,Y+
	cpi		txbyte,'='
	brne	check_for_3rd_relayb
	ld		txbyte,Y+
	cpi		txbyte,'1'
	brne	check_for_zero3
	sbi		portd,Relay3
	rjmp	check_for_4th_relay
check_for_zero3:
	cpi		txbyte,'0'
	brne	check_for_4th_relay
	cbi		portd,Relay3

;========
check_for_4th_relay:
	ldi		YL,ramstart
check_for_4th_relayb:

	cpi		YL,252
	breq	check_for_status
	ld		txbyte,Y+
	cpi		txbyte,'4'
	brne	check_for_4th_relayb
	ld		txbyte,Y+
	cpi		txbyte,'='
	brne	check_for_4th_relayb
	ld		txbyte,Y+
	cpi		txbyte,'1'
	brne	check_for_zero4
	sbi		portd,Relay4
	rjmp	check_for_status
check_for_zero4:
	cpi		txbyte,'0'
	brne	check_for_status
	cbi		portd,Relay4

;------------ check	for <status> command inside the SMS ------------

check_for_status:
	ldi		YL,ramstart

check_next_byte_for_status:
	ld		txbyte,Y+
	cpi		YL,252
	breq	aaaa
	rjmp	check_for_s

aaaa:	
	rjmp	Send_ESC_sequence

check_for_s:
	cpi		txbyte,'s'
	breq	check_for_t
	cpi		txbyte,'S'
	brne	check_next_byte_for_status

check_for_t:
	ld		txbyte,Y+
	cpi		txbyte,'t'
	breq	check_for_a
	cpi		txbyte,'T'
	brne	check_next_byte_for_status
check_for_a:
	ld		txbyte,Y+
	cpi		txbyte,'a'
	breq	check_for__t
	cpi		txbyte,'A'
	brne	check_next_byte_for_status
check_for__t:
	ld		txbyte,Y+
	cpi		txbyte,'t'
	breq	check_for_u
	cpi		txbyte,'T'
	brne	check_next_byte_for_status
check_for_u:
	ld		txbyte,Y+
	cpi		txbyte,'u'
	breq	check_for__s
	cpi		txbyte,'U'
	brne	check_next_byte_for_status
check_for__s:
	ld		txbyte,Y+
	cpi		txbyte,'s'
	breq	Request_status
	cpi		txbyte,'S'
	brne	check_next_byte_for_status

;=========== read the relay's status ============
Request_status:
	ldi		zl,low(Read_received_sms*2)		; Re-read the SMS to see the phone number of the sender.
	ldi		zh,high(Read_received_sms*2)	;
	rcall	send_command
	ldi		temp2,50					;read 20 bytes
	ldi		No_Of_ignore_bytes,12		;Leave first 12 of received bytes.
	rcall	from_read_phone_number		;read again the SMS.

	ldi		zl,low(Send_SMS_command*2)	;
	ldi		zh,high(Send_SMS_command*2)	;
	rcall	send_command
	ldi		YL,ramstart + 18	;go to sender's phone number in RAM (RAM address 113) exclude the first (") symbol.
	ld		txbyte,Y+
	rcall	b_transmit
	;ldi		txbyte,'a'
	;rcall	b_transmit
	;ldi		txbyte,'t'
	;rcall	b_transmit
send_phone_number:
	ld		txbyte,Y+
	rcall	b_transmit
	cpi		txbyte,'"'
	brne	send_phone_number
	ldi		txbyte,0x0d
	rcall	b_transmit
	rcall	delay
	rcall	delay
	rcall	delay
	rcall	delay
	rcall	delay
	rcall	delay


send_nxt:
	ldi		zl,low(Relay*2)		;
	ldi		zh,high(Relay*2)	;
	rcall	send_command
	ldi		txbyte,'1'
	rcall	b_transmit
	ldi		txbyte,'='
	rcall	b_transmit
	sbic	portD,relay1
	rjmp	send_one
	ldi		txbyte,'0'
send1:
	rcall	b_transmit
	ldi		txbyte,' '
	rcall	b_transmit

	ldi		zl,low(Relay*2)		;
	ldi		zh,high(Relay*2)	;
	rcall	send_command
	ldi		txbyte,'2'
	rcall	b_transmit
	ldi		txbyte,'='
	rcall	b_transmit
	sbic	portD,relay2
	rjmp	send_one2
	ldi		txbyte,'0'
send2:
	rcall	b_transmit
	ldi		txbyte,' '
	rcall	b_transmit

	ldi		zl,low(Relay*2)		;
	ldi		zh,high(Relay*2)	;
	rcall	send_command
	ldi		txbyte,'3'
	rcall	b_transmit
	ldi		txbyte,'='
	rcall	b_transmit
	sbic	portD,relay3
	rjmp	send_one3
	ldi		txbyte,'0'
send3:
	rcall	b_transmit
	ldi		txbyte,' '
	rcall	b_transmit

	ldi		zl,low(Relay*2)		;
	ldi		zh,high(Relay*2)	;
	rcall	send_command
	ldi		txbyte,'4'
	rcall	b_transmit
	ldi		txbyte,'='
	rcall	b_transmit
	sbic	portD,relay4
	rjmp	send_one4
	ldi		txbyte,'0'
send4:
	rcall	b_transmit
	ldi		txbyte,' '
	rcall	b_transmit


;========= Read the 8 input status =========

	ldi		byte_counter,8
	in		status,pinB
	com		status				;invert	data
	ldi		no_of_relay,'1'

send_nxt2:
	ldi		zl,low(cmdOut*2)		;
	ldi		zh,high(cmdOut*2)	;
	rcall	send_command
	mov		txbyte,no_of_relay
	rcall	b_transmit
	ldi		txbyte,'='
	rcall	b_transmit
	sbrc	status,0
	rjmp	send_onee
	ldi		txbyte,'0'
send1e:
	rcall	b_transmit
	ldi		txbyte,' '
	rcall	b_transmit
	dec		byte_counter
	breq	send_message_
	ror		status
	inc		no_of_relay
	rjmp	send_nxt2

send_message_:
	ldi		txbyte,26		;<Ctrl-Z> key
	rcall	b_transmit
	ldi		txbyte,$0D
	rcall	b_transmit
	rcall	long_delay

delete_old_message:
	ldi		zl,low(Delete_SMS*2)	;
	ldi		zh,high(Delete_SMS*2)	;
	rcall	send_command
	rcall	long_delay
	rjmp	Send_ESC_sequence

send_onee:
	ldi		txbyte,'1'
	rjmp	send1e

send_one:
	ldi		txbyte,'1'
	rjmp	send1

send_one2:
	ldi		txbyte,'1'
	rjmp	send2

send_one3:
	ldi		txbyte,'1'
	rjmp	send3

send_one4:
	ldi		txbyte,'1'
	rjmp	send4
;------------ 
next:

	rjmp	loop	
;----------------------------------------------------		
send_command:
	lpm
	tst		r0				;check if it's the last character (zero number)
	breq	return			;if it is, return.
	mov		txbyte,r0
	rcall	b_transmit		;
	adiw	zl,1			;increase zl
	rjmp	send_command	;read the next character from flash memory

return:		ret


;read_response:
;	ldi		No_Of_ignore_bytes,71	;ignore first 71 bytes of received SMS (part: +CMGR: "REC READ","+917702002684",,"05/11/29,14:17:12+08"[CR][LF] )
;	rcall	from_read_phone_number	;Go to receive bytes from module
;	com		temp4
;	ret
;----------------------------------------------------
Send_ESC_sequence:
	ldi		txbyte,$1B	;escape key
	rcall	b_transmit
	ldi		txbyte,$0D
	rcall	b_transmit

	rcall	long_delay

	rjmp	start		;Read all the time the last SMS


loop:	rjmp	loop

;----------------------------------------------------
check_for_command_error:

	ldi		YL,ramstart
	ldi		byte_counter,120
read_for_next:
	dec		byte_counter
	breq	exit_from_check_error
	ld		temp,Y+
	cpi		temp,0
	breq	exit_from_check_error
	cpi		temp,'O'
	brne	read_for_next
	ld		temp,Y+
	cpi		temp,'K'
	brne	read_for_next
	ldi		temp,good
	ret

exit_from_check_error:
	ldi		temp,error	
	ret
;=============================================================
;		<Change line> and <Enter> ASCII commands
;=============================================================
;nextline:
;	ldi		txbyte,0x0d
;	rcall	b_transmit
;	ldi		txbyte,0x0a
;	rcall	b_transmit
;
;	ret
;
;***************************************************************************
; Transmiting routine (The data from the eeprom through the AVR are going to
; the PC computer)         
;***************************************************************************
b_transmit:	
	sbis	USR,UDRE	;is UART transmitter ready?
	rjmp	b_transmit
	out		UDR,txbyte	;sent out char
	ret

;*************************************************************************
; Receiving routine (The data from PC computer through to the AVR are going
; to the eeprom)  
;*************************************************************************
receive2:
	ldi		No_Of_ignore_bytes,12		;Ignore the first 12 AT command bytes.
	rjmp	from_read_phone_number
receive:	
	ldi		No_Of_ignore_bytes,1

from_read_phone_number:
	ldi		YL,RamStart					;The first byte of RAM
	clr		temp4
	clr		Byte_counter		

Delay_routine1:
	ldi		temp3,5
Delay_routine2:
	ldi		temp2,255
Delay_routine3:
	ldi		temp,255
loop2:
	sbic	USR,RXC
	rjmp	continue
	dec		temp
	brne	loop2
	dec		temp2
	brne	Delay_routine3
	dec		temp3
	brne	Delay_routine2
	rjmp	exit

continue:
	in		Rxbyte,UDR
	inc		Byte_counter
	cp		No_Of_ignore_bytes,byte_counter		
	brge	Delay_routine1
	st		Y+,RxByte
	inc		temp4
	cpi		YL,ramend-5 				;If RAM address is at 250th byte, go to exit because it will erase the "return" stack pointer. 
	breq	exit
	rjmp	Delay_routine1

exit:
	ldi		RxByte,0
	st		Y+,RxByte
	ret

;=================================================================
;               Recovery password routine
;=================================================================
recovery_password:
	ldi		YL,ramstart
	clr		eeadr
	ldi		byte_counter,4
	ldi		temp,'1'
write_next_password_number:
	rcall	eewrite
	inc		temp
	dec		byte_counter
	brne	write_next_password_number

delete_old_message2:
	ldi		zl,low(Delete_SMS*2)	;
	ldi		zh,high(Delete_SMS*2)	;
	rcall	send_command
	rcall	long_delay

	rjmp	Send_ESC_sequence			;go to send ESC sequence and then go to start.

;=================================================================
;               eeprom read routine
;=================================================================

EERead:
	out 	EEAR,eeadr		;send address to EEPROM 
	sbi 	EECR,EERE		;strobe EEPROM
	in 		temp,EEDR		;read decoded number
	inc		eeadr
	ret

;=================================================================
;               eeprom write routine
;=================================================================
EEWrite:
	sbic	EECR,EEWE		;if EEWE not clear
	rjmp	EEWrite			;    wait more

	out		EEAR,eeadr	
	out		EEDR,temp		;output data
	sbi 	EECR,EEMWE		;set master write enable
	sbi		EECR,EEWE		;set EEPROM Write strobe
 	inc		eeadr	
	ret

;=================================================================
;               Delay routine
;=================================================================

long_delay:
	ldi		delay3,100
waitmore2:
	rcall	delay
	dec		delay3
	brne	waitmore2
	ret	



delay:
	ldi		delay2,255
waitsome:
	ldi		delay1,255			

waitmore:
	dec		delay1
	brne	waitmore
	dec		delay2
	brne	waitsome
	
	ret

.eseg
;1234 is programable password. 5268 is the fixed recovery password (like PUK password).
.db	"5678*5268"
 
Last edited by a moderator:

I can't help you with AVR assembly language. What do you mean by message is not decoding? If you send read message command then message stored will be sent through usart. You have to get the data into a buffer and then terminate it with null character and then display the string on LCD. Post the code for usart interrupt.
 

Friend I didn't understand "usart" I don't know usart what he do .....anyway i am sending asm file Please check this
 

Attachments

  • SMSCONTROLLERMETOME.rar
    4.4 KB · Views: 64

Hi,

Tell me
1) Does your relay on circuit board work according to your SMS? means
For below SMS, Does your relay1 On, Relay2 Off like wise...
+CMGR: "REC READ","+918978903145",,"13/06/15,20:40:04+22"
1234 Relay1=1 Relay2=0 Relay3=1 Relay4=1 Status

2) For reply SMS, Does your SIM card (SIM card in Modem) has enough balance to send SMS? Check with another SIM Card or your mobile SIM card insert in Modem and check.

Regards,

Friend thanks to your cooperation this is working perfectly actually problem is AT commends side when I have to change the commends it's working perfectly But I am facing the one more problem
If sim card is getting the unknown message (network message) uc was not deleting that Message and didn't read the new message also So I want to change the ASM like this ....... every time read the memory position last message
So please help me how to change this...... And if possible when in put "1 to 8" will be open I want to get Message automatically So please help me how to change the ASM ......:smile:
 

Attachments

  • SIM 300 MODEM ACTIVE PROFILE.rar
    508 bytes · Views: 61
Last edited:

Dear Friend any body help again I am getting the problem uc not decoding the received message I didn't understand ware I have to mistake
 

Attachments

  • Movavi Li.rar
    5.3 MB · Views: 64

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top