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

Fri Jul 19 2019, 10:33 AM
charmdatedhd
cooking
ExperimenterUK
Thu Jul 11 2019, 07:55 PM
@ramos https://www.theengineeringprojects.com/2017/09/l298-motor-driver-library-proteus.html
ExperimenterUK
Thu Jul 11 2019, 07:44 PM
@praveen123. Can you give a link to the project ?
Thu Jul 11 2019, 04:47 PM
ramos
buenos dias alguien podria ayudarme necesito saber como descargar la libreria del l298n para proteus
Thu Jul 11 2019, 11:11 AM
praveen123
anyone can help me
Thu Jul 11 2019, 11:11 AM
praveen123
i need source code for 8051 -smart trolley rfid
Thu Jul 11 2019, 11:10 AM
praveen123
hii
ExperimenterUK
Thu Jun 27 2019, 09:14 PM
Hi.. good to see you again
۞ TPS ۞
Thu Jun 27 2019, 07:31 AM
Hello
AdiGhazi
Tue Jun 18 2019, 11:21 AM
Hlo Dear , I've to program AT89C51AC3 RT-LUM using flip but I'm getting time out error for RS232. Will you please suggest me which programmer will be supportable to program this Chip.

Downloads

Comments

rpels7707
Fri Jul 19 2019, 11:31 AM
ameya123
Fri Jul 19 2019, 07:36 AM
anhsieuno
Thu Jul 18 2019, 11:39 AM
zxcvbnm1234
Sat Jul 13 2019, 07:09 AM
surajghayal
Wed Jul 10 2019, 01:17 PM
figureyang
Fri Jul 05 2019, 04:25 AM
mousompal
Sat Jun 29 2019, 05:02 PM
AdiGhazi
Tue Jun 18 2019, 11:15 AM

Online

Guests: 50, Members: 0 ...

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

Members: 38080
Newest member: rpels7707
Forum Activity
ameya123 Avatar
Posted By ameya123
Fri Jul 19 2019, 07:42 AM
Hello,Please share 8051 Assembly language code for...
figureyang Avatar
Posted By figureyang
Fri Jul 05 2019, 04:37 AM
here is the source code prepared for you download ...
figureyang Avatar
Posted By figureyang
Fri Jul 05 2019, 04:30 AM
Cheap_Flash_FS(Normal Version)--Embedded FAT16/32 ...
wimac Avatar
Posted By wimac
Sat Jun 22 2019, 01:26 PM
I’ve use the AT89C51ED2 which has a similar progra...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Jun 20 2019, 10:08 PM
baud rate is 9600 at stop bits of 2. AdiGhaziThe u...
AdiGhazi Avatar
Posted By AdiGhazi
Thu Jun 20 2019, 05:24 AM
Dear,I'm using RS232 serial port cable to use flip...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Jun 18 2019, 10:19 PM
Okay.. I have never programmed the AT89C51AC3 or ...
AdiGhazi Avatar
Posted By AdiGhazi
Tue Jun 18 2019, 11:20 AM
Hlo Dear ,I've to program AT89C51AC3 RT-LUM using ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu May 30 2019, 08:32 PM
It occurs to me that although the P89LPC921 and P8...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed May 29 2019, 09:05 PM
I would suggest a fresh approach.The Keil compile...