sms to control pic..pls help...


Closed Thread
Results 1 to 40 of 54

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ziki

    now for the PIC ..which should i use ?
    Hserin or Serin or Serin 2

    if u don't mind ...can pls share some code example here ..
    thx alot ....
    I used serin, no reason except I always worked with the f84 and just carried on!

    I can let you have my code, you can do with it what you will, its really poorly written and just banged together.

    Its unfinished, in fact not done anything with it in about 3 weeks so will take me a day to get back in to it!

    Problem was the project was drafted out in my head to use a 2550 for a gsm equipped car alarm, but I only had a f88 to hand, so started on that, idea was I could just recompile the code / cut and paste the routines, then it went off in a different direction as a cut down version of the project using a f88 as a garage/house/boat/shed, so has some features not now needed and ones not yet done.......

    http://homepage.ntlworld.com/tinabriddon/pic/

    Its a real work in progress........

  2. #2
    Ziki's Avatar
    Ziki Guest


    Did you find this post helpful? Yes | No

    Default

    thx for the code....can you have a look at this ...

    DEFINE OSC 8
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_BAUD 9600
    DEFINE HSER_SPBRG 129
    DEFINE HSER_CLROERR 1

    sms:

    HSEROUT ["AT" ,13,10]
    hserin 5000,sms,[WAIT("OK")]


    HSEROUT ["AT+CMGF=1" ,13,10]
    hserin 5000,sms,[WAIT("OK")]


    HSEROUT ["AT+CMGS=",34,"my number ",34,13,10]
    hserin 5000,sms,[WAIT(">")]


    HSEROUT ["BUTTON HAS BEEN",26,13,10]
    pause 5000

    end


    it doesn't work (canot send sms ) ..but if i just use hserout and use pause instead of hserin .it work perfectly ...so...the problem must be at the hserin .
    i try using 4 Mhz and lower baud rate ..also canot work ..
    is there any problem in my code ??? thzzzz

  3. #3
    Ziki's Avatar
    Ziki Guest


    Did you find this post helpful? Yes | No

    Default

    hi ..i also try out with this code ..also canot work....

    include "modedefs.bas"
    DEfine OSC 4

    sms:
    pause 1000

    serout portb.6,t1200,["atz",13] ' wake up thephone
    serin portb.7,t1200,5000,sms,["OK"]

    serout portb.6,t1200,["at+cmgs=19",13]
    serin portb.7,t1200,5000,sms,[">"]


    serout portb.6,t1200,["07910621000010F511000B910621297767F80000AA05E8329 BFD06",26,13]
    pause 9000

    end


    as usual this code work fine with pause instead of serin command ..it suppose to send out a "hello " sms
    what have i done wrong ????pls help ..thx ...

  4. #4
    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....

  5. #5


    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 10:24.

  6. #6
    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 ......

  7. #7


    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.

Similar Threads

  1. SMS via pic
    By kenandere in forum GSM
    Replies: 15
    Last Post: - 10th March 2010, 11:00
  2. HELP ME, SMS controlled relay using PIC
    By pazko1125 in forum mel PIC BASIC
    Replies: 14
    Last Post: - 2nd October 2008, 16:26
  3. Siemens c55 sms control help please
    By camolas in forum mel PIC BASIC Pro
    Replies: 85
    Last Post: - 20th August 2008, 02:13
  4. Motor Control PLC with a PIC
    By sougata in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 2nd November 2006, 08: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, 01: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