It looks like it should work, but what speed are running comms at, doh! just realised its 1200, doh!
just try it again 300, see it the program is just not fast enough to catch it.
It looks like it should work, but what speed are running comms at, doh! just realised its 1200, doh!
just try it again 300, see it the program is just not fast enough to catch it.
hi..i have change to T300 and also omit the "skipping" character part so that i can focus on just storing data in array.
include "modedefs.bas"
DEfine OSC 4
buffer var byte[90]
z var byte
x var byte
TRISB= %10001000
portb.4=0
portb.2=0
portb.1=0
serout portb.6,t300,["atz",13]
pause 2000
serout portb.6,t300,["at+cpms=",34,"me",34,13]
pause 2000
serout portb.6,t300,["at+cmgr=1",13]
for x=1 to 3
SERIN portb.7,t300,1000,oops,buffer(x)
oops:
next x
pause 2000
if buffer(1) ="+" then
portb.1=1
if buffer(2) ="C" then
portb.2=1
if buffer(3)="M" then
portb.4=1
endif
endif
endif
end
now ...only portb.1 LED light up ......running out of idea .
emm, I cant do anything at the moment I'm changing my PC/desk everything, but try it this way.......
x=1
while x<4
serin buffer(x)
x=x+1
wend
or use if....then... etc, I remember when I used a for loop I had a problem that went a way for no reason, I think its when I stopped using the ...for...next...
Or I could be wrong.........
<edit>
Yes I am wrong because I have it working with a foor loop IE
for x=1 to 12
SERIN portb.7,t1200,500,oops,incphn(x)
oops:
next x
<edit2>
Can you use a max232 circuit or an old phone data cable to monitor on the PC with hyperterminal what is goin on?
If you put it on the phone output, you get to see (because the phone echos) what your pic is sending, and what the phone replys with.
Last edited by f_lez; - 13th October 2006 at 10:46.
It's not tested but try this one:
include "modedefs.bas"
DEfine OSC 4
buffer var byte[20]
z var byte
x var byte
TRISB= %10001000
portb.4=0
portb.2=0
portb.1=0
serout portb.6,t300,["atz",13]
pause 2000
serout portb.6,t300,["at+cpms=",34,"me",34,13]
pause 2000
serout portb.6,t300,["at+cmgr=1",13]
; wait + sign for 1 second and then store next 2 signs in buffer[0] and buffer[1]
SERIN portb.7,t300,1000,oops,["+"],buffer[0],buffer[1]
portb.1=1 ; port be is high beqause + sign already detected
if buffer(0) ="C" then
portb.2=1
endif
if buffer(1)="M" then
portb.4=1
endif
goto dasasruli
oops: ;no answer from the phone
; do something if there is no answer
dasasruli:
end
I'm new to serial communication, can anyone tell me what does the 34,34,13 do in the below syntax???
serout portb.6,t300,["at+cpms=",34,"me",34,13]
and whats the difference between above and
serout portb.6,t300,["at+cmgr=1",13]
also please tell me does oops block get executed if + is not received ???
SERIN portb.7,t300,1000,oops,["+"],buffer[0],buffer[1]
Best Regards
Jamshid Dastur
Bookmarks