Pic18F4550 + SIMCOM SIM900D GSM/GPRS


Results 1 to 39 of 39

Threaded View

  1. #1
    Join Date
    Jun 2011
    Location
    Philippines
    Posts
    223

    Default Pic18F4550 + SIMCOM SIM900D GSM/GPRS

    Hello to everyone,
    I have a SIMCOM SIM900D GSM/GPRS module. I'm trying to make it communicate with the Pic18F4550 with 20Mhz crystal. But before that I made sure that the module is working/replying to AT commands by connecting it the serial port communicator via USB - TTL converter. And I confirmed that PC(Serial communicator) -> USB-TTL converter + GSM(Baud 115200) module are working.
    Name:  GSM-usbttl.png
Views: 16677
Size:  77.4 KB

    Then the next step I did is to try to send HSEROUT ["AT",13] to the GSM module..using hardware setup below
    Name:  GSM-LABX2.png
Views: 10592
Size:  126.2 KB
    and this is the code I'm using...
    Code:
     asm
        __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
        __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
        __CONFIG    _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L  & _BORV_2_2L  & _VREGEN_ON_2L   
        __CONFIG    _CONFIG2H, _WDT_OFF_2H 
        __CONFIG    _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_ON_3H 
        __CONFIG    _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_OFF_4L  & _XINST_OFF_4L & _DEBUG_OFF_4L 
    endasm
    
            
            DEFINE OSC 48
            DEFINE HSER_RCSTA 90h ' enable serial port, 
            DEFINE HSER_TXSTA 36  ' enable transmit, * we change 20h to 36 for 115200          
            DEFINE HSER_BAUD 115200
            DEFINE HSER_CLOERR  1 ' automatic clear overrun error  
            
            TRISC  = %10000000    ' PORTC.7 is the RX input, PORTC.6 is the TX output
                                  
        
        '   Serial communication definition
        '   ===============================
            '
    ADCON1 = %00001111      'Set up ADCON1 register no matter what you're doing!!!!!!
    '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    
    INCLUDE "MODEDEFS.BAS"       ' Include Shiftin/out modes
    
    
    '*****************************************************************************     
    
    
    
    
    Serialdata var    byte
    
    INTCON2.7 = 0        ' Enable PORTB pull-ups
    TRISB = %11111000
    TRISC = %10000000
    led1 var PortC.0
    TRISD = %00000000
    
     
    Serout2 PORTD.5, 84, [$1B,$63,$30]  'cursor off for serial LCD
    Serout2 PORTD.5, 84, [$1B,$45,"SMS DEBUG PORT"]   ' serial LCD
    main:
    PORTB = 0            ' PORTB lines low to read buttons
    
       If PORTB.4 = 0 Then ' If 1st button pressed...
         
          HSEROUT ["Button 1",13]
          Serout2 PORTD.5, 84, [$1B,$45, "SMS DEBUG PORT"]
          Serout2 PORTD.5, 84, [$D, "Button 1 "]
          pause 500
          Serout2 PORTD.5, 84, [$1B,$45,"SMS DEBUG PORT"]
          gosub GSM_CHECK 
       Endif
       pause 200   ' pause to avoid sending repetation
    
    goto main
    
    End   'End program
    
    
    GSM_CHECK:
    HSEROUT ["AT",13]                    'Send AT to modem followed by a CR
    HSERIN 5000, GSM_CHECK_ERR, [WAIT("OK")] 'Check OK reply, wait 5sec max.
    Serout2 PORTD.5, 84, [$D, "GSM OK"]
    High PORTB.0     ' 1st LED on
    PAUSE 1000
    low PORTB.0
    return
    
     GSM_CHECK_ERR:
     Serout2 PORTD.5, 84, [$D, "GSM ERROR"]   
     
     ;HSEROUT ["GSM_ERROR",13]
     Return
    I tried to interchange C6 and C7 lines but still I'm not getting "OK" response...hope anyone can give a me hint what I'm missing in my setup.

    Thanks in advance,
    tacbanon
    Last edited by tacbanon; - 14th July 2012 at 00:31.

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