sms to control pic..pls help...


Closed Thread
Results 1 to 40 of 54

Hybrid View

  1. #1
    Ziki's Avatar
    Ziki Guest


    Did you find this post helpful? Yes | No

    Default

    hi ..the problem from the previous tread have solved
    now ..i'm having problem storing those valur to my array
    below are my code


    sms:
    include "modedefs.bas"
    DEfine OSC 4
    buffer var byte(90)
    z var byte
    TRISB= %10001011

    serout portb.6,t1200,["atz",13]
    serin portb.7,t1200,5000,sms,["OK"]
    pause 2000

    serout portb.6,t1200,["at+cpms=",34,"me",34,13]
    serin portb.7,t1200,5000,sms,["CPMS"]
    pause 2000

    serout portb.6,t1200,["at+cmgr=1",13]

    for z=1 to 90
    serin portb.7,t1200,5000,sms,buffer(z)
    next

    end

    this code canot work ....is it possible to store everting in a array ?..i don't know how to filter out those unwanted ones....

  2. #2


    Did you find this post helpful? Yes | No

    Default

    One problem with your loop of 1 to 90 is what if you dont have 90 incoming chars ?

    The only real way to read a sms is to read one char and loop until no more arrive, you only need a short timeout, say half second.

    That why I dod not use a for loop


    also

    serout portb.6,t1200,["at+cpms=",34,"me",34,13]
    serin portb.7,t1200,5000,sms,["CPMS"] ************* Why have this line ?
    pause 2000

    The line is not really needed, you dont need the data, while I suppose its more correct to have it, its using code space etc
    Last edited by f_lez; - 11th October 2006 at 09:24.

  3. #3
    Ziki's Avatar
    Ziki Guest


    Did you find this post helpful? Yes | No

    Default

    oo..ya.the cpms is just for testing purpose ..nothing more..
    now just to test the code can skip certain amount of character and store the wanted value into buffer ,i modify the code ,..i want to store "M" into buffer(1),"G" into buffer(2) and R into buffer(3)


    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,t1200,["atz",13]
    pause 2000

    serout portb.6,t1200,["at+cpms=",34,"me",34,13]
    pause 2000

    serout portb.6,t1200,["at+cmgr=1",13]
    x = 2
    while x>0
    x = x-1
    SERIN portb.7,t1200,1000,oops2,z
    oops2:
    wend

    for x=1 to 3
    SERIN portb.7,t1200,1000,oops,buffer(x)
    oops:
    next x
    pause 2000

    if buffer(1) ="M" then
    portb.1=1
    if buffer(2) ="G" then
    portb.2=1
    if buffer(3)="R" then
    portb.4=1

    endif
    endif
    endif

    end


    in hyperterminal .....the phone response with this :
    at+cmgr=1
    +CMGR: 1,,26
    07910621000110F5040B910621297377F40000600111221064 230853BA3C9C3EA3E9

    from the code above ...none of the LED light up is there problem with the code? thx ......

  4. #4


    Did you find this post helpful? Yes | No

    Default

    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.

  5. #5
    Ziki's Avatar
    Ziki Guest


    Did you find this post helpful? Yes | No

    Default

    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 .

  6. #6


    Did you find this post helpful? Yes | No

    Default

    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 09:46.

  7. #7
    peter_o_tool's Avatar
    peter_o_tool Guest


    Did you find this post helpful? Yes | No

    Default test

    test

    p_O_t






    Quote Originally Posted by f_lez
    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.

Similar Threads

  1. SMS via pic
    By kenandere in forum GSM
    Replies: 15
    Last Post: - 10th March 2010, 10:00
  2. HELP ME, SMS controlled relay using PIC
    By pazko1125 in forum mel PIC BASIC
    Replies: 14
    Last Post: - 2nd October 2008, 15:26
  3. Siemens c55 sms control help please
    By camolas in forum mel PIC BASIC Pro
    Replies: 85
    Last Post: - 20th August 2008, 01:13
  4. Motor Control PLC with a PIC
    By sougata in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 2nd November 2006, 07:59
  5. Need help on pic to pic flow control (simple problem I think)
    By khufumen in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th January 2006, 00:34

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts