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

ExperimenterUK
Sat Oct 12 2019, 10:23 PM
Log in.. then post your code in the 8051 forum
Sat Oct 12 2019, 10:18 AM
Bhadra Sajikumar
i am doing a countdown timer with 8051 for my project, unfortunately our professor had to take a leave of absence before he could teach us most of it.. can someone explain the .asm code of it for me?
Mon Sep 23 2019, 07:37 AM
Nathaniel
I am doing a project for my schools wireless security system with cameras,sensors and spot lights using 8051 micro controller, could you help me out with the design and its source code.
Wed Sep 18 2019, 08:48 PM
Caryn Kover
Thank you for your time,
ExperimenterUK
Mon Aug 05 2019, 07:09 PM
@Ismail ..post in forum, give details
Mon Aug 05 2019, 04:33 PM
Ismail balghmi
Hello. Please I won't download
ExperimenterUK
Wed Jul 24 2019, 12:47 AM
@BUSTER123 Please post in the forum
Tue Jul 23 2019, 06:13 PM
BUSTER123
hello! newbie here. i am kind of a guy who hates using ready - made existing libraries, so this helped a lot as i was trying to control and write to a character lcd display. however, i can't figure out how to set the cursor position. for example, i want to set it to the 5th column in the first row, so position 5. so according to the table, i am sending 10000101 on the 8 data lines of the lcd (register select pulled low). the cursor does not move there however. and i cant move the cursor left or right too. is it something wrong that i am doing? thank you.
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 ?

Downloads

Comments

Casmir
Wed Nov 13 2019, 06:25 AM
DeepakBGattani
Mon Nov 11 2019, 01:31 PM
Jeanbusatta
Sun Nov 10 2019, 04:42 AM
mdayaz
Sat Nov 09 2019, 03:41 PM
baoyen123
Fri Nov 08 2019, 10:06 AM
xiwang
Fri Nov 08 2019, 07:28 AM
ilylily07
Tue Oct 15 2019, 04:32 PM
hientran123
Tue Oct 15 2019, 02:27 AM

Online

Guests: 36, Members: 0 ...

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

Members: 38103
Newest member: Casmir
Forum Activity
Jeanbusatta Avatar
Posted By Jeanbusatta
Sun Nov 10 2019, 04:43 AM
ty, really needed it
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Oct 22 2019, 05:18 AM
wimac Avatar
Posted By wimac
Mon Oct 21 2019, 09:18 AM
I’ve been following this thread and looking at the...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sun Oct 20 2019, 03:09 PM
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sun Oct 20 2019, 03:02 PM
sir, when i on display ,sometime 3rd display is no...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sun Oct 20 2019, 02:53 PM
sir, when i on display ,sometime 3rd display is no...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Oct 20 2019, 12:21 AM
Your code seems okay on my simulationTry my code o...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sat Oct 19 2019, 07:13 PM
please find video attachment. 3rd & 4th displa...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sat Oct 19 2019, 07:05 PM
sir, 3rd and 4th dot matrix display flickering, ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Oct 18 2019, 09:18 PM
Hopefully you understand some of the program.Which...