Connect with us

PIC18F4550 Serial Programming issue

Discussion in 'Microcontrollers, Programming and IoT' started by Pieta, Aug 10, 2012.

Scroll to continue with content
  1. Pieta


    Aug 10, 2012

    char[0] ='A'
    char[1] ='T'
    char[2] ='+'
    char[3] ='C'
    char[4] ='M'
    char[5] ='G'
    char[6] ='S'
    char[7] ='='
    char[8] ='"'
    char[9] =''"'
    char[10] ='+'
    char[11] ='8'
    char[12] ='1'
    char[13] ='8'
    char[14] ='9'
    char[15] ='3'
    char[16] ='3'
    char[17] ='0'
    char[18] ='2'
    char[19] ='2'
    char[20] ='2'
    char[21] ='\r'

    These character will always be fixed for every time...
    They need not to be changed any time.

    Now comes into picture the actual message that is to be sent to GSM

    Lets consider Stop012

    As per you have explained above ...

    Ques1) Does it means that we will be dealing with the 0 in Stop012 just like above..??

    Ques2) if we are sending values like...

    char[0] ='S'
    char[1] ='T'
    char[2] ='O'
    char[3] ='P'
    char[4] ='0'
    char[5] ='1'
    char[6] ='2'

    This means we are alloting memory to each and every element of array....
    So we will also have to unset these values so as to avoid overrunning such a small which part of code unsets the elements of array after sending to GSM.
  2. dahhal


    Jul 17, 2012
    A1. Yes you are dealing with it by encoding it with ASCII.

    A2. You are already handling this scenario in the function below. You are sending every byte until you hit the null character. don't forget the '\r' if you used this in your testing that worked you will still need it. this is what i suppose the gsm module waits for and part of the AT Command.

    void puts(char* p)
    char *temp = p; /*temp pointer so that the actual pointer is not displaced */
    while(*temp != 0x00)

    note: please note I will in a second correct my last post to include '\0' to finish with
  3. Pieta


    Aug 10, 2012
    yes i'll remember the '\r' in the end...its essential

    And In case if i have any other issues....i will gently bother you once again...:)
  4. dahhal


    Jul 17, 2012
    no worries. good luck.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day