enfora gsm to pic 16f877


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Feb 2010
    Posts
    17

    Default on step forward

    so far i was able to send A TEST sms via the pic from the gsm modem no max232 4mhz 16F877 below is the code:

    MAIN:
    Serout2 PORTC.6,16468, ["AT",13,10]

    SERIN2 PORTC.7,16468,[WAIT ("OK")]


    LCDOUT $FE,$C0
    LCDOUT "SENDING MESSAGE..."
    SEROUT2 PORTC.6,16468,["AT+CMGS=",34,"18155295213",34,13,10]
    PAUSE 1000
    SEROUT2 PORTC.6,16468,["TEST FROM PIC",13,10]
    PAUSE 1000
    SEROUT2 PORTC.6,16468,[26]
    LCDOUT $FE,$C0
    LCDOUT "MESSAGE SENT "
    PAUSE 1000
    END

    Now corredct me if i'm wrong the pic will not pass the second line of the code(SERIN2 PORTC.7,16468,[WAIT ("OK")]) unless it received OK is that coreect? That means that the pic is receiving the correct chars from the gsm correct?
    will try to send and read to an array.
    Thanks for any response or help....

    Best regards,
    Joe

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default

    Now corredct me if i'm wrong the pic will not pass the second line of the code(SERIN2 PORTC.7,16468,[WAIT ("OK")]) unless it received OK is that coreect?
    That is correct.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Feb 2010
    Posts
    17

    Post still mtestin

    Thanks a lot for the response.
    Here is the latest i was able to receive a text messege,TIME, caller id(C_ID) and dispaly the exact length of the message.
    I don't know why but it seems that the modem is responding with the commands i send first then the answer for ex :
    SEROUT2 PORTC.6,16468,["AT+CMGR=1",13,10]
    the modem will respond AT+CMGR=1 THEN the rest (+CMGR: "REC........"), I found that by making LCDATA var byte(80) and display all 80 chars received(max chars in my 20x4 lcd), But the modem will not do that with hyperterminal if you enter AT+CMGR=1 in hyperterminal the response will be ERROR if no messages or +CMGR:....., So i decided to just look for READ after AT+CMGR=1 and... and it worked.rs232 at the modem side is 4=6 and 7=8 before i tried 1=4=6 but the modem didn't respond at all.
    ************************************************** **************
    MAIN:



    serout2 PORTC.6,16468, ["AT",13,10]

    SERIN2 PORTC.7,16468,[WAIT ("OK")]




    SEROUT2 PORTC.6,16468,["AT+CMGR=1",13,10]'read messaage at SIM #1
    SERIN2 PORTC.7,16468,[wait ("READ"),SKIP 4,STR C_ID\11,SKIP 4,STR TIME\17,SKIP 6, STR LCDATA\20\10]

    LCDOUT $FE,1
    LCDOUT $FE,2
    LCDOUT STR TIME\17 'display date and time
    FOR J=1 TO 20
    IF LCDATA(J)=13 THEN' wait for 13 char then put in LA where la is length of the message
    LA=J
    GOTO GOTLA
    ENDIF
    NEXT J
    GOTLA:
    LCDOUT $FE,$C0
    LCDOUT "SMS LA=", DEC LA ' display the length of the message
    LCDOUT $FE,$D4
    LCDOUT STR LCDATA\LA'display the message
    END
    ************************************************** ****************
    since i got the WAIT command to work and i used it to read the messages, I don't care if it is read or unread for now i only sent one message and i try to read it. Still having problem with the connection between the pic and the modem with the above setup will work but when i turn the power off it may work or not then i try again and it will work, I don't know if it's a speed problem as you mention before or just a loose connection(breadboard)...

    Once again thank for any help


    Best regards,
    Joe

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