Thanks to your kind suggestions all, especially aratti;
In fact, Ajay Bhargav from 8051projects.net forum, I really appreciate his latest comment .
The solution is; making some additional connections at GSM serial port, as below;

Before I only connected, RX,TX and GRND pins of the GSM serial port.
And below you can see the general connection latest I made:

And a program to send sms and or call a phone number is as follows:
Code:
'Definitions
DEFINE OSC 4 'for 4 Mhz
'DEFINE OSC 8 'for 8 Mhz
DEFINE HSER_TXSTA 20h 'I wonder shall I define as DEFINE HSER_TXSTA 24h???
DEFINE HSER_RCSTA 90h 'same for all
DEFINE HSER_BAUD 2400 'for 2400 Baud rate
'DEFINE HSER_BAUD 4800 'for 4800 Baud rate
'DEFINE HSER_BAUD 9600 'for 9600 Baud rate
DEFINE HSER_SPBRG 25 'for 4Mhz/2400 & 8Mhz/4800 with an error %0.16
'DEFINE HSER_SPBRG 12 'for 4Mhz/4800 & 8Mhz/9600 with an error %0.16
DEFINE HSER_CLROERR 1 'same for all
' Initialization & Declaration
i var byte
TRISB=%00000000
PORTB=%00000000
TRISD=%00001111
PORTD=%00000000
' CHECK
FIRSTCHECK:
HIGH PORTB.7
PAUSE 500
HIGH PORTB.6
PAUSE 500
HIGH PORTB.5
PAUSE 500
HIGH PORTB.4
PAUSE 500
PORTB=%00000000
GSM_CHECK:
HSEROUT ["AT",13] 'Send AT to modem followed by a CR
HSERIN 5000, GSM_CHECK, [WAIT("OK")] 'Check OK reply, wait 5sec max.
HIGH PORTB.7
PAUSE 1000
HSEROUT ["AT+GMM",13] 'Ask model name
HSERIN 5000, GSM_CHECK, [WAIT("T610 series")] 'Check model name
HIGH PORTB.6
PAUSE 1000
HSEROUT ["AT+IPR=2400",13] 'Set transfer speed
HSERIN 5000, GSM_CHECK, [WAIT("OK")]'Check OK reply, wait 5sec max.
HIGH PORTB.5
PAUSE 1000
HSEROUT ["AT+CMGF=1",13] 'send AT to modem followed by a CR and line feed
HSERIN 5000, GSM_CHECK, [WAIT("OK")]'Check OK reply, wait 5sec max.
HIGH PORTB.4
PAUSE 1000
PORTB=%00000000
BEGIN:
IF PORTB.5=1 THEN ERROR_CALL
IF PORTB.6=1 THEN ERROR_SMS
HIGH PORTB.7
pause 1000
LOW PORTB.7
if PORTD.2 = 0 then SEND_SMS
IF PORTD.3 = 0 THEN CALL_PHONE
PAUSE 1000
GOTO BEGIN
SEND_SMS:
HIGH PORTB.6
HSEROUT ["at+cmgs=",34,"XXXXX",34,13]
PAUSE 1000
HSEROUT ["this is a test message",26]
HSERIN 10000, BEGIN, [WAIT("OK")]'Check OK reply, wait 5sec max.
LOW PORTB.6
GOTO BEGIN
CALL_PHONE:
HIGH PORTB.5
HSEROUT ["atd[XXXXX];",13]
HSERIN 5000, BEGIN, [WAIT("OK")]'Check OK reply, wait 5sec max.
PAUSE 2000
LOW PORTB.5
GOTO BEGIN
ERROR_CALL:
FOR i = 1 to 5
HIGH PORTB.4
PAUSE 500
LOW PORTB.4
PAUSE 500
next i
PORTB=%00000000
GOTO BEGIN
ERROR_SMS:
FOR i = 1 to 5
HIGH PORTB.4
PAUSE 500
LOW PORTB.4
PAUSE 500
next i
PORTB=%00000000
GOTO BEGIN
' END
End
Thanks again for your attention and time, I will continue with :
- Improving the program to a real case scenario,
- Think more about the real case scenario, because at first stage I would like to use this as an alarm system for my garden house. I will need some sensors for unexpected visitors or animals.
Do you have any idea, what kind of sensors I can use to detect unexpected visitors?
Regards,
Bookmarks