TC35i GSM With PIC 16F690 help


Closed Thread
Results 1 to 34 of 34
  1. #1

    Exclamation TC35i GSM With PIC 16F690 help

    Hi
    Can someone help me please providing a schematic to link up my PIC with TC35i GSM modem.

    I have seen an schematic provided by Aratti, linking TC35i with 16F873.

    What I would like to ask is why MAX232 is used? What does this IC actually do and why not to connect the PIC directly to the TC35i?

    Damien

  2. #2
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default

    max 232 is logic level converter. It converts RS232 logic level to ttl logic level and ttl to RS232. You should look datasheet.

  3. #3


    Did you find this post helpful? Yes | No

    Question

    Thanks for the info but since I am fairly new to this field, can you guide me as to where I can read about TTL & RS-232 type signals and difference between them.

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


    Did you find this post helpful? Yes | No

    Default

    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default

    On google or wiki
    RS232 standard:
    logic "1" is -3 to -15V
    logic "0" is 3 to 15v
    -3 to 3 is not defined
    TTL standard:
    logic "1" is 2 to Vcc (usually Vcc=5V)
    logic "0" is 0 to 0.8V
    Edit:
    0.8 to 2V isn't defied
    Last edited by pedja089; - 28th September 2009 at 23:35.

  6. #6


    Did you find this post helpful? Yes | No

    Red face

    Quote Originally Posted by pedja089 View Post
    On google or wiki
    RS232 standard:
    logic "1" is -3 to -15V
    logic "0" is 3 to 15v
    -3 to 3 is not defined
    TTL standard:
    logic "1" is 2 to Vcc (usually Vcc=5V)
    logic "0" is 0 to 0.8V
    Edit:
    0.8 to 2V isn't defied
    Thanks. I am trying to send an SMS using TC35i & 16F690. I tried to replicate the schematic at this link: http://techni.caliti.es/blog/2008/12...ontroller.html
    I used the pins 10 & 12 of 16f690 instead of 17 & 18 of 16F873. Hope it will work

  7. #7
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    I used the pins 10 & 12 of 16f690 instead of 17 & 18 of 16F873. Hope it will work
    If you have in mind to use the downloaded software, the answer is IT WILL NOT WORK.

    If you will write your own software the answer is YES IT WILL WORK.

    Al.
    All progress began with an idea

  8. #8


    Did you find this post helpful? Yes | No

    Red face

    Quote Originally Posted by aratti View Post
    If you have in mind to use the downloaded software, the answer is IT WILL NOT WORK.

    If you will write your own software the answer is YES IT WILL WORK.

    Al.
    Hi Aratti, your project has inspired me to do one by myself. I wont be connecting to the computer (as it does not have an serial port) neither I can get 16F873 that easily. So I am using 16F690.

    Any advise as to how to set up the registers, correctly for 690?

  9. #9
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Any advise as to how to set up the registers, correctly for 690?
    With pic 16F690 you need to turn off analog port to make them digital. You will accomplish this with the following instruction:

    Code:
    ANSEL = 0 : ANSELH = 0
    In my project I have used 8 ports as inputs and 8 ports as output. 690 doesn't have all these ports available, so you will decide how many inputs and how many outputs to use. Remember to set the TrisA; TrisB and TrisC registers accordingly.


    Al.
    All progress began with an idea

  10. #10


    Did you find this post helpful? Yes | No

    Exclamation

    Here is my code:

    OSCTUNE=%01111 ' Oscillator 8MHz
    intcon=0 ' Interrupts disabled
    cm1con0=0 ' Comparator 1 disabled
    cm2con0=0 ' Comparator 2 disabled
    ansel=0 ' Pins to be Digital
    anselh=0 ' Pins to be Digital
    baud con 16468 ' baud rate = 9600 Inverted
    trisc=%00000000 ' Port C I/O
    trisb=%01111111 ' Port B I/O
    trisa=%000000 ' Port A I/O
    portc=0 ' Setting port c Low
    portb=0 ' Setting port b Low
    porta=0 ' Setting port a Low
    i var byte ' Declaring variable
    c var byte ' Declaring variable
    tx var Portb.7 ' Declaring tx pin
    rx var Portb.5 ' Declaring rx pin

    Include "modedefs.bas"

    main:
    Serout2 tx,baud,["AT+CMGF=1",13]
    gosub one
    Serin2 rx,baud,5000,main,[wait("OK"),i]
    gosub two
    goto main

    one:
    for c=1 to 5
    portc=255
    pause 20
    portc=0
    pause 20
    next c
    return
    two:
    for c=1 to 5
    portc=255
    pause 400
    portc=0
    pause 400
    next c
    return

    My Problems:

    1) My led connected to portc only goes high ONCE in label one though it should enter label one every 5000mS.

    2) It never enters label two as I assume there is somthign wrong in the communication part of PIC with the modem.

    Please help me find out what am I doing wrong here?

  11. #11
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    It never enters label two as I assume there is somthign wrong in the communication part of PIC with the modem


    Code:
    main:
    Serout2 tx,baud,["AT+CMGF=1",13]
    gosub one
    Serin2 rx,baud,5000,main,[wait("OK"),i]
    gosub two
    goto main

    Remove the GOSUB One instruction! When you send an AT command to the modem, then you MUST immediatly switch to the SERIN2 instruction otherwise there is a high chance that the modem answer will be lost.

    Edited:
    baud con 16468 ' baud rate = 9600 Inverted
    Looking to the PBP manual the correct setting for 9600 bauds is 84 not 16468

    Did you use the MAX232 for connecting Pic to modem?

    Al.
    Last edited by aratti; - 29th September 2009 at 18:26.
    All progress began with an idea

  12. #12


    Did you find this post helpful? Yes | No

    Red face

    Done it to 84, so now it is transmitting in True mode. NOW the code is entering gosub one as expected BUT not gosub two.
    Changed the code to the following:
    main:
    gosub one
    Serout2 tx,baud,["AT+CMGF=1",13]
    Serin2 rx,baud,5000,main,[wait("OK"),i]
    gosub two
    goto main

    As always code never enters label two which means it is not getting the required response. I attach my setup photo, though not very clear but the schematic is the same except the pin change to 10 & 12 instead of your 17 & 18.
    Attached Images Attached Images  
    Last edited by financecatalyst; - 29th September 2009 at 19:15. Reason: Adding more info

  13. #13
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default

    tc35i factory settings for bounrate is 2400 not 9600!
    Becouse you use max its not inverted signal.
    on 2400 and true settings should be 396 if you use 4mhz crystal.
    here example of code how to star communication with modem if max232 is used:
    Code:
     Init:
    serout tx,0,["AT",13]
    serin2 rx,396,1000,init,[WAIT("OK")]

  14. #14
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Code:
    baud con 84 ' baud rate = 9600 Inverted
    Rx var Portb.7 ' Declaring rx pin
    Tx var Portb.5 ' Declaring tx pin
    
    Change your code as per the above, then it should work.

    Edited:
    Remember to allow the modem to settle after powerup, before start serial communication (See modem led blink)
    Al.
    Last edited by aratti; - 29th September 2009 at 19:49.
    All progress began with an idea

  15. #15


    Did you find this post helpful? Yes | No

    Exclamation

    Quote Originally Posted by pedja089 View Post
    tc35i factory settings for bounrate is 2400 not 9600!
    Becouse you use max its not inverted signal.
    on 2400 and true settings should be 396 if you use 4mhz crystal.
    here example of code how to star communication with modem if max232 is used:
    Code:
     Init:
    serout tx,0,["AT",13]
    serin2 rx,396,1000,init,[WAIT("OK")]
    Tried you way as well. I am using internal oscillator and I put it to 4MHz this time. After that I tried your instructions above but results are the same. Two questions I want to ask you
    First: Why have you used "0" in the instruction serout tx,0,...
    Second: why have you not used serout2 and used just serout & serin2 instead of serin?

  16. #16


    Did you find this post helpful? Yes | No

    Exclamation

    Quote Originally Posted by aratti View Post
    Code:
    baud con 84 ' baud rate = 9600 Inverted
    Rx var Portb.7 ' Declaring rx pin
    Tx var Portb.5 ' Declaring tx pin
    
    Change your code as per the above, then it should work.

    Al.
    No Luck still. In the datasheet, portb.5 is Rx & portb.7 is Tx! Why you advised to mark it the other way. Though it's still not working.
    Also 9600 Inverted is NOT 84 (just looked into the PBP manual) it is 16468
    Program is the same as above (With your modifications) i.e. Baud 84 & ports interchanged.

  17. #17
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    tc35i factory settings for bounrate is 2400 not 9600!
    TC35i is autobauding from 4.8Kbps to 115Kbps. 2400 bauds setting will not activate the auto-function.

    Al.
    All progress began with an idea

  18. #18
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    I think you need to check your modem with hyperterminal to check if it works correctly. If your computer doesn't have a serial port, you can obtain a serial to USB converter (check if compatible with your operating system)

    Al.
    All progress began with an idea

  19. #19


    Did you find this post helpful? Yes | No

    Red face

    Quote Originally Posted by aratti View Post
    I think you need to check your modem with hyperterminal to check if it works correctly. If your computer doesn't have a serial port, you can obtain a serial to USB converter (check if compatible with your operating system)

    Al.
    I will try that hopefully tomm, and will post my findings. Thank you all for your help upto now.

  20. #20


    Did you find this post helpful? Yes | No

    Red face

    By the way, can someone tell me the expected voltages across 232 pins and modem Rx & Tx pin. I just have a funny feeling that problem is with the hardware part instead of software.

  21. #21
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default

    Voltages shoul be about +/-10V.
    Quote Originally Posted by financecatalyst
    First: Why have you used "0" in the instruction serout tx,0,...
    Second: why have you not used serout2 and used just serout & serin2 instead of serin?
    There no reason why i used serout.
    0 is used to set bondrate to 2400T.
    Set cursor to serout and pres F1, and everything is in help.
    Program is working. I used to check conection with modem for my call & sms controller.
    Code with status led:
    Code:
    Init:
       toggle led1
       serout tx,0,["AT",13]
       serin2 rx,396,1000,init,[WAIT("OK")] 
      serout TX,0,["at&f",13]
       pause 500
       toggle led1
      serout TX,0,["at+cmgf=1",13]
       pause 500
       toggle led1
      serout TX,0,["at+clip=1",13]
       pause 500
      led1=1
    Start:....
    Led will flash every second if modem is'n connected.
    While setting up modem led will flash every 0.5s.
    When device is ready led stay on.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by financecatalyst View Post
    I am using internal oscillator and I put it to 4MHz this time.
    The internal OSC most often is NOT accurate enough for communications. Try an external.

    Look at post #5 for the expected voltage levels.
    Dave
    Always wear safety glasses while programming.

  23. #23


    Did you find this post helpful? Yes | No

    Exclamation

    Quote Originally Posted by pedja089 View Post
    Voltages shoul be about +/-10V.

    There no reason why i used serout.
    0 is used to set bondrate to 2400T.
    Set cursor to serout and pres F1, and everything is in help.
    Program is working. I used to check conection with modem for my call & sms controller.
    Code with status led:
    Code:
    Init:
       toggle led1
       serout tx,0,["AT",13]
       serin2 rx,396,1000,init,[WAIT("OK")] 
      serout TX,0,["at&f",13]
       pause 500
       toggle led1
      serout TX,0,["at+cmgf=1",13]
       pause 500
       toggle led1
      serout TX,0,["at+clip=1",13]
       pause 500
      led1=1
    Start:....
    Led will flash every second if modem is'n connected.
    While setting up modem led will flash every 0.5s.
    When device is ready led stay on.
    After all day breaking my head - I have to say Many Thanks to all who have tried to help me and especially you for the code and Aratti (for hardware correction).
    It is working now.

    BUT as usual few questions to understand it better.
    1) Why is it only working with serout & serin2 combination. I tried it with serout+serin & serout2+serin2 but it didn't work in this combination.

    2)What is the actual difference between 0 & 396 when they BOTH are true baud 2400?
    Thanks again

  24. #24
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default

    It should be work with serout and serout2.
    0 and 396...
    look in help in mcs!!
    396 is for serout2 and serin2
    0 is for serin, serout...
    you have tables in help...

  25. #25
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Why is it only working with serout & serin2 combination. I tried it with serout+serin & serout2+serin2 but it didn't work in this combination.
    Tray to introduce a pacing value in the SEROUT2 command. See page 140 PBP manual.

    Al.
    All progress began with an idea

  26. #26


    Did you find this post helpful? Yes | No

    Exclamation New One!

    Hi Everyone
    I am now able to send text messeges. New Problem, I am unable to read an sent sms. Here is my code:
    rea:
    gosub one
    serout2 tx,baud,["AT+CMGF=1",13]
    Serin2 rx,baud,5000,rea,[WAIT("OK")]
    pause 5000
    gosub one
    serout2 tx,baud,["AT+CMGR=1",13]
    Serin2 rx,baud,5000,rea,[WAIT("REC UNREAD"),skip 3, STR num\12,skip 27,STR sms\10] 'CODE NEVER MOVES FORWARD FROM HERE
    portc=255
    pause 3000
    portc=0
    if sms[0]="t" and sms[1]="e" and sms[2]="s" and sms[3]="t" then
    goto done
    ELSE
    goto rea
    ENDIF


    done:
    serout2 tx,baud,["AT+CMGF=1",13]
    Serin2 rx,baud,5000,main,[WAIT("OK")]
    gosub two
    gosub two
    gosub two
    serout2 tx,baud,["AT+CMGS=",34,"+44798XXXXXXXX",34,13]
    Serin2 rx,baud,5000,main,[WAIT(">")]
    PAUSE 500
    SEROUT2 tx,baud,["done",26]
    goto rea
    Last edited by financecatalyst; - 1st October 2009 at 01:56. Reason: CORRECTION

  27. #27
    Join Date
    Feb 2011
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Re: TC35i GSM With PIC 16F690 help

    hi all,

    I have read through the discussion that you guys had. They are so informative and useful. Now I want to send message to the PIC16f690 to turn on a LED. My GSM and PIC can work well with hyperterminal. However, if i want to have a direct connection from GSM to PIC, i dont get any response. Any ideas?

    char AT[]={0x41,0x54,0x2B,0x43,0x4D,0x47,0x52,0x3D,0x34,0x0 D,0x0A}; //AT+CMGR=1

    while(1)
    {
    for (j=0;j<11;j++)
    {
    TXREG=AT[j];
    for (i=0;i<500;i++){
    }
    }

    if (RCREG=='T') // if receive T then turn on LED
    {
    PORTC=0x01;
    }
    for (i=0;i<1000;i++){
    }

    }
    Last edited by sunsun; - 24th February 2011 at 08:47.

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


    Did you find this post helpful? Yes | No

    Default Re: TC35i GSM With PIC 16F690 help

    I have read through the discussion that you guys had
    And did you notice that we are using BASIC ?
    Dave
    Always wear safety glasses while programming.

  29. #29
    Join Date
    Feb 2011
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Re: TC35i GSM With PIC 16F690 help

    Yes I knew it. Though it's BASIC but I still get some ideas from it. So do you have any ideas for C?

  30. #30


    Did you find this post helpful? Yes | No

    Default Re: TC35i GSM With PIC 16F690 help

    After a long time, but I would like to ask here as well as you lot have worked with TC35i:

    * Are there any AT commands for this or how to see the keyed in number from the mobile keypad on the other end during an active voice call. MY TC35i is connected to my comp with RS232. I am watching and sending normal AT commands using hyperterminal.

    Currently what happens is that I dial the modem using my mobile, hyperterminal shows RING ****, I send ATA, and call gets answered and OK appears. After that when I press any number on the keypad, nothing appears on the hyperterminal.

    Hope to crack this problem here soon. Thanks
    ___________________
    WHY things get boring when they work just fine?

  31. #31
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default Re: TC35i GSM With PIC 16F690 help

    Numbers are encoded in the DTMF signal. If you need to read them you have to decode the dtmf sound signal. The easiest way is to use a MT8880.

    Cheers

    Al.
    All progress began with an idea

  32. #32


    Did you find this post helpful? Yes | No

    Default Re: TC35i GSM With PIC 16F690 help

    Thanks Al. Though I will search on this IC now, but I am a little confused as to the connections of this IC. What I mean is I have used TX/RX lines from RS232 already, where would this DTMF IN/OUT will connect to? I have come across few circuits but this IC is connected to home phone line rather than MODEMS.
    ___________________
    WHY things get boring when they work just fine?

  33. #33
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default Re: TC35i GSM With PIC 16F690 help

    The DTFNM input that normally is connected to the phone line, must be connected to the voice out of your TC35i. Generally one capacitor of 100 nF and 100 Khoms in series is just enough. See the examples on the data sheet. The decoding is presented as a nibble ( 4 bits).

    Cheers

    Al.
    All progress began with an idea

  34. #34
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,588


    Did you find this post helpful? Yes | No

    Default Re: TC35i GSM With PIC 16F690 help

    Moved from Schematics.

    Robert

Similar Threads

  1. Want to learn GSM & PIC programming
    By financecatalyst in forum GSM
    Replies: 5
    Last Post: - 25th February 2014, 10:22
  2. GSM With PIC?
    By financecatalyst in forum General
    Replies: 1
    Last Post: - 20th September 2009, 00:12
  3. SERIN AND SEROUT PROBELM USING 16f690 PIC
    By Charles in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 18th January 2007, 04:59
  4. gsm card reader using pic
    By ninebarmaximus in forum General
    Replies: 0
    Last Post: - 6th December 2005, 19:08
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th March 2005, 00:14

Members who have read this thread : 1

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