Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

C/C++ Serial Comms AT Command help

Options
  • 21-04-2004 2:50pm
    #1
    Registered Users Posts: 7,860 ✭✭✭


    i have a problem with communicating with COM3.
    i am writing a program that will, hopefully, receive an SMS message off a GSM modem or a phone, read it, handle the data, ie if it says "LOTTO" then retrieve lotto results and send a new SMS back to the user with the lotto results in it.

    The only problem i have is communicating with the device. im testing with my internal modem using AT commands. When i send the command "AT", or "ATE1" or "ATI1" etc, i get back the string "ERROR". Actually, the string is "carriage return, line feed,E,R,R,O,R,carriage return, line feed. when i leave the command blank, i get back nothing, so obviously its sending, but sending the commands wrong.

    for my command i have:
    char *command = "ATE1" ;

    in my program, i create the handle, using createfile, set the DCB structure, do sum error checkin to make sure the port is setup corrrectly, then i write and if the write is successful, i read.

    any1 know why my commands are getting sent incorrectly?
    Do i need to send "carriage return, line feed, ATE1, carriage return, line feed" or something? also, i've tried sending "ATZ" first because thats the initialize modem comand but no difference.

    im compiling in MS VC++ 6 in windows.

    thanks for any help.


Comments

  • Registered Users Posts: 7,860 ✭✭✭The_B_Man


    solved the problem.

    it was to do with the number of bytes i was sending and receiving and also, i sent the command as "ATI1\r\n" with carriage return and line feed.

    all i need now is the at command to retrieve an SMS from the phone, anyone know where i can find it?


  • Registered Users Posts: 2,426 ✭✭✭ressem


    AT+CMGR
    according to

    http://www.cellular.co.za/sms_at_commands.htm

    google for "AT+CSMS" for more along the same lines.


  • Registered Users Posts: 7,860 ✭✭✭The_B_Man


    thanx, thats excellent.
    I dont suppose u have the same for Nokia FBUS Commands?


  • Registered Users Posts: 2,426 ✭✭✭ressem


    :dunno:
    beyond me

    first google link was
    http://www.embedtronics.com/nokia/fbus.html
    which looks as well explained as these 'hidden' protocols get.

    and they recommend gnokii
    http://freesoftware.fsf.org/download/gnokii/
    protocol docs embedded in the tarball.


  • Registered Users Posts: 7,860 ✭✭✭The_B_Man


    FBUS is out the window coz u cant use WriteFile() to send them, which is wat i was using. instead u have to do a big complicated handshaking process.
    im just gonna stick to the easy AT commands.
    thank 4 the help.

    by the way, would i need something connected to a phone line or a mobile phone to test these AT-SMS commands, or could i do it on my internal modem that isnt connected, any ideas? i hope me g/f's mobile uses AT Commands or im fudged!!


  • Advertisement
  • Registered Users Posts: 2,426 ✭✭✭ressem


    could i do it on my internal modem that isnt connected, any ideas?

    You require a GSM modem. This can be something like an M20 or TC35 external modem or a link to the right type of phone. (I use a broken down Nokia 6150 + DAU9P cable, supposedly should work over IRDA serial connection but on this phone implementation was flawed).

    Sell it for a reasonable price :-) if you can't afford that SMSC internet link just yet.


Advertisement