hi,
I received USB to Seriial and TTL adapter from the link which you sent.I could able to connect to PC and check the AT commands.The GSM is working perfectly.Thank you.
Meanwhile can you compile the below sourced code for Atmega 8 and 16 Mhz crystal.I got the hex file for the below code,but they used 3.68Mhz crystal,where as my dev board has 16Mhz crystal.I tried to complie in Studio 4 and 6 , but i am unable to get the libraries and initial setting in the IDE.(The details of the below code can also be seen in the link
https://www.avrprojects.info/avr-projects/gsm-based-home-security-system/)
Source code
'-----------------------------------------------------------------------------------------
'copyright : (c) 2012, avrprojects.info
'purpose : GSM based Hme security system
'-----------------------------------------------------------------------------------------
$regfile = "m8def.dat"
$crystal = 3686400 'crystal value
$baud = 9600 'baud rate
$hwstack = 64
$swstack = 64
$framesize = 64
Config Portc.3 = Output
Config Portc.2 = Output
Config Portc.1 = Output
Config Portc.0 = Output
Config Portb.1 = Output
Config Portb.0 = Output
Config Pind.3 = Input
Config Pind.7 = Input
Config Pinb.3 = Input
Config Pinb.4 = Input
Declare Sub Getline 'get data from gsm modem
Declare Sub Send_sms 'send sms
Declare Sub Sms_check ' reading sms
Declare Sub Read1820 'reading temperature sensor
Config 1wire = Portb.2
Led1 Alias Portc.0 'led indicators
Led2 Alias Portc.1
Led3 Alias Portc.2
Led4 Alias Portc.3
Rled Alias Portb.1
Gled Alias Portb.0
Pir Alias Pind.7
Mag1 Alias Pinb.3 'magnetic sensor 1
Mag2 Alias Pinb.4 'magnetic sensor 2
Jumper Alias Pind.3
'####################################
Dim Number As Eram String * 13 At 10
'Temp variables
Dim Bd1 As Byte
Dim Bd2 As Byte
Dim Bd7 As Byte
Dim Bd8 As Byte
Dim I As Byte , Tmp As Byte
Dim T As Integer , T1 As Integer
Dim Bd(9) As Byte
'------------ Variables and constants for GSM --------------------------------- ------
Dim Num As String * 80
Dim Msg As String * 100
Dim Inmsg As String * 100
Dim Gstmp As Byte
Dim Ar(10) As String * 20
Dim Sender As String * 25
Dim Engine As Byte
Dim Alarms As Byte
Dim Icnt As Byte
Dim A_armed As Byte
Dim Gps As Byte
Dim Stmp As Byte
Dim Pass_stored As String * 13
Dim Tem1 As Bit
Dim Tem2 As Bit
Dim Tem3 As Bit
Dim Tem4 As Bit
Pass_stored = Number
'Print Pass_stored
Set Pir
Set Led1
Set Led2
Set Led3
Set Led4
Reset Tem1
Reset Tem2
Reset Tem3
Reset Tem4
Wait 1
Reset Led1
Reset Led2
Reset Led3
Reset Led4
Rled = 1
Gled = 0
Stmp = 100
A_armed = 0
Wait 25 ' give some time for gsm modem
' give some time for gsm modem
Print "AT"
Wait 2
Print "AT+CMGD=1"
Wait 2
Print "AT+CREG?"
Wait 2
Print "ATE0"
Wait 2
Print "AT+CNMI=1,1,0,0,0" 'new message indication off
Wait 2 'Third command TEXT MODE
Print "AT+CMGF=1"
Wait 2
'Print #2 , "AT+CSQ" 'signal strength
'Wait 2
Rled = 0
Gled = 1
1wwrite &HCC : 1wwrite &H44 ' start measure
Waitms 400 ' wait for end of conversion
Read1820
If Jumper = 0 Then
Do
Rled = 0
Gled = 1
Print "AT"
Wait 2
Print "AT+CMGF=1" 'change to text mode
Wait 2
Print "AT+CMGR=1" ' get the message
Getline
If Inmsg <> "OK" Then
Rled = 1
Gled = 0
Num = Inmsg
Getline
Gps = Split(num , Ar(1) , ",")
Num = Ar(2)
Gps = Len(num)
Gps = Gps - 2
Num = Mid(num , 2 , Gps)
Inmsg = Lcase(inmsg)
If Inmsg = "microcontroller" Then 'other numbers
Pass_stored = Num
Number = Pass_stored
Msg = "Number Stored"
Send_sms
Exit Do
End If
Wait 2
Print "AT+CMGD=1"
Wait 3
Rled = 0
Gled = 1
End If
Wait 5
Rled = 1
Gled = 0
Wait 2
Loop
End If
Do
1wwrite &HCC : 1wwrite &H44 ' start measure
Waitms 400 ' wait for end of conversion
Read1820
Gled = 0
Waitms 500
Gled = 1
Gled = 0
Waitms 500
Gled = 1
If Pir = 0 Then
Set Led1
If Tem1 = 0 Then
Num = Pass_stored
Msg = "Motion Detected"
Send_sms
Set Tem1
End If
Else
Reset Led1
Reset Tem1
End If
If Mag1 = 1 Then
Set Led2
If Tem2 = 0 Then
Num = Pass_stored
Msg = "Sensor 1 Failed"
Send_sms
Set Tem2
End If
Else
Reset Led2
Reset Tem2
End If
If Mag2 = 1 Then
Set Led3
If Tem3 = 0 Then
Num = Pass_stored
Msg = "Sensor 2 Failed"
Send_sms
Set Tem3
End If
Else
Reset Led3
Reset Tem3
End If
If T1 > 45 Then
Set Led4
If Tem4 = 0 Then
Num = Pass_stored
Msg = "Temperature High: " + Str(t1) + " deg"
Send_sms
Set Tem4
End If
Else
Reset Led4
Reset Tem4
End If
' Print T1
Loop
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
' SEND SMS
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sub Send_sms
Rled = 1
Wait 3
Print "AT+CMGS=" ; Chr(34) ; Num ; Chr(34) 'send sms
Waitms 200
Print Msg ; Chr(26)
Wait 5
Print "AT"
Wait 2
Rled = 0
End Sub
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
' Read gsm modem
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sub Getline
Inmsg = ""
Do
Gps = Inkey()
If Gps > 0 Then
Select Case Gps
Case 13 : If Inmsg <> "" Then Exit Do ' if we have received something
Case 10 : If Inmsg <> "" Then Exit Do ' if we have received something
Case Else
Inmsg = Inmsg + Chr(gps) ' build string
End Select
End If
Loop
End Sub
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
' Read ds1820
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sub Read1820 ' reads sensor ans calculate ' T for 0.1 C
1wreset ' reset the bus
1wwrite &HCC ' read internal RAM
1wwrite &HBE ' read 9 data bytest
Bd(1) = 1wread(9)
Bd1 = Bd(1)
Bd2 = Bd(2)
Bd7 = Bd(7)
Bd8 = Bd(8)
' read bytes in array
1wreset ' reset the bus
Tmp = Bd1 And 1
If Tmp = 1 Then Decr Bd1 ' 0.1C precision
T = Bd1
T = T * 50
T = T - 25
T1 = Bd8 - Bd7
T1 = T1 * 100
T1 = T1 / Bd8
T = T + T1
T1 = T / 100 'store tens
T = T Mod 100 'store decimal number
' Cls
' Locate 1 , 3
' Lcd "Temperature"
' Locate 2 , 7
' Lcd T1 ; "." ; T
End Sub
End