Pic to GSM Phone connection (HSerin problems) - Page 4


Closed Thread
Page 4 of 8 FirstFirst 12345678 LastLast
Results 121 to 160 of 289
  1. #121
    Join Date
    Apr 2005
    Posts
    17

    Default

    Woiw nice to hear about it!!
    Congrats my friend..

    Now my problem is this..since I can successfully send SMS I also what it to received and process some command I want it to fucntion like this:

    SerIn2 Rx, Baud (...READ THE MESSAGE IN 1ST MEMORY LOCATION) if the message contains a command like, ON1 call ON1 routine, if it contains OFF1 call OFF1 routine else goto DELETE_SMS. Then make a loop to check it again..

  2. #122
    Join Date
    Sep 2005
    Location
    Switzerland
    Posts
    46

    Default

    Kasamiko,
    I'm making some test about reading sms received.
    I'll let you know as soon as I have some good result.

    Bye
    Lotondo

    Ps: Are you a vampire ? 8) You are always writing in the middle of the night.

  3. #123
    Join Date
    Apr 2005
    Posts
    17

    Talking

    Nice to hear that my friend..pls keep me updated..

    Me vampire?? you're wrong...I'm a security guard!! hehehehe...

    Regards to all..

  4. #124
    Join Date
    Jan 2004
    Location
    Thessaloniki , GREECE
    Posts
    61

    Exclamation 6210 gsm modem

    Hi! to all of you picMANIACS out there!

    I experiment with my (damaged lcd!) 6210 ! . This is an excellent platfrom for my pics experiments using sms alarm sytem.
    It does support text sms mode and I have seen that it has a build-in gsm modem (through AT commands)
    I wonder if it is possible to call the 6210 from my home pc modem and initiate a data call!
    My first attempt with hyperterminal was this:
    connected 6210 (trough pic dlr2p interface-THANKS KASAMIKO for your circuit) with one com of my pc + hyperterminal (communication was established ) .
    At com2 I have my external USRobotics modem.
    I dial the number of 6210 with usr modem and at the other and I noticed that 6210 response with '+CRING: VOICE '

    How can I initiate a data call? . 6210 should response '+CRING: DATA'
    ...at least I hope so!

    Is it possible to start a data call between my desktop modem and 6210 ?

    Has anyone tried this?

    Keep up the good work out there guys

    I have returned and started PIC Projects again!!!!

  5. #125
    Join Date
    Sep 2005
    Location
    Switzerland
    Posts
    46

    Default

    Hi Guys,
    here is my first test, unfortunatly no success.
    I tried several changes in the code but always something went wrong.
    This is the code:
    ;Device 16F84A
    DEFINE OSC 4

    CALLER VAR BYTE[13]
    BAUD VAR BYTE
    LED VAR PORTB.2 ' Assign PortB.2 for Status LED
    TX VAR PORTB.1 ' TX to Phone
    RX VAR PORTA.0 ' RX from Phone

    BAUD = 32 ' 19200,8,N,1(True,driven)

    Start:

    SerOut2 TX, BAUD,["AT",13]
    Pause 500
    SerOut2 TX, BAUD, ["AT+CMGF=1",13] ' Use TXT Mode
    Pause 1000 ' Pause for 1 second
    SerOut2 TX, BAUD,["AT+CMGL",13,10]
    Pause 5000 ' Pause for 1 second
    SerIn2 RX, BAUD,[wait("REC READ"),skip 3,STR CALLER\13]
    Pause 1000
    High LED ' Turn ON Status LED
    SerOut2 TX, BAUD, ["Result: ",STR CALLER,13,10]
    Pause 2000
    Low LED
    End

    This is what I get on hyperterm monitor:

    AT
    OK
    AT+CMGF=1
    OK
    AT+CMGL

    +CMGL: 1,"REC READ","44544",,"05/05/31,16:58:21+08"
    Super! Viel Gluck in der Verlosung! - Bonne chance au tirage au sort! - Buona fortuna per l'estrazione! Swisscom Mobile

    OK

    I think that after the "OK" the pic should send out:
    Result: 44544
    Maybe also some other characters, Caller var byte has 13 byte
    In any case there is a record that matched and I believe I should
    see something
    Led does not also go on.
    What am I doing wrong ?

    Thanks

    Lotondo

  6. #126
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    Sorry guy, but you'll NEVER EVER be able to have a reliable 19200 baud comm @ 4MHZ with serout2. Seems you miss the advert in the manual

    try with DEBUG instead OR have a higher crystal value OR change your PIC to another who have an internal USART like 16F628. With the internal USART @ 4MHZ you'll be able to make it work.
    Last edited by mister_e; - 11th September 2005 at 22:51.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #127
    Join Date
    Sep 2005
    Location
    Switzerland
    Posts
    46

    Default

    Well Mister_e,
    in one way i agree with you but pls. have a look to msgs. 113, 118 and 120.
    How can you explane me that in this test everything is working great ?
    Pls do not missunderstand me, I also read that theoreticaly should not
    work but it does.
    Maybe there is something wrong in this code (msg. 125), i'm not
    an expert and i'll try to increase the crystal but i have the feeling that it's not
    only this the problem

    Bye
    Lotondo

  8. #128
    Join Date
    Sep 2005
    Location
    Switzerland
    Posts
    46

    Default

    Hi everybody !
    Here I'm again.
    I moved to pic 16F876A + Crystal 20MHZ
    Here is the code:

    DEFINE OSC 20
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_BAUD 19200
    DEFINE HSER_SPBRG 64 ' 19200 Bauds
    DEFINE HSER_CLROERR 1

    Caller VAR BYTE[5]

    HSerout ["AT",13,10]
    Pause 1000

    HSerout ["AT+CMGF=1",13,10] 'Set Text Mode
    Pause 1000

    Loop:

    HSerout ["AT+CMGL",13,10]
    Pause 1000
    HSerin 5000,loop,[wait("REC READ"),STR Caller\5]
    HSerout [STR Caller,13,10]

    End

    Here is what i get on monitor:

    AT
    OK
    AT+CMGF=1
    OK
    AT+CMGL
    +CMGL: 1,"REC READ","44544",,"05/05/31,16:58:21+08"
    Super! Viel Gluck in der Verlosung! - Bonne chance au tirage au sort! - Buona fortuna per l'estrazione! Swisscom Mobile
    OK

    And it loops endless.

    There is only one sms, and it has REC READ
    I'm waiting to see something after the OK, it should be "44544" or anything else but it should !!
    Am I right or not ?
    Please help me !
    Thanks
    Lotondo

  9. #129
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    i'm not a pro of SMS but i think it refer to that part
    Code:
    Loop:
    
    HSerout ["AT+CMGL",13,10]
    Pause 1000
    HSerin 5000,loop,[wait("REC READ"),STR Caller\5]
    HSerout [STR Caller,13,10]
    
    End
    probably you need a delay after the HSERIN and a GOTO after the HSEROUT.

    I can be wrong but i think it make sense. With the current, after the Hserout, your program can jump to XYZ places so ... hard to say what's happen.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  10. #130
    Join Date
    Sep 2005
    Location
    Switzerland
    Posts
    46

    Default

    I did some delay, nothing changed.
    I made another test, here is the code:

    DEFINE OSC 20
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_BAUD 19200
    DEFINE HSER_SPBRG 64 ' 19200 Bauds
    DEFINE HSER_CLROERR 1

    main:
    HSerout ["AT",13,10]
    HSerin 5000,main,[WAIT("OK")]
    HSerout ["WELL DONE",13,10]
    End

    Despite i receive the ok from the phone, the program continues to
    loop and no WELL DONE.

    I don't know what to search and/or test anymore !!

    Thanks for any help.
    Bye
    Lotondo

  11. #131
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795

    Default

    Quote Originally Posted by Lotondo
    main:
    HSerout ["AT",13,10]
    HSerin 5000,main,[WAIT("OK")]
    HSerout ["WELL DONE",13,10]
    End
    I can not understand where will the "WELL DONE" message be displayed. You are sending it back to the mobile, is this correct? What can the mobile do with this message?

    On you previous post you had a pause 1000 after HSerout ["AT",13,10]. You did well removing it.

    So, I guess a sample like this might help you:

    main:
    Green_Led=0
    HSerout ["AT",13,10]
    HSerin 5000,main,[WAIT("OK")]
    Green_Led=1
    End

    Ioannis

  12. #132
    Join Date
    Sep 2005
    Location
    Switzerland
    Posts
    46

    Default

    Ioannis
    thanks for answering.
    As you know i have problems with hserin.
    The WELL DONE should come out on the screen cause i'm monitoring
    via max232 what it's happened between the pic & phone.
    I tried as you said to add the Led lines. The led did not turn on.
    The pic sends out the AT, the phone answers back OK, the pic now
    should understand that it has received an OK and with Hserin should
    turn a led on or send out a WELL DONE.
    Of course the phone does not understand what the purpose but I should
    see it on the monitor and the pic ends to run.
    Thanks for any further help
    Lotondo

  13. #133
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795

    Default

    I know it might sound silly, but are sure you are communicating between mobile and PIC with the correct levels? May be your PIC does not see the appropriate voltage levels if you don't use a MAX232 device.

    Other than that, I cannot see what might be wrong.

    Ioannis

  14. #134
    Join Date
    Sep 2005
    Location
    Switzerland
    Posts
    46

    Default

    Well,
    I think so. I'm using Kasamiko's schema + max232 to monitor the dialog between pic & phone.
    I already tried several code list, I can send sms out if an event happens at a programmed port and many more.
    Now i wanted to try the opposite, if it receives a sms the pic should, for example, turn a led on.
    I believe I have to use hserin to catch a part of the sms (text or pdu) but it seems not working properly.
    I don't know, i'm using all my knowledge (not a lot), I read more than hundred posts, it seems that i'm using hserin correct but ..........
    Thanks for any help.
    Bye
    Lotondo

  15. #135
    Join Date
    Sep 2005
    Location
    Switzerland
    Posts
    46

    Default

    After a long rainy Sunday day spent in front of 16f876A I think I got where is the problem but I can not give me an answer of why this happen.
    Please see code in the msg. 130+131.
    If I use serial db9 pin 2 (rx) to monitor what the pic (pin 17) is sending to the phone I just see a loop of AT. Perfect no problems here.
    If now I monitor what the pic (pin 18) is receiving from the phone I see:
    AT
    OK
    According to my knowledge I should just receive OK.
    After this I decided to change the line
    HSerin 5000,main,[WAIT("OK")] into
    HSerin 5000,main,[WAIT("AT")] and like a miracle on the screen WELL DONE and the led on.
    I believe it's quite clear why with WAIT("OK") the led did not go on, after AT there is a and the OK gets lost.
    I do not really understand why the phone is sending back again AT and not just OK.
    If someone of you can explain me this I think I'll get the solution of my problem.
    I'm waiting for yr msgs.
    Thanks
    Lotondo

  16. #136
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795

    Default

    You had to send to the mobile ATE0 (that is E and zero).

    By default all phones reply what you type, so you can see on you monitor screen what you have just typed.

    May be you could also try to set the phone to numeric response instead alphanumeric with ATV0. Instead of "OK" you'll get 0 and 4 for error.

    Ioannis

  17. #137
    Join Date
    Sep 2005
    Location
    Switzerland
    Posts
    46

    Default

    Thanks for tips.
    I tried but no success.
    Well I'll try to change the phone, maybe the 7110 is not the right one.
    Even in my working test (msg.135) I could see that it was unstable, sometimes it did work, sometimes not.
    I can not spend too much time in these tests.
    Hserout is working fine, at the moment I'll use to send out sms.
    For the incoming I'll wait for a while.
    Thanks

    Lotondo

  18. #138
    Join Date
    Sep 2005
    Location
    Honduras
    Posts
    7

    Default

    what dou you all study to know all that?
    do you spend all day long in electronics and computer??

    doesnt your girlfriend bother you?? opss... do you have one??

    what is your life like??

    you all seem to be genious!!

  19. #139
    Join Date
    Oct 2005
    Location
    Stuttgart, Germany
    Posts
    24

    Default

    Hi everyone!
    Did somebody try to connect Siemens mobile to PIC? I have S65 with no result
    I guess, Siemens needs more then 3 wire connection.

  20. #140
    Join Date
    Sep 2005
    Location
    Switzerland
    Posts
    46

    Default

    @Rufinus

    Check here maybe you'll find the solution
    http://pinouts.ru/data/siemens_c55_pinout.shtml

  21. #141
    Join Date
    Oct 2005
    Location
    Stuttgart, Germany
    Posts
    24

    Default

    Thanx, Lotondo.

    But i do have the pinout of S65 and even service manual of C55/S55 (they are similar to S65).
    Perhaps i should give some more detail of my problem.


    I started with 16F84 and serout2 commands. Everything according to this thread.
    Pic is connected to the phone through the MAX232 and original data cable, which came with tthe phone. I managed to connect pic and pc with 9600 baud and lower in bidirectional mode. No problem with that. Phone and pc communicate very good as well. Tried all kinds of commands, even sniffed on com2 port to see how original Siemens software is sending sms from pc.
    Than i made an adapter, in order to determine how many wires are essential for communication between pc and phone using original cable. Result: 3 wires if enough for communication (did not try GPRS), AT commands are working from hyperterm.
    Now, if i connect the same 3 wires to the pic, phone does nothing!!

    This is driving me crazy for 2 days already

    From this all i concluded, that problem is in Siemens original cable (?). Dont know what the problem, unfortunately. Gonna keep on trying.

    Also desided to shift to pic16f870. Has more capabilities. Tried to send
    Hserout ["ATD phonenumberhere", 13, 10]
    at 9600 baud and received it on pc without problem. Phone still does nothing.

    Should name it Enigma instead of Siemens

  22. #142
    Join Date
    Oct 2005
    Location
    Stuttgart, Germany
    Posts
    24

    Question

    Here is the code i used to test it with PC:

    DEFINE LOADER_USED 1

    'UART hardware defines
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 20h
    DEFINE HSER_BAUD 9600
    DEFINE HSER_CLROERR 1


    'LCD defines
    DEFINE LCD_DREG PORTA 'set LCD data port
    DEFINE LCD_DBIT 0 'set starting data bit (0 or 4) if 4 bit bus
    DEFINE LCD_RSREG PORTA 'set LCD register select port
    DEFINE LCD_RSBIT 4 'set LCD register select bit
    DEFINE LCD_EREG PORTB 'set LCD enable port
    DEFINE LCD_EBIT 3 'set LCD enable bit
    DEFINE LCD_BITS 4 'set LCD bus size (4 or 8 bits)
    DEFINE LCD_LINES 2 'set number of LCD lines
    DEFINE LCD_COMMANDUS 2000 'set command delay time in us
    DEFINE LCD_DATAUS 50 'set data delay time in us
    DEFINE OSC 20 'set crystal speed



    'Main program


    pause 1000 'wait for screen to sort get started
    start:
    lcdout $FE,1, "Sending number.."
    pause 1000
    HSEROUT ["atd **********", 13, 10]
    HSERIN [wait("OK")]


    lcdout $FE, 1, "Got it!"
    pause 1000
    goto start
    end


    It's running on 16f870 connected trough max232 to com2 port on pc, and i have no problem!
    When i connect the phone following way:
    PIC--->MAX232--->Data cable (original Siemens)--->Phone

    Nothing happens!
    That must be the cable. But from other side, phone is listening to commands from pc, using same cable with only 3 wires connected: Rx, Tx, GND
    Miricle..

  23. #143
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795

    Default

    Quote Originally Posted by Rufinus

    'Main program

    pause 1000 'wait for screen to sort get started
    start:
    lcdout $FE,1, "Sending number.."
    pause 1000
    HSEROUT ["atd **********", 13, 10]
    HSERIN [wait("OK")]

    lcdout $FE, 1, "Got it!"
    pause 1000
    goto start
    end
    Try to add on top of your program:

    HserOut ["AT",13,10] ;Sync modem to 9600 baud

    Also if you power up PIC at the same time as the mobile you won't get reliable connection with the phone until the phone is on the network.

    Ioannis

  24. #144
    Join Date
    Oct 2005
    Location
    Stuttgart, Germany
    Posts
    24

    Unhappy

    Thanx, but i tried this already. Nothing. And i do not power up the phone in the same time. Phone is just on costantly.

    I thougt, maybe when i send AT, phone answers OK, but pic does not capture it (for whatever reason). So i changed to atd **********, because even if pic is not capturing the answer, phone should react (dial given number).
    I started yesterday to build new cable, just typical 3 wires based on standard MAX232. Let's see what this will give. I will test it with the phone--->pc connection first, and than test with pic. And if this doesnt work, i should consider direct connection from pic to phone without max232 but just trough 1 kOhm resistors. Shall i send in inverted mode then?

    And i measured voltages on the original cable, both form the phone's side and rs232 side. Cable was pluged in the phone and not in rs232. I can give them here, if somebody is interested. It seems, that phone is powering the cable's logic.

  25. #145
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795

    Default

    If you miss the MAX232 then send in inverted mode. The MAX does this inversion.

    Another thing you may try is to use Numeric mode instead Alphanumeric. Then the phone answers 0 (zero) for OK, 4 for error etc.

    Did you double check that you have not connected Rx, Tx the wrong direction? Try to cross connect them. Don't worry, RS232 is able to withstand this if it wrong.

    Ioannis

  26. #146
    Join Date
    Oct 2005
    Location
    Stuttgart, Germany
    Posts
    24

    Default

    OK, i will try again without MAX using inverted mode. How to set it in HSerout command?
    I am sure about the RX TX connection, besides, with the pc communication there are no problems.
    And i will try also numeric mode (atv0, if i am corect?)

    Well, it would be easy to give up on it, but it looks like nobody tried yet with Siemens. And anyways i like doing this things, so i will keep on going untill its working anyhow, and than i will try to get it working with original cable (sometimes i am an optimist )

    Thanx for your help, Ioannis, i appreciate it.


    P.S. I have a feeling, that this must be some stupid little ditail which is missing. As allways, so..

  27. #147
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795

    Default

    On the matter of Rx Tx connection let me insist on. Try to change and see what happens.

    Also with siemens (cannot recall the model) had no problem 2-3 years ago.

    Whatever you connect to the PIC as modem and sending "AT" it should reply "OK".

    Ioannis

  28. #148
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762

    Default

    Rufinus,

    I guess the problem is with the Siemens Datacable.
    Most cables have some embedded electronics.
    (At least a level shifter, probably more..)

    This is usually powered from the PCs serial port (DTR & RTS)
    So if you are using one of these cables to connect the phone you will need a MAX232 on the PIC end as well.
    And you have to set the correct levels at DTR & RTS on the MAX232 at the PIC end in order to supply the cables embedded electronics.

    As far as I can remember The Siemens interface is 5V tolerant, so all you need is 3 straight wires from the PIC to the Phone (no MAX232 at all).
    But then you'll have to use SERIN2 /SEROUT2 instead of HSERIN/HSEROUT since HSERIN/HSEROUT doesn't allow to toggle between true/inverted mode.
    Last edited by NavMicroSystems; - 14th October 2005 at 18:54.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  29. #149
    Join Date
    Oct 2005
    Location
    Stuttgart, Germany
    Posts
    24

    Default

    OK, just finished selfmade cable.
    Rx and Tx do through the MAX, and CTS(5), RTS(6), DCD(7) are connected to the GND(2) trough 10k resisors. Without this it does not work. Or other way is to connect RTS to CTS straigt, it will communicate with the PC then also. Communication with the PC was fine in both cases. So, sefmade cable is considered to work correctly, at least for the AT commands.

    Tried swapping Rx and Tx as Ioannis sugested, but it just made my phone to go off. After restart it was working fine. So, nothing was wrong with my pinout.


    Now, NavMicroSystems, i am not that sure about powering cable from COM port. It is rather powered by the phone itself (as strange as it sounds). As a proof i can say, that i was able to communicate with the PC, using original cable with only 3 wires (Rx, Tx, GND), rest of them i disconnected for the experimental sake. And in this configuration it was working with hyperterm or some similar software except original Siemens software, which did not detect the phone. Only when you connect also CTS line, the phone will be detected by the Siemens software.

    I should mention again, i'm experimenting on S65 and S55 phones which are rather new, and they are different from older Siemens models, pinout of the phone's interface and connector itself are different.


    So, now my setup looks like this: PIC--->MAX232--->MAX232(selfmade cable)--->Pnone

    From above, and as NavMicroSystems says, both MAXes can be ommited. Will try then connecting straight PIC to Phone using serout2 in inverted mode.
    Wish me good luck
    Last edited by Rufinus; - 14th October 2005 at 18:07.

  30. #150
    Join Date
    Oct 2005
    Location
    Stuttgart, Germany
    Posts
    24

    Default

    Well, i guess, your wishes did work

    A little

    I did connect it straight with the pic and used inverted mode. And i got the phone dialing! Why didnt it work with pic16f84 then?? Who knows..

    So, thanks to all who cared and helped, in particular, NavMicroSystems and Ioannis.


    But it still leaves some questions. Why didnt it wont to work with cables??

  31. #151
    Join Date
    Oct 2005
    Location
    Stuttgart, Germany
    Posts
    24

    Default

    Ooops. It was to early to yell Gloria!
    It does work with S55, i am able to send commands to the phone, but not receive from the phone.
    And with S65 nothing is working at all. Tried different modes..

  32. #152
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762

    Default

    Rufinus,

    I don't have the full specs of S55/S65
    but this looks like a problem with the logic levels.
    (Presuming your Code is OK)

    Could you Scope the phones TX Pin to see wether it is sending anything at all and check it's output level?

    You'll probably need a simple Levelshifter (i.e. 2 Transistors)
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  33. #153
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795

    Default

    I totally agree with Ralph. If your phone is "listening" what PIC says then PIC should listen too. May be the phone outputs too low voltage levels. So a MAX232 or even a simple circuit with a transistor would help. Test with a scope to see the real levels. What Resistors are you using on Rx - Tx lines?

    Ioannis

  34. #154
    Join Date
    Oct 2005
    Location
    Stuttgart, Germany
    Posts
    24

    Default

    Well, i fidured out S65 now too. The cable is the key to success.
    S55 and S65 use different cable detection mechanisms. Yes, yes, phones novadays are detecting data cables. So, besides the usual Rx, Tx, GND lines, one needs other pins on the phone too, to tell the phone, that cable is present and the datatransfer will happen.
    After googling for some time, i found out, that pins 5,6, and 7 of the phone connector determine how the phone will detect the cable. If you connect 5,6,7 through 10k resistors to pin 2, Siemens S65 will detect it as DCA540, which is corresponding to the Siemens USB connection cable. And so the cable is detected, the phone will not respond to AT commands.
    Now, if you connect only 5,7 through the 10k resistors to the pin 2, phone will recognize this cable as DCA510, which is Siemens COM cable. And S65 then responding to AT commands. Bingo!

    For now, phone is connected straight to pic through 1k resistors on Rx Tx lines. And i tried to scope the Tx line from the phone and yes, i get a spike of about 3-3.5 volts (my scope is an old one) after sending the AT command to the phone. For comparizon, i scoped the Tx line of the pic, which gave about 4.5 volts spike.
    So, i conclude, that phone is receiving and anwering now.
    I guess, i will now send the Tx signal from the phone trough the MAX232, to insure proper levels for the pic.

    And here is mine testing code i use:

    DEFINE LOADER_USED 1


    'LCD defines
    DEFINE LCD_DREG PORTA 'set LCD data port
    DEFINE LCD_DBIT 0 'set starting data bit (0 or 4) if 4 bit bus
    DEFINE LCD_RSREG PORTA 'set LCD register select port
    DEFINE LCD_RSBIT 4 'set LCD register select bit
    DEFINE LCD_EREG PORTB 'set LCD enable port
    DEFINE LCD_EBIT 3 'set LCD enable bit
    DEFINE LCD_BITS 4 'set LCD bus size (4 or 8 bits)
    DEFINE LCD_LINES 2 'set number of LCD lines
    DEFINE LCD_COMMANDUS 2000 'set command delay time in us
    DEFINE LCD_DATAUS 50 'set data delay time in us
    DEFINE OSC 20 'set crystal speed


    b0 var byte

    include "modedefs.bas"


    'Main program


    pause 1000 'wait for screen to sort get started
    start:




    lcdout $FE,1, "Sending AT.."
    pause 3000
    serout2 portc.4, 84, ["AT", 13]
    serin2 portc.5, 84, [b0]
    lcdout $FE, 1, b0


    pause 3000
    lcdout $FE,1, "Sending command.."
    serout2 portc.4, 84, ["at+cgmm", 13]
    serin2 portc.5, 84, [b0]
    lcdout $FE,1, b0
    pause 5000
    goto start
    end


    -------------------------------------------

    Now, i predict your comment about b0. With this i gust try to get anything from the phone, for example, after AT, b0 should be displayed as O (from OK), and after AT+CGMM it should be S (from S65). When i get correct response, i will change to WAIT("OK") or so.

    And one more detail. As you see, i used mode 84 in serout2, which is True mode. In inverted mode, which would be the 16468, phone does not respond (very strange, indeed).
    Last edited by Rufinus; - 16th October 2005 at 13:52.

  35. #155
    Join Date
    Oct 2005
    Location
    Stuttgart, Germany
    Posts
    24

    Default

    Switched back to HSEROT, HSERIN just to experiment. Seems to be fine, phone starts dialing! (extremely strange).
    But still cannot receive anything. Considering level shifter for the Tx line of the phone.
    Perhaps you have something simple in mind already?

  36. #156
    Join Date
    Oct 2005
    Location
    Stuttgart, Germany
    Posts
    24

    Default

    Connected Tx line from the phone through max232 to pic. Nothing.
    Than i desided to hook it up to pc. So the phone is receiving commands from the pic and outputting them to the pc.
    Here is what i get:

    AT#0D [len=2] <------it echoes AT command from the pic??
    #0D[len=0]
    OK#0D [len=3] <------ that is the answer
    at+cgmm#0D [len=7] <-----command to display model number(also echoed?)
    #0D[len=0]
    S65#0D [len=4] <----- answer
    #0D [len=1]
    OK#0D [len=3]

    So, now it is 100% clear, that phone is answering. But why then pic does not receive anything??? With or without max, i cant receive answers!

  37. #157
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795

    Default

    If you don't want the phone to echo (with PIC you sure do not want) try ATE0 (<- zero, not capital O).

    Ioannis

  38. #158
    Join Date
    Oct 2005
    Location
    Stuttgart, Germany
    Posts
    24

    Default

    Discovered strange thing. Works with S55. If i connect Tx line from the phone trough 1k resistor to one of the ports, serin2 will hang, waiting for an answer on that port. But when i quickly shorten this serin2 port to the ground, it starts working! And then hangs until the next command, then i short it and after it goes without problem to the end of the program. This trick does not work with HSERIN or SERIN. And only sometimes works with S65 phone.
    With max232 doesnt work anyways.

    Any ideas??



    Here is my code:


    DEFINE LOADER_USED 1

    'UART hardware defines
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 20h
    DEFINE HSER_BAUD 9600
    DEFINE HSER_CLROERR 1


    'LCD defines
    DEFINE LCD_DREG PORTA 'set LCD data port
    DEFINE LCD_DBIT 0 'set starting data bit (0 or 4) if 4 bit bus
    DEFINE LCD_RSREG PORTA 'set LCD register select port
    DEFINE LCD_RSBIT 4 'set LCD register select bit
    DEFINE LCD_EREG PORTB 'set LCD enable port
    DEFINE LCD_EBIT 3 'set LCD enable bit
    DEFINE LCD_BITS 4 'set LCD bus size (4 or 8 bits)
    DEFINE LCD_LINES 2 'set number of LCD lines
    DEFINE LCD_COMMANDUS 2000 'set command delay time in us
    DEFINE LCD_DATAUS 50 'set data delay time in us
    DEFINE OSC 20 'set crystal speed



    b0 var byte
    include "modedefs.bas"



    'Main program


    pause 1000 'wait for screen to sort get started

    lcdout $FE,1, "Sending AT.."
    pause 2000
    HSEROUT ["AT", 13]
    pause 500
    HSEROUT ["ATE0", 13]
    serin2 portc.4, 84, [str b0\10]
    lcdout $FE, $C0, str b0\10
    pause 3000

    b0=0
    lcdout $FE,1, "Asking model.."
    pause 2000
    HSEROUT ["at+cgmm", 13]
    serin2 portc.4, 84, [SKIP 2, str b0\20]
    lcdout $FE, $C0, str b0\20
    pause 5000

    b0=0
    lcdout $FE,1,"Asking IMEI.."
    pause 2000
    Hserout ["at+cgsn", 13]
    serin2 portc.4, 84, [SKIP 2, str b0\20]
    lcdout $FE, $C0, str b0\20
    pause 5000

    b0=0
    lcdout $FE,1,"Asking capabilities:"
    pause 2000
    Hserout ["at+gcap", 13]
    serin2 portc.4, 84, [SKIP 2, str b0\20]
    lcdout $FE, $C0, str b0\20
    pause 5000


    b0=0
    lcdout $FE,1,"Asking time.."
    pause 2000
    Hserout ["at+cclk?", 13]
    serin2 portc.4, 84, [SKIP 2, str b0\20]
    lcdout $FE, $C0, str b0\20
    end

  39. #159
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762

    Default

    Rufinus,
    I hate to say that, but you have got to do some homework.

    Make yourself familiar with the principles of serial communitation and the datasheet of a MAX232.

    Pay special attention on the MODES, (TRUE/INVERTED)

    If you receiver is expecting the data line to be ILDE HIGH and your transmitter IDLES LOW, (and vice versa) you will see all kinds of strange phenomenon.

    You are not really connecting one of the RS232 Outputs of the MAX to the phone or PIC, are you?
    (you are about to kill the PIC and/or the Mobile)
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  40. #160
    Join Date
    Oct 2005
    Location
    Stuttgart, Germany
    Posts
    24

    Default

    RS232 output of max i do connect to the pic, but through 22k resistor.
    Pic to phone both ways goes through 1k resistor.
    There is no reason to connect rs232 straight to phone anyways, so i dont and would not. There is no problem now with the phone receiving commands. The problem is to receive answers on pic.

    Regarding modes - tried both true and inverted, tried different baud rates.

    Now it is connected to the pic without MAX. I still think it is the problem of levels.

    If you have a good link in mind about serial communication, i would appreciate. Otherwise, gonna google.

    Thanks for adwise anyways.
    Last edited by Rufinus; - 17th October 2005 at 22:50.

Similar Threads

  1. Serial VB 2005 pic 16f877a problems
    By Snap in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 8th July 2013, 01:52
  2. HSERIN & Interupts (aka controlling PIC programs from a remote PC)
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th June 2009, 15:46
  3. problem with the GSM controller
    By Dariolo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th May 2009, 21:33
  4. Automatic VB6 to pic serial connection
    By arniepj in forum Code Examples
    Replies: 13
    Last Post: - 10th January 2008, 08:57
  5. Pic to GSM Phone connection
    By samertop in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 14th July 2005, 14:40

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