amit251291
Member level 1
- Joined
- Jul 18, 2012
- Messages
- 38
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Activity points
- 1,558
i have code in C if want i share it
- - - Updated - - -
go through following links u will get idea
**broken link removed**
**broken link removed**
**broken link removed**
ok
what u want to do either sending or receiving from the GSM
ORG 0000H
MOV TMOD,#20H //TIMER 1, MODE 2
MOV TH1,#-3 //9600 BAUD RATE
MOV SCON,#50H //8 BIT, 1 STOP, EN ENABLED
SETB TR1
MOV DPTR,#MSG1
ACALL H1
ACALL DELAY
MOV DPTR,#MSG2
ACALL H1
ACALL DELAY
MOV DPTR,#MSG3
ACALL H1
ACALL DELAY
MOV DPTR,#MSG4
ACALL H1
ACALL DELAY
MOV DPTR,#MSG5
ACALL H1
ACALL DELAY
H1: CLR A
MOVC A,@A+DPTR
JZ B1
ACALL SEND
INC DPTR
SJMP H1
B1:
RET
SEND: MOV SBUF,A
H2: JNB TI,H2
CLR TI
RET
DELAY: MOV R3,#50H
HERE2: MOV R4,#50H
HERE: DJNZ R4,HERE
DJNZ R3,HERE2
RET
ORG 300H
MSG1: DB "AT",0DH
DB 0H
MSG2: DB "AT+CMGF=1",0DH
DB 0H
MSG3: DB "ATE=0",0DH
DB 0H
MSG4: DB "AT+CMGS=",'"8149111111"',0DH
DB 0H
MSG5: DB "TEXT",0X1A
DB 0H
END
ORG 0000H
MOV TMOD,#20H //TIMER 1, MODE 2
MOV TH1,#-3 //9600 BAUD RATE
MOV SCON,#50H //8 BIT, 1 STOP, EN ENABLED
SETB TR1
MOV DPTR,#MSG1
ACALL H1
ACALL DELAY
MOV DPTR,#MSG2
ACALL H1
ACALL DELAY
MOV DPTR,#MSG3
ACALL H1
ACALL DELAY
MOV DPTR,#MSG4
ACALL H1
ACALL DELAY
MOV DPTR,#MSG5
ACALL H1
ACALL DELAY
STAY: SJAMP STAY
H1: CLR A
MOVC A,@A+DPTR
JZ B1
ACALL SEND
INC DPTR
SJMP H1
B1:
RET
SEND: MOV SBUF,A
H2: JNB TI,H2
CLR TI
RET
DELAY: MOV R3,#50H
HERE2: MOV R4,#50H
HERE: DJNZ R4,HERE
DJNZ R3,HERE2
RET
ORG 300H
MSG1: DB "AT",0DH
DB 0H
MSG2: DB "AT+CMGF=1",0DH
DB 0H
MSG3: DB "ATE=0",0DH
DB 0H
MSG4: DB "AT+CMGS=",'"8149111111"',0DH
DB 0H
MSG5: DB "TEXT",0X1A
DB 0H
END
Hello tsea, Thank you for your co-operation.
here is the edited code:
Code:ORG 0000H MOV TMOD,#20H //TIMER 1, MODE 2 MOV TH1,#-3 //9600 BAUD RATE MOV SCON,#50H //8 BIT, 1 STOP, EN ENABLED SETB TR1 MOV DPTR,#MSG1 ACALL H1 ACALL DELAY MOV DPTR,#MSG2 ACALL H1 ACALL DELAY MOV DPTR,#MSG3 ACALL H1 ACALL DELAY MOV DPTR,#MSG4 ACALL H1 ACALL DELAY MOV DPTR,#MSG5 ACALL H1 ACALL DELAY STAY: SJAMP STAY H1: CLR A MOVC A,@A+DPTR JZ B1 ACALL SEND INC DPTR SJMP H1 B1: RET SEND: MOV SBUF,A H2: JNB TI,H2 CLR TI RET DELAY: MOV R3,#50H HERE2: MOV R4,#50H HERE: DJNZ R4,HERE DJNZ R3,HERE2 RET ORG 300H MSG1: DB "AT",0DH DB 0H MSG2: DB "AT+CMGF=1",0DH DB 0H MSG3: DB "ATE=0",0DH DB 0H MSG4: DB "AT+CMGS=",'"8149111111"',0DH DB 0H MSG5: DB "TEXT",0X1A DB 0H END
now is it correct??
i have some doubts:
1) When we connect a modem to pc via hyperterminal and type commands modem responds with OK like responses.
Now when we are connecting it to controller, should we take into account these responses?
Or the communication will take place even if we don't consider them? In actual practice (in project) i really don't bother about these responses. In many C codes i had seen that they have sent just commands to modem and didn't bother about responses.
2) What you say about delay? Is it okay?
by the way, i don't have proteus, i will download it and will get back to you
so your code is correct I even tested that through my phone's modem, sent message to my own number and it worked correctly.
did u check whether the GSM is working properly or not.......
check it manually using hyper terminal and then go for microcontroller........
post your full code.............
why u want to go for assembly language its very hard to implement some algorithm
ORG 0000H
MOV TMOD,#20H //TIMER 1, MODE 2
MOV TH1,#-3 //9600 BAUD RATE
MOV SCON,#50H //8 BIT, 1 STOP, EN ENABLED
SETB TR1
MOV DPTR,#MSG1
ACALL H1
ACALL DELAY
MOV DPTR,#MSG2
ACALL H1
ACALL DELAY
MOV DPTR,#MSG3
ACALL H1
ACALL DELAY
MOV DPTR,#MSG4
ACALL H1
ACALL DELAY
MOV DPTR,#MSG5
ACALL H1
ACALL DELAY
STAY: SJMP STAY
H1: CLR A
MOVC A,@A+DPTR
JZ B1
ACALL SEND
INC DPTR
SJMP H1
B1:
RET
SEND: MOV SBUF,A
H2: JNB TI,H2
CLR TI
RET
DELAY: MOV R3,#50H
HERE2: MOV R4,#50H
HERE: DJNZ R4,HERE
DJNZ R3,HERE2
RET
ORG 300H
MSG1: DB "AT",0DH
DB 0H
MSG2: DB "AT+CMGF=1",0DH
DB 0H
MSG3: DB "ATE=0",0DH
DB 0H
MSG4: DB "AT+CMGS=",'"8149111111"',0DH
DB 0H
MSG5: DB "TEXT",0X1A
DB 0H
END
hi tsea,
can you please tell me again how did you test that code? i am not getting it... :?:
also here i am attaching my circuit diagram.. do you think is there need to connect extra MZX232 though one MAX232 is also there on modem? :?:
View attachment 85717
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?