This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Doubts regarding interfacing of gsm modem with 8051

Hello,
I could successfully interfaced GSM modem to PC. now i want to interface the same modem to AT89C51.
so can any one please suggest any site where i will get a sample of a program??
actually i referred some sites but i got all C programs and i want to do programming in assembly. because rest of my program is in assembly.so if available please suggest me some sites where i will find programs in "assembly language"

also,
In many circuits i saw use of LCD to display responses from modem.
but in my case i don't want to use LCD for this purpose.
my doubt is In any case we have to input those responses from GSM modem to microcontroller,otherwise communication won't be possible right? please correct me if i am wrong.

thank you :)

Parents Reply Children
  • As Per said, you need to pay attention to the Responses from the modem.

    This has nothing to do with Keil or the 8051 or even 'C'...

  • Nor even anything specifically to do with GSM - the same would apply to any type of modem (or modem-like device) which uses AT Commands.

    Or, in fact, to anything which uses a command-response "protocol"...

  • yeah yeah..
    But now my point is that, i don't need those commands (I am not using any LCD to display Commands & responses), but they are required to be taken into consideration as a necessity of the communication so what should be done? How to implement it in code?

  • And my point is that there is nothing new, novel, or special in what you are doing.

    It is just standard AT Command processing.

    It has been done countless times over many decades.

    There is no shortage of examples!

    www.lmgtfy.com

  • If a modem command is expected to respond with an OK - don't you think you should consider implementing a send_at() command that sends a command and waits for the "OK" or a timeout or an error?

    Then you send the commands one by one and check if you got your "OK" or not.

    It is a standard dialogue. If you talk with someone and ask a question, you normally then give them time to respond before you continue to talk. Same with a modem. And just as when you ask a question, you might not get the answer you expect. So you may have to change your line of discussion based on the received answer.

    If you see a "RING", it obviously will not go well to think you can lift the hook and dial a number - lifting the hook will accept the incoming call instead of allowing you to make an outgoing call. So besides ok/error responses, some unsolicited messages might be needed to be properly handled too - that was a reason why I suggest a state machine for handling the modem interaction.

  • Hello sir, Thank you for your co-operation.
    I have edited my code

    here is the edited code:

    ORG 0000H
                    MOV TMOD,#20H                   //TIMER 1, MODE 2
                    MOV TH1,#-3                             //9600 BAUD RATE
                    MOV SCON,#50H                   //8 BIT, 1 STOP, EN ENABLED
                    SETB TR1
    
                    MOV DPTR,#MSG1
                    ACALL H1
                    ACALL DELAY
                    MOV DPTR,#MSG2
                    ACALL H1
                    ACALL DELAY
                    MOV DPTR,#MSG3
                    ACALL H1
                    ACALL DELAY
                    MOV DPTR,#MSG4
                    ACALL H1
                    ACALL DELAY
                    MOV DPTR,#MSG5
                    ACALL H1
                    ACALL DELAY
    STAY: SJAMP STAY
    H1:     CLR A
                    MOVC A,@A+DPTR
                    JZ B1
                    ACALL SEND
                    INC DPTR
                    SJMP H1
    B1:
                    RET
    SEND:   MOV SBUF,A
    H2:     JNB TI,H2
                    CLR TI
                    RET
    DELAY:  MOV R3,#50H
    HERE2:  MOV R4,#50H
    HERE:   DJNZ R4,HERE
                    DJNZ R3,HERE2
                    RET
    
    
    ORG 300H
    MSG1: DB "AT",0DH
              DB 0H
    MSG2: DB "AT+CMGF=1",0DH
              DB 0H
    MSG3: DB "ATE=0",0DH
          DB 0H
    MSG4: DB "AT+CMGS=",'"8149111111"',0DH
              DB 0H
    MSG5: DB "TEXT",0X1A
              DB 0H
    
              END
    

    now is it correct??

  • But your edited code still don't care about modem responses - all you have is a stupid delay that don't take into account how long time the modem needs. Or if the modem accepts or rejects the command.

    So exactly what did you think your improvement was, when you asked "now is it correct??"

  • now is it correct??

    No, it isn't. And the only way you could fail to know that already is if you not even bothered to compile it before showing it here.

  • And the only way you could fail to know that already is if you not even bothered to compile it before showing it here.

    Would make far more sense to attempt assembly of that code. A compiler is likely to throw up a lot of errors, what with it not being a high level language.

  • Actully previously i was confused in use of DPTR.

    How to Synchronize those commands and routines sir?? Actually i had referred many C programs in which they hadn't considered these responses and i don't know why. :(

    Please tell me how to program the same?

  • I had compiled my program in keil uversion 3

    I got 0 errors and 0 warnigs..

  • Actually i had referred many C programs in which they hadn't considered these responses and i don't know why. :(
    


    So maybe you should check what C programs you have found. Bad student code is bad student code, even if uploaded and available on the net.

    Whenever you do google and find some code, you must try to make some educated guess if the person who wrote the code really is skilled enough that you want to read and learn from the code. Or if it might have been a student with the view "it was hard for me to write, so this must be rocket science - I better share".

    Have you really made sure you used good Google search terms when searching for code? Note that for C communication with a modem, 8051 is not a good search term - it will just limit the number of possible hits. The interaction with the modem looks the same whatever processor you use. It is only the low level code for sending/receiving individual characters that differs between hardware environments. So info about smart serial communication can include 8051 as search term, since it is interesting to specifically look at examples that uses interrupts or polling when accessing an 8051 UART.

  • okay.. thank you for spending your time for me..

    Can you please guide me to program that synchronization part??
    Please..

  • If I have two choices - spending time teaching you how to make the interaction with the modem a dialog (despite that information already available on the net) or spend the same time earning money by developing commercial solutions - which alternative do you think I prefer?

    Developing - doesn't matter if doing it as a hobbyist, student or professionally - requires you to be comfortable with searching for, and analyzing information. It may be requirements specifications that must be broken down into pieces and have any goofs or missed issues located. It may be scanning the net for current state-of-the-art or trying to figure out if there may be competing patents. But whatever level you are on, you just _need_ to be comfortable using the web search engines. And make a quality-guestimate for all found information. Other people can't do it for you.

  • Would make far more sense to attempt assembly of that code. A compiler is likely to throw up a lot of errors, what with it not being a high level language.

    RE: Who woke up the amateurs? as seen aboe they came out in droves