1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
| '****************************************************************
'* Name : gsmSim300.BAS *
'* Author : Jayanth D *
'* Notice : Copyright (c) 2014 Power Tech *
'* : All Rights Reserved *
'* Date : 3/23/2014 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
INCLUDE "modedefs.BAS"
DEFINE OSC 4
DEFINE HSER_TXSTA 24h
DEFINE HSER_RCSTA 90h
DEFINE HSER_BAUD 9615
DEFINE HSER_CLROERR 1
DEFINE HSER_SPBRG 25
mobileNo var byte[$B]
InnerIndex var byte
OuterIndex var byte
NumberStartIndex var byte
TRISC = %10000000
PORTC = $0
EEPROM ["9742453836123456789009876543210011223344"]
'EEPROM ["9742453836",0,"1234567890",0,"09876543210",0,"011223344",0]
start:
mainloop:
SendAT:
HSEROUT ["AT",13,10]
HSERIN 1000,SendAT,[WAIT("OK")]
pause 2000
SendATCMGF:
HSerout ["AT+CMGF=1",13,10]
HSERIN 1000,SendATCMGF,[WAIT("OK")]
pause 2000
NumberStartIndex = 0
for OuterIndex = 0 to 3
for InnerIndex = NumberStartIndex to (NumberStartIndex + 9)
if (NumberStartIndex >= 0) and (NumberStartIndex <= 9) then
Read InnerIndex, mobileNo[InnerIndex]
elseif (NumberStartIndex >= 10) and (NumberStartIndex <= 19) then
Read InnerIndex, mobileNo[InnerIndex - $A]
elseif (NumberStartIndex >= 20) and (NumberStartIndex <= 29) then
Read InnerIndex, mobileNo[InnerIndex - $14]
elseif (NumberStartIndex >= 30) and (NumberStartIndex <= 39) then
Read InnerIndex, mobileNo[InnerIndex - $1E]
endif
pause 50
next InnerIndex
mobileNo[$A] = 0
HSerout ["AT+CMGS=",$22,Str mobileNo,$22,13,10]
HSERIN 10000,SendAT,[WAIT(">")]
HSEROUT["SMS from SIM 300", $1A]
HSERIN 10000,SendAT,[WAIT("OK")]
LCDout "OK"
pause 4000
NumberStartIndex = NumberStartIndex + $A
next OuterIndex
GOTO mainloop
END |