jff_frncsc
Newbie level 3
- Joined
- Feb 5, 2010
- Messages
- 4
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- manila, philippines
- Activity points
- 1,337
Pls. check our code in simple texting using benq m23 gsm modem interface to pic16f877A...We use Mikrobasic in programming...We try to simulate our code and its working properly...We also try it to test in our circuit...We put an indicator each time the modem respond to the PIC... The first command until last shown in the indicator is correct but the problem is our mobile phone doesn't receive anything...can someone help us resolve the problem in our codes??
This is our code for simple texting:
program sending
dim out0 as sbit at RB0_bit
dim out1 as sbit at RB1_bit
dim out2 as sbit at RB2_bit
dim out3 as sbit at RB3_bit
dim out4 as sbit at RB4_bit
dim out5 as sbit at RB5_bit
dim out6 as sbit at RB6_bit
dim out7 as sbit at RB7_bit
dim receive as string[10]
dim var as integer
dim power_on as sbit at RC3_bit
TRISB=0
TRISC=0
initialization:
PORTB=0
PORTC=0
power_on = 1
Delay_ms(3000)
power_on = 0
Delay_ms(3000)
ADCON1=ADCON1 or $0F
CMCON=CMCON or 7
UART1_Init(1200)
Delay_ms(3000)
AT1:
UART1_Write_Text("AT") 'set sms into text mode
Delay_ms(3000)
UART1_Write(13) 'ENTER
Delay_ms(3000)
out0=1
while var=0
UART1_Read_Text(receive, "OK", 2) ' reads text until 'OK' is found
if (receive[1]="R") OR (receive[1]="X") then
UART1_Read_Text(receive, "ROR", 4)
goto AT1
else
var=1
end if
wend
out1=1
var=0
CMGF:
UART1_Write_Text("AT+CMGF=1") 'set sms into text mode
Delay_ms(3000)
UART1_Write(13) 'ENTER
Delay_ms(3000)
out2=1
while var=0
UART1_Read_Text(receive, "OK", 2) ' reads text until 'OK' is found
if (receive[1]="R") OR (receive[1]="X") then
UART1_Read_Text(receive, "ROR", 4)
goto CMGF
else
var=1
end if
wend
out3=1
var=0
CSCA:
UART1_Write_Text("AT+CSCA=") 'command for entering sms center's number
UART1_Write(34) 'quotation mark(")
UART1_Write_Text("+639180000101") 'sms center's number
UART1_Write(34) 'quotation mark(")
Delay_ms(3000)
UART1_Write(13) 'ENTER
Delay_ms(3000)
out4=1
while var=0
UART1_Read_Text(receive, "OK", 2) ' reads text until 'OK' is found
if (receive[1]="R") OR (receive[1]="X") then
UART1_Read_Text(receive, "ROR", 4)
goto CSCA
else
var=1
end if
wend
out5=1
var=0
send:
UART1_Write_Text("AT+CMGS=") 'command for entering sms center's number
Delay_ms(3000)
out6=1
UART1_Write(34) 'quotation mark(")
Delay_ms(3000)
out7=1
UART1_Write_Text("+639194136071") 'sms center's number
Delay_ms(3000)
out0=0
UART1_Write(34) 'quotation mark(")
Delay_ms(3000)
out1=0
UART1_Write(13) 'ENTER
Delay_ms(3000)
out2=0
while var=0
UART1_Read_Text(receive, ">", 2) ' reads text until '>' is found
if (receive[1]="R") OR (receive[1]="X") then
UART1_Read_Text(receive, "ROR", 4)
goto send
else
var=1
end if
wend
out3=0
var=0
UART1_Write_Text(" Hello") 'text message
Delay_ms(3000)
UART1_Write(26) 'ctrl+z
Delay_ms(3000)
out4=0
end.
Thanx a lot!!! We appreciate your concerns!
This is our code for simple texting:
program sending
dim out0 as sbit at RB0_bit
dim out1 as sbit at RB1_bit
dim out2 as sbit at RB2_bit
dim out3 as sbit at RB3_bit
dim out4 as sbit at RB4_bit
dim out5 as sbit at RB5_bit
dim out6 as sbit at RB6_bit
dim out7 as sbit at RB7_bit
dim receive as string[10]
dim var as integer
dim power_on as sbit at RC3_bit
TRISB=0
TRISC=0
initialization:
PORTB=0
PORTC=0
power_on = 1
Delay_ms(3000)
power_on = 0
Delay_ms(3000)
ADCON1=ADCON1 or $0F
CMCON=CMCON or 7
UART1_Init(1200)
Delay_ms(3000)
AT1:
UART1_Write_Text("AT") 'set sms into text mode
Delay_ms(3000)
UART1_Write(13) 'ENTER
Delay_ms(3000)
out0=1
while var=0
UART1_Read_Text(receive, "OK", 2) ' reads text until 'OK' is found
if (receive[1]="R") OR (receive[1]="X") then
UART1_Read_Text(receive, "ROR", 4)
goto AT1
else
var=1
end if
wend
out1=1
var=0
CMGF:
UART1_Write_Text("AT+CMGF=1") 'set sms into text mode
Delay_ms(3000)
UART1_Write(13) 'ENTER
Delay_ms(3000)
out2=1
while var=0
UART1_Read_Text(receive, "OK", 2) ' reads text until 'OK' is found
if (receive[1]="R") OR (receive[1]="X") then
UART1_Read_Text(receive, "ROR", 4)
goto CMGF
else
var=1
end if
wend
out3=1
var=0
CSCA:
UART1_Write_Text("AT+CSCA=") 'command for entering sms center's number
UART1_Write(34) 'quotation mark(")
UART1_Write_Text("+639180000101") 'sms center's number
UART1_Write(34) 'quotation mark(")
Delay_ms(3000)
UART1_Write(13) 'ENTER
Delay_ms(3000)
out4=1
while var=0
UART1_Read_Text(receive, "OK", 2) ' reads text until 'OK' is found
if (receive[1]="R") OR (receive[1]="X") then
UART1_Read_Text(receive, "ROR", 4)
goto CSCA
else
var=1
end if
wend
out5=1
var=0
send:
UART1_Write_Text("AT+CMGS=") 'command for entering sms center's number
Delay_ms(3000)
out6=1
UART1_Write(34) 'quotation mark(")
Delay_ms(3000)
out7=1
UART1_Write_Text("+639194136071") 'sms center's number
Delay_ms(3000)
out0=0
UART1_Write(34) 'quotation mark(")
Delay_ms(3000)
out1=0
UART1_Write(13) 'ENTER
Delay_ms(3000)
out2=0
while var=0
UART1_Read_Text(receive, ">", 2) ' reads text until '>' is found
if (receive[1]="R") OR (receive[1]="X") then
UART1_Read_Text(receive, "ROR", 4)
goto send
else
var=1
end if
wend
out3=0
var=0
UART1_Write_Text(" Hello") 'text message
Delay_ms(3000)
UART1_Write(26) 'ctrl+z
Delay_ms(3000)
out4=0
end.
Thanx a lot!!! We appreciate your concerns!