Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

GSM modem simulation problem

Status
Not open for further replies.

ADGAN

Full Member level 5
Full Member level 5
Joined
Oct 9, 2013
Messages
295
Helped
4
Reputation
8
Reaction score
4
Trophy points
18
Visit site
Activity points
1,837
Hi! I want to interface the TC35 GSM modem to PIC18F45K22. I tested my GSM modem in Hyper terminal its working fine. The breakout board has a built-in MAX232 IC. So I only need to connect it to the TX1 and RX1 pins of the PIC. I want to know whether I could simulate this in Proteus without connecting the GSM modem, just want to make sure that AT commands are getting out. I tried to do it. But nothing displays on the virtual terminal. The program even didn't run in the hardware too. I tried many other codes as well which are written in MikroC. But nothing worked.

Untitled.jpg

This is my code:
Code:
#include <usart.h>

void UART2_Write_Text(char text[]){
 
    unsigned int i = 0;
 
    while(text[i])Write2USART(text[i++]);

}
 
void GSM_Send(char min){
 
    unsigned char spbrg = 25;
    unsigned char Command_AT[] = "AT\r\n";
    unsigned char Command_CMGF[] = "AT+CMGF=1\r\n";
    unsigned char Command_CMGS[] = "AT+CMGS=\"+94774944647\"\r\n";
    unsigned char msg01[] = "Hello!";  
    unsigned char CtrlZ = 0x1A; 
    unsigned int i = 0,j = 0;
    
    TXSTA2bits.TXEN = 1;// Activate Transmission
    TXSTA2bits.SYNC = 0;//Asynchronus full duplex
    RCSTA2bits.SPEN = 1; // To activate serial port (Tx and Rx pins)
    RCSTA2bits.CREN = 1; // Activate Reception
    
    
     
 while(1){ 
         Init_Delay();Init_Delay();Init_Delay();Init_Delay();Init_Delay();
                             
         Open2USART(USART_TX_INT_OFF | USART_RX_INT_OFF | USART_ASYNCH_MODE | USART_EIGHT_BIT | USART_CONT_RX | USART_BRGH_LOW,  207);        
 
         baud2USART (BAUD_8_BIT_RATE | BAUD_AUTO_OFF);
         Init_Delay();   //1 sec delay
 
        while(Busy2USART());  
 
        UART2_Write_Text(Command_AT);
        
        Init_Delay();   //1 sec delay
        UART2_Write_Text(Command_CMGF);
        Init_Delay();Init_Delay();   //2 sec delay
        UART2_Write_Text(Command_CMGS);
        Init_Delay();Init_Delay();Init_Delay();Init_Delay();Init_Delay();   //5 sec delay
        UART2_Write_Text(msg01);
        Init_Delay();   //0.3 sec delay
        Write2USART(CtrlZ);
        Write2USART(13);
        Write2USART(10);     
        
 }   
}
 

You can't simulate without modem but you can see the commands the micro sends to modem even if there is no modem. If you want to see modem responses then connect modem to COM port or USB port if you have one then use Virtual Serial Port Emulator and create a Mapper device and Map your COM port to Virtusl USB port like COM16 or whichever port your USB port is. Then in Proteus add COMPIM and set baudrate of COMPIM to modem baudrate. Now add two Virtual Terminal to Proteus and connect RxD pin of one VT to Tx pin of micro and another VT's RXD pin to RxD pin of COMPIM that is actually you connect RxD pin of VT's to TxD and RxD pins of COMPIM so that you can see both sent and received data on VT.
 
  • Like
Reactions: ADGAN

    ADGAN

    Points: 2
    Helpful Answer Positive Rating
Thanks for the reply, if I only want to see the send commands without getting the received response, how do I do that?
 

Done but nothing displays on VT so I'm guessing something must be wrong with the code.
 

Zip and post your project files and Proteus file. I will test it and try to fix the problem.


Edit: Have you included the lib file of the device while Compiling?
 
Last edited:

Hi , I'm doing SMS based switch . I am using wavecom gsm modem , Atmega328P . I used compim to connect modem in Proteus . I can send sms . But my problem is that I cant read anything from modem , RXD of compim doesn't work . Pls give me any idea how to solve it . I checked gsm modem with USART terminal of mikroC pro for avr , and every thing works fine , I can send sms , read sms . But when I tried to simulate I couldnt read anything .2.jpgcompim properties.jpgvirtual serial port emulator.jpg
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top