Discussion in "8051 Discussion Forum" started by    Malik_Umair    May 24, 2013.
Wed Jun 05 2013, 04:23 AM
#11
You do not have to call "ACALL SERIAL" just call it once when your main routine starts. Problem with interrupt is, You did not enable interrupts properly instead of loading IE directly you can enable individual bits that help you make things more readable
MOV IE, #00000100B ; instead of this

;use
SETB EX0 ; interrupt for external interrupt 0 (INT0)
SETB EA ; this is global interrupt flag
Wed Jun 05 2013, 04:30 PM
#12
Thanks Ajay for pointing out the mistake, but unfortunately still on activation of interrupt 0, it is not going to interrupt routine. I have written the following command:

MOV IE,#10000001B ; EA enabled and INT0 enabled
;OR
MOV IE,#81H


Also please guide me regarding the SMS receiving and storing it in accumulator? Is my receiving code good?


[ Edited Wed Jun 05 2013, 04:32 PM ]
Thu Jun 06 2013, 06:46 AM
#13
I do not see a reason why interrupt does not come. Check if INT0 is going low or not. receiving sms is tricky in case assembly.
Thu Jun 06 2013, 03:16 PM
#14
Tricky in what sense? The code which I have shared here does something but not perform full task. I have noticed that this code only reads the sms but is not copying it to accumulator. Also I want to inquire that if I send SMS containing 1 so is it a ASCII character or normal decimal number when received to the MCU?
Fri Jun 07 2013, 07:30 AM
#15
anything coming out of modem will be ascii. I saw the way you implemented things. CMGR command sends lot of stuff not just the sms text. format is somewhat like:

+CMGR: 1, ... "mobile number" ...
sms text
OK

I suggest not to give delay after CMGR command, you will have to read every single byte coming out of modem. And comparing with 1 is not the right way.. coz as I said there is a lot of data that comes with CMGR command. there will be lot of 1s in it.

You can do something like, prefix and postfix your sms with a special character e.g. instead of sending just 1 in sms send "*1#" where * is a prefix and # is postfix. In your code, wait till you get * and then start to store the data to memory till you get # and then discard everything else.
 Malik_Umair like this.
Fri Jun 07 2013, 03:45 PM
#16
Hello Dear Ajay,

I am very thankful to you the help you are providing me so far. I have modified a part of program you pointed out. Please view the updated program, please comment if you find any mistake in it. I have also deleted the delay after CMGR. The following is the program:

   LCALL CMGR   ; READ THE STORED MESSAGE
            ;LCALL DELAY1
            ;LCALL DELAY1
            ;LCALL DELAY1
            ;LCALL DELAY1
;*************************************************************
  		   MOV R1,#01H     ; set a check to receive * when SMS is received
  RECV:    JNB RI, RECV
           MOV A,SBUF
           CLR RI
           
           MOV B,A
           MOV A,R1
           CJNE A,#00H,PROCEED
           SJMP COMPARE
           
 PROCEED:  MOV A,B
 		   CJNE A,'*',RECV
           DJNZ R1, RECV
           
  COMPARE: MOV A,B
  		   CJNE A,'1', ERROR         ; If TRUE then make P2.1 HIGH
  		   SETB P2.1
  		   LCALL DELAY1
  		   LCALL DELAY1
  		   LCALL DELAY1
  		   LCALL DELAY1
  		   CLR P2.1
  		   SJMP DELETE
           
   ERROR:  SETB P2.2                      ; If FALSE then make P2.2 HIGH
   		   LCALL DELAY1
   		   LCALL DELAY1
   		   LCALL DELAY1
   		   LCALL DELAY1
   		   CLR P2.2
           CLR A

;**********************************************************
  DELETE:   LCALL CMGD    ; DELETE THE SMS STORED IN SIM
            LCALL DELAY1
            LCALL DELAY1
            LCALL DELAY1
            LCALL DELAY1
            LJMP START


[ Edited Sat Jun 08 2013, 05:57 AM ]
Fri Jun 07 2013, 08:30 PM
#17
I do not know if your code has errors, but I suggest this version
Hopefully it is simpler and easier to follow.
            LCALL CMGR   ;READ THE STORED MESSAGE    

WaitForStar:
           JNB RI,WaitForStar 
            MOV A,SBUF
            CLR RI 
            CJNE A,'*',WaitForStar

WaitForCode:                           ;the next char is a command
           JNB RI,WaitForCode
            MOV A,SBUF
            CLR RI
            CJNE A,'1', ERROR    ; If TRUE then make P2.1 HIGH
            SETB P2.1
            Sjmp CommonExit
            
ERROR:  
	     SETB P2.2          ; If FALSE then make P2.2 HIGH
   
           

CommonExit:

            LCALL DELAY1
            LCALL DELAY1
            LCALL DELAY1
            LCALL DELAY1

             CLR P2.1
             CLR P2.2

             LCALL CMGD    ; DELETE THE SMS STORED IN SIM
             LCALL DELAY1
             LCALL DELAY1
             LCALL DELAY1
             LCALL DELAY1
             LJMP START





 Malik_Umair like this.
Tags read sms modem assemblysms read gsm modem assemblyread sms using assembly
Sat Jun 08 2013, 05:57 AM
#18
well I was thinking the other way..

	MSG equ	70H ;place to store sms
	
	LCALL SMSREAD ; call to SMS read routine
	
SMSREAD:
	LCALL READBYTE	;read character
	CJNE A, #'*', SMSREAD
	
	; * receieved start reading SMS
	MOV R7, #15 ;read only upto 15 bytes
	MOV R0, #MSG ;load pointer
READMSG:
	LCALL READBYTE
	CJNE A, #'#', STOREMSG
	SJMP MSGREADDONE

STOREMSG:
	MOV @R0, A
	INC R0 ;next location
	DJNZ R7, READMSG
	
MSGREADDONE:
	;either you received # or
	;15 character read, discard everything else
	;process your msg here
	
	;Read Byte routine
READBYTE:
	JNB RI, READBYTE
	MOV A, SBUF
	CLR RI
	RET


this way you can even send long msgs like "*LIGHT1 ON#" or "*LIGHT1 OFF#" this will give you better control and makes more interactive with hardware.
 Malik_Umair like this.
Tags read sms modem assemblysms read gsm modem assemblyread sms using assembly
Fri Jun 21 2013, 05:30 AM
#19
@Malik, Do share your final code with us
Fri Jun 21 2013, 02:20 PM
#20
Hello Ajay, I have planned it very earlier that once I am done I will post the entire project at this forum. Because this is the first forum where I have posted my problem and got helpful replies. Problem is I am still not able to receive the SMS and process the SMS. the sending portion of the code is perfectly fine and working. I will soon post the problem statement here.

Get Social

Information

Powered by e107 Forum System

Conversation

Thu Jun 11 2020, 06:27 AM
anudee
sir could please send the code for I2C and wifi interfacing with 8051
scena
Tue May 19 2020, 10:29 PM
Does anyone have microcontroller programming software for STC15F104W (core 8051, 4 k, 128 byte, 6 I/O pin, UART ... DIL8), that works?
Sat May 02 2020, 07:38 PM
Tamu Gurung
Hi I am looking for a assembly language program for a digital decimal counter. Time counts max limit of 2 mins starting from 2.00 mins and ending at 0.00. time is to be displayed on 4 7-segment LED displays. Edsim51 simulator to be used. Thanks
Wed Mar 25 2020, 01:39 PM
Tajammul
Sir kindly send the code file i2c for 8051
ExperimenterUK
Fri Mar 13 2020, 10:36 PM
@ Rohitnani,ABEBE..which project ?
Fri Mar 13 2020, 12:55 PM
ABEBE
how can get hadwere of this project
Rohitnani
Sat Mar 07 2020, 05:11 PM
Sir, Could you please send me the zip file input password....
Wed Feb 26 2020, 04:58 PM
Peter Parker
Is it possible to send multiple messages using only 1 GSM module?
Sat Feb 01 2020, 10:12 AM
Pearl Olin
Hello,
Wed Jan 22 2020, 06:16 PM
MINU CHAUDHARY
I m getting errors while simulation process during interfacing socket output and lcd... Can i get the report of ur project which is same as us.

Downloads

Comments

Mirza123
Thu Jun 25 2020, 03:46 PM
eunicelove124
Mon Jun 22 2020, 03:03 PM
cerouno
Tue Jun 16 2020, 05:10 PM
Marce
Sat Jun 13 2020, 09:43 PM
Davidthils
Thu May 21 2020, 12:44 PM
Jakeror
Thu May 21 2020, 01:28 AM
motorCar
Wed May 20 2020, 07:05 PM
Vordrync
Wed May 20 2020, 11:52 AM

Online

Guests: 82, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 38215
Newest member: Mirza123
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Jul 01 2020, 11:07 PM
PS: I am a new learner thats why my question may s...
Mirza123 Avatar
Posted By Mirza123
Wed Jul 01 2020, 02:05 PM
Thanks for the assistance. I have read the data sh...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Jul 01 2020, 10:12 AM
See section 15 (Ports) of the data sheet. ...
wimac Avatar
Posted By wimac
Tue Jun 30 2020, 10:05 AM
How did you know that it is not 8051. Mirza123It i...
Mirza123 Avatar
Posted By Mirza123
Tue Jun 30 2020, 08:39 AM
It seems ports on the AT89LP2052 is not like on th...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Jun 30 2020, 08:34 AM
It seems ports on the AT89LP2052 are not like on t...
Mirza123 Avatar
Posted By Mirza123
Thu Jun 25 2020, 04:07 PM
Hello!i am trying to use AT89LP2052 ( AT89LP2052 h...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Jun 17 2020, 09:42 PM
It is about capacitor? i should put it between Vcc...
cerouno Avatar
Posted By cerouno
Wed Jun 17 2020, 10:37 AM
Take another look at the power supply to the LCD.A...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Jun 17 2020, 02:01 AM
Take another look at the power supply to the LCD.A...