Autor Tema: problemas con placa mc wireless kit gsm- GSM900D  (Leído 2455 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado esteban_pic

  • PIC10
  • *
  • Mensajes: 21
problemas con placa mc wireless kit gsm- GSM900D
« en: 11 de Diciembre de 2012, 19:48:58 »
Hola a todos, yo compre una placa "mc wireless kit gsm" esta placa consta de un pic 18f14k50 y un modulo gsm SIM900D, yo trato de comunicar el pic con el modulo gsm con programacion en C18, yo tengo los ejemplos dados por el fabricante de la placa programados en CCS, y lo traduje a c18, pero no logro comunicacion con el modulo, alguien me puede ayudar, adjunto el codigo, el pic reponde a mi codigo y realiza las acciones deasadas cundo preciono algun pulsador, pero me falla la comunicacion pic/Gsm, hace varios dias ya que vengo con este inconveniente y no logro darle solucion:

                                            desde ya les agradesco de antemano!!!!!   :-/ :-/ :-/ :-/ saludos, esteban!!!

Código: C
  1. #include <p18f14k50.h>
  2. #include <delays.h>
  3. #include <portb.h>
  4. #include <usart.h>
  5. #include <io.h>
  6. #include <adc.h>
  7.  
  8.  
  9.  
  10.  
  11. #pragma config FOSC = XT,FCMEN = ON,IESO = OFF //,  PLLDIV=1  //CPUDIV = OSC1_PLL,
  12.  
  13.  
  14. //FOSC = XT_XT XT oscillator (XT), segundo XT usado por USB  
  15.  
  16. //FCMEN = OFF
  17. //Fail-Safe Clock Monitor Enable bit:
  18. // FCMEN = OFF  Fail-Safe Clock Monitor disabled  
  19.  
  20. //Internal/External Oscillator Switchover bit:
  21. // IESO = OFF  Oscillator Switchover mode disabled
  22.  
  23.  
  24. //System Clock Postscaler Selection bits:
  25. //CPUDIV = OSC1_PLL2    [Primary Oscillator Src: /1][96 MHz PLL Src: /2]
  26.  
  27.  
  28.  
  29.  
  30. //INTERRUPCIONES:
  31.  
  32.  
  33. # pragma code Prioridad_normal= 0x0008
  34.  
  35.  
  36. void Prioridad_normal(){  //interrupcion de baja interrupcion    
  37.  
  38.  
  39. }
  40.  
  41. # pragma code
  42.  
  43. /// FIN INTERRUPCIONES
  44.  
  45.  
  46.  
  47. #pragma config PWRTEN = ON, BOREN = OFF //, BORV = 1.9V
  48.  
  49.  
  50. //Power-up Timer Enable bit:
  51. //PWRT = ON     PWRT enabled
  52.  
  53.  
  54. //Brown-out Reset Enable bits:
  55. //BOR = OFF     Brown-out Reset disabled in hardware and software
  56.  
  57.  
  58. //Brown-out Reset Voltage bits:
  59. //BORV = 0      Maximum setting
  60.  
  61.  
  62.  
  63.  
  64. #pragma config WDTEN = OFF,WDTPS = 32768
  65.  
  66.  
  67. //Watchdog Timer Enable bit:
  68. //WDT = OFF     WDT disabled (control is placed on the SWDTEN bit)
  69.  
  70.  
  71. //Watchdog Timer Postscale Select bits:
  72. //WDTPS = 32768 1:32768  
  73.  
  74.  
  75. #pragma config MCLRE = OFF //, CCP2MX = OFF  //LPT1OSC = OFF, PBADEN = OFF,
  76.  
  77. //MCLR Pin Enable bit:
  78. //MCLRE = OFF   RE3 input pin enabled; MCLR pin disabled
  79. //MCLRE = ON    MCLR pin enabled; RE3 input pin disabled
  80.  
  81.  
  82. //Low-Power Timer 1 Oscillator Enable bit:
  83. //LPT1OSC = OFF Timer1 configured for higher power operation
  84.  
  85.  
  86. //PORTB A/D Enable bit:
  87. //PBADEN = OFF  PORTB<4:0> pins are configured as digital I/O on Reset
  88.  
  89.  
  90. //CCP2 MUX bit:
  91. //CCP2MX = OFF  CCP2 input/output is multiplexed with RB3
  92.  
  93.  
  94.  
  95.  
  96. #pragma config STVREN = OFF,LVP = OFF,XINST = OFF,DEBUG = OFF
  97.  
  98. //Stack Full/Underflow Reset Enable bit:
  99. //STVREN = OFF  Stack full/underflow will not cause Reset
  100.  
  101.  
  102. //Extended Instruction Set Enable bit:
  103. //XINST = OFF   Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
  104.  
  105.  
  106. //DEBUG = OFF  ¿?
  107.  
  108.  
  109.  
  110.  
  111. #pragma config CP0 = ON,CP1 = ON //,CP2 = ON
  112.  
  113.  
  114. //Code Protection bit:
  115. //CP0 = ON      Block 0 (000800-001FFFh) is code-protected
  116. //CP0 = OFF     Block 0 (000800-001FFFh) is not code-protected
  117.  
  118.  
  119. //Code Protection bit:
  120. //CP1 = ON      Block 1 (002000-003FFFh) is code-protected
  121. //CP1 = OFF     Block 1 (002000-003FFFh) is not code-protected
  122.  
  123. //Code Protection bit:
  124. //CP2 = ON      Block 2 (004000-005FFFh) is code-protected
  125. //CP2 = OFF     Block 2 (004000-005FFFh) is not code-protected
  126.  
  127.  
  128.  
  129.  
  130. #pragma config CPB = OFF,CPD = OFF
  131.  
  132. //Boot Block Code Protection bit:
  133. //CPB = ON      Boot block (000000-0007FFh) is code-protected
  134. //CPB = OFF     Boot block (000000-0007FFh) is not code-protected
  135.  
  136.  
  137. //Data EEPROM Code Protection bit:
  138. //CPD = ON      Data EEPROM is code-protected
  139. //CPD = OFF     Data EEPROM is not code-protected
  140.  
  141.  
  142.  
  143. #pragma config WRT0 = ON,WRT1 = ON //,WRT2 = ON
  144.  
  145.  
  146. //Write Protection bit:
  147. //WRT0 = ON     Block 0 (000800-001FFFh) is write-protected
  148. //WRT0 = OFF    Block 0 (000800-001FFFh) is not write-protected
  149.  
  150. //Write Protection bit:
  151. //WRT1 = ON     Block 1 (002000-003FFFh) is write-protected
  152. //WRT1 = OFF    Block 1 (002000-003FFFh) is not write-protected
  153.  
  154.  
  155. //Write Protection bit:
  156. //WRT2 = ON     Block 2 (004000-005FFFh) is write-protected
  157. //WRT2 = OFF    Block 2 (004000-005FFFh) is not write-protected
  158.  
  159.  
  160.  
  161. #pragma config WRTB = ON,WRTC = ON,WRTD = ON
  162.  
  163. //Boot Block Write Protection bit:
  164. //WRTB = ON     Boot block (000000-0007FFh) is write-protected
  165. //WRTB = OFF    Boot block (000000-0007FFh) is not write-protected
  166.  
  167.  
  168. //Configuration Register Write Protection bit:
  169. //WRTC = ON     Configuration registers (300000-3000FFh) are write-protected
  170. //WRTC = OFF    Configuration registers (300000-3000FFh) are not write-protected
  171.  
  172.  
  173. //Data EEPROM Write Protection bit:
  174. //WRTD = ON     Data EEPROM is write-protected
  175. //WRTD = OFF    Data EEPROM is not write-protected
  176.  
  177.  
  178.  
  179.  
  180. #pragma config EBTR0 = ON,EBTR1 = ON //,EBTR2 = ON
  181.  
  182. //Table Read Protection bit:
  183. //EBTR0 = ON    Block 0 (000800-001FFFh) is protected from table reads executed in other blocks
  184. //EBTR0 = OFF   Block 0 (000800-001FFFh) is not protected from table reads executed in other blocks
  185.  
  186.  
  187.  
  188. //Table Read Protection bit:
  189. //EBTR1 = ON    Block 1 (002000-003FFFh) is protected from table reads executed in other blocks
  190. //EBTR1 = OFF   Block 1 (002000-003FFFh) is not protected from table reads executed in other blocks
  191.  
  192.  
  193. //Table Read Protection bit:
  194. //EBTR2 = ON    Block 2 (004000-005FFFh) is protected from table reads executed in other blocks
  195. //EBTR2 = OFF   Block 2 (004000-005FFFh) is not protected from table reads executed in other blocks
  196.  
  197.  
  198. #pragma config EBTRB = ON
  199.  
  200.  
  201. //Boot Block Table Read Protection bit:
  202. //EBTRB = ON    Boot block (000000-0007FFh) is protected from table reads executed in other blocks
  203. //EBTRB = OFF   Boot block (000000-0007FFh) is not protected from table reads executed in other blocks
  204.  
  205.  
  206.  
  207. int i;  //Para contar 0 titilaciones.-
  208.  
  209. int anda=0;
  210.  
  211. int velocidad=5;
  212.  
  213. int total=200;
  214.  
  215. int parcial=5;
  216.  
  217. int iii=0;
  218.  
  219. int ioo=0;
  220.  
  221.  char ch='a';
  222.  
  223. char armado[40]; //armado
  224.  
  225.  
  226. // ADC
  227.  
  228. unsigned char unidad=0, decena=0, centena=0;
  229. unsigned int conversion=0;
  230. unsigned char x= 10;
  231. unsigned char muestras =0;
  232. unsigned int M0=0;  
  233.  
  234.  
  235.  
  236. //fin adc
  237.  
  238.  
  239.  
  240.  
  241.  
  242. //  45  0º
  243.  
  244. //  245 180º
  245.  
  246.  
  247.  
  248. /*
  249.  
  250. ClosePORTB  CloseRBxINT  OpenPORTB  OpenRBxINT
  251. Disable the interrupts
  252. and internal pull-up
  253. resistors for PORTB.
  254. Disable the interrupts for
  255. the specified INTx pin.
  256. Configure the interrupts and internal pullup resistors on PORTB.
  257. Enable interrupts for the specified INTx
  258. pin.
  259. void ClosePORTB( void );  void CloseRB0INT( void );
  260. void CloseRB1INT( void );
  261. void CloseRB2INT( void );
  262. void OpenPORTB( unsigned char config); void OpenRB0INT( unsigned char config );
  263. void OpenRB1INT( unsigned char config );
  264. void OpenRB2INT( unsigned char config );
  265.  
  266.  
  267. */
  268.  
  269.  
  270.  
  271.  
  272. // ssc a c18
  273.  
  274. void inicializacionSIM900(void){
  275.  
  276. //LOS DELAY CALCULADOS PARA
  277. // 12 MGHZ  
  278.  
  279.    int cont;
  280.    Delay10KTCYx(150);   //delay_ms(1000);
  281.    Delay10KTCYx(150);
  282.  
  283. //Delay10KTCYx(i)   -> 10000.Tcy.i    genera
  284. // una demora de 10000 ciclos de instrucciones  * i
  285.  
  286.    putrsUSART((const far rom char *)"A\n\r");//puts("A",SERIAL_SIM900); //para sincronizar el baudrate del SIM 900
  287.  
  288.    Delay10KTCYx(100); // delay_ms(300);
  289.  
  290.    putcUSART(0x0d); // putchar(0x0d,SERIAL_SIM900);
  291.  
  292.    Delay10KTCYx(150);   //delay_ms(1000);
  293.    Delay10KTCYx(150);
  294.  
  295.  
  296.  
  297.    for(cont=0;cont<5;cont++)              // mando varios AT para el autobauding
  298.          {
  299.          putrsUSART((const far rom char *)"AT\n\r"); // puts("AT",SERIAL_SIM900);
  300.  
  301.         Delay10KTCYx(80);   // delay_ms(200);
  302.  
  303.          putcUSART(0x0d); //putchar(0x0d,SERIAL_SIM900);
  304.  
  305.          Delay10KTCYx(80); //delay_ms(200);
  306.          LATCbits.LATC6=1; //PIN_ON(LED1);
  307.          LATCbits.LATC7=0;
  308.          Delay10KTCYx(80); //delay_ms(200);
  309.          LATCbits.LATC6=0; // PIN_OFF(LED1);
  310.          LATCbits.LATC7=1;
  311.          }
  312. //-----------------------------------seteos de configuracion del SIM900------------------------        
  313.     putrsUSART((const far rom char *)"AT+CMGF=1\n\r"); // puts("AT+CMGF=1\r",SERIAL_SIM900);                  // configuro para que trabaje en modo texto y no PDU
  314.    Delay10KTCYx(40); //delay_ms(100);
  315.    putcUSART(0x0d); //putchar(0x0d,SERIAL_SIM900);
  316.    Delay10KTCYx(40); //delay_ms(100);
  317.  
  318.   LATCbits.LATC6=0; // PIN_OFF(LED1);
  319.          LATCbits.LATC7=0;
  320.  
  321.  
  322.    //return;
  323. }  
  324.  
  325.  
  326. void lectura_ADC(void){  
  327.  
  328.   unsigned resto=0;  
  329.  
  330.   ConvertADC();                      // Comienza la conversion
  331.  
  332.   while (BusyADC()==1){}         // Espera que finalice la conversion
  333.    
  334.     conversion= ReadADC()>>2; // Guarda el estado del conversor en conversion
  335.  
  336.     M0 = M0 + conversion;           // y suma en M0 las conversiones para  
  337.    
  338.     muestras++;                        // promediarlas cuando se tomen 50 muestras
  339.  
  340.     if(muestras == 50){
  341.      
  342.       conversion = M0/50;             // Se busca el promedio de las 50 muestras
  343.      
  344.       centena = conversion / 100;  // Se define la centena
  345.      
  346.       resto = conversion % 100;    // Recupera el resto de la div.
  347.      
  348.       decena = resto /10;             // Se define la decena
  349.      
  350.       unidad = resto % 10;           // El resto es la unidad    
  351.    
  352.       M0 = 0;
  353.      
  354.       muestras =0;
  355.    }
  356.  }
  357.  
  358.  
  359.  
  360.  
  361.  
  362. void main(void){
  363.  
  364.  
  365.  
  366. /*
  367.     FAQ-4 Why is “Warning [2066] type qualifier mismatch in assignment” being issued?
  368.     The libraries distributed with MPLAB C18 are compiled using the large code model
  369. (-ml command-line option). By default, MPLAB IDE and the compiler compile applications
  370. for the small code model. For example, the printf function distributed with the compiler
  371. expects to receive a “const far rom char *”, but the application is actually sending a
  372. “const near rom char *” to the printf function when the large code model is not selected
  373. for the application. This difference between far and near is causing the “type qualifier
  374.  mismatch in assignment” warning. To get rid of these
  375.     warnings, do one of three things:
  376.  
  377.         1. Recompile the libraries distributed with MPLAB C18 using the small code model
  378.         (only recommended if all applications will be using the small code model);
  379.         2. Enable the large code model in the IDE for the particular application (may
  380.         increase code size);
  381.         3. Cast the constant character string to a constant far rom character pointer, as in:
  382.         printf ((const far rom char *)”This is a test\n\r”);
  383.  
  384.  
  385. */
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398. ADCON0=0x0F;
  399. ADCON1=0x0F;//Todos entrada/salida digitales.-
  400. ADCON2=0x0F;
  401.  
  402.  
  403.  
  404. //-------Configurar puerto c
  405.  
  406.  
  407. ANSEL=0x00;  // Todo digital
  408.  
  409.  
  410.  
  411. /*ANSEL
  412.  
  413. bit 7 ANS7: RC3 Analog Select Control bit
  414. 1 = Digital input buffer of RC3 is disabled
  415. 0 = Digital input buffer of RC3 is enabled
  416. bit 6 ANS6: RC2 Analog Select Control bit
  417. 1 = Digital input buffer of RC2 is disabled
  418. 0 = Digital input buffer of RC2 is enabled
  419. bit 5 ANS5: RC1 Analog Select Control bit
  420. 1 = Digital input buffer of RC1 is disabled
  421. 0 = Digital input buffer of RC1 is enabled
  422. bit 4 ANS4: RC0 Analog Select Control bit
  423. 1 = Digital input buffer of RC0 is disabled
  424. 0 = Digital input buffer of RC0 is enabled
  425. bit 3 ANS3: RA4 Analog Select Control bit
  426. 1 = Digital input buffer of RA4 is disabled
  427. 0 = Digital input buffer of RA4 is enabled
  428. bit 2-0 Unimplemented: Read as ‘0’
  429.  
  430. */
  431.  
  432.  
  433. ANSELH=0x00;  // Todo digital
  434.  
  435.  
  436. /*
  437.  
  438. ANSELH
  439.  
  440. bit 7-4 Unimplemented: Read as ‘0’
  441. bit 3 ANS11: RB5 Analog Select Control bit
  442. 1 = Digital input buffer of RB5 is disabled
  443. 0 = Digital input buffer of RB5 is enabled
  444. bit 2 ANS10: RB4 Analog Select Control bit
  445. 1 = Digital input buffer of RB4 is disabled
  446. 0 = Digital input buffer of RB4 is enabled
  447. bit 1 ANS9: RC7 Analog Select Control bit
  448. 1 = Digital input buffer of RC7 is disabled
  449. 0 = Digital input buffer of RC7 is enabled
  450. bit 0 ANS8: RC6 Analog Select Control bit
  451. 1 = Digital input buffer of RC6 is disabled
  452. 0 = Digital input buffer of RC6 is enabled
  453.  
  454. */
  455.  
  456.  
  457.  
  458.  
  459. PORTC=0X00;     //IMPORTANTE
  460.  
  461.  
  462. TRISC=0X0f;     //como salidas/entradas
  463.  
  464.  
  465. /*
  466.  
  467. SSPCON1=0x00;
  468.  
  469. T1CON=0x00;
  470.  
  471.  
  472. T3CON=0x00;
  473.  
  474.  
  475. CCP1CON=0x00;
  476.  
  477. ECCP1AS=0x00;  
  478.  
  479. */
  480.  
  481.  
  482.  
  483.  
  484.  
  485. TRISA=0xFF; //Todos como entrada
  486.  
  487. TRISB=0XFF;     //Todos como entrada
  488.  
  489. //USBEN=0;
  490.  
  491.  
  492.  
  493. LATCbits.LATC4=0;
  494. LATCbits.LATC6=0;
  495. LATCbits.LATC7=0;
  496.  
  497.  
  498. //LATC=0x00; //Leds apagados
  499.  
  500. //RCON= 0X00; // IPEN=0
  501.  
  502. //INTCON=0x88; // INTERRUPCIONES POR CAMBIO RB4-RB7
  503.  
  504. //INTCON2=0X00; // habilitar LOS PULL-UP
  505. INTCON2=0X80; // DEShabilitar LOS PULL-UP
  506.  
  507.  
  508.  Delay10KTCYx(150);   //delay_ms(1000);
  509.  Delay10KTCYx(150);
  510.  Delay10KTCYx(150);   //delay_ms(1000);
  511.  Delay10KTCYx(150);
  512.  Delay10KTCYx(150);   //delay_ms(1000);
  513.  Delay10KTCYx(150);
  514.  Delay10KTCYx(150);   //delay_ms(1000);
  515.  Delay10KTCYx(150);
  516.  Delay10KTCYx(150);   //delay_ms(1000);
  517.  Delay10KTCYx(150);
  518.  Delay10KTCYx(150);   //delay_ms(1000);
  519.  Delay10KTCYx(150);
  520.  Delay10KTCYx(150);   //delay_ms(1000);
  521.  Delay10KTCYx(150);
  522.  Delay10KTCYx(150);   //delay_ms(1000);
  523.  Delay10KTCYx(150);
  524.  Delay10KTCYx(150);   //delay_ms(1000);
  525.  Delay10KTCYx(150);
  526.  Delay10KTCYx(150);   //delay_ms(1000);
  527.  Delay10KTCYx(150);
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543. //-----------------COMUNICACION SERIE------------------------------
  544.  
  545. //1) pongo como salida RB7 TX y RB5 RX
  546.  
  547. TRISB=0;
  548.  
  549. PORTB=0;  //IMPORTANTE digitalizo
  550.  
  551. //2) abrir comunicacion serie
  552.  
  553.        OpenUSART(USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE &
  554.                  USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_LOW, 19);
  555.  
  556. /*
  557.  
  558. OpenUSART(USART_TX_INT_OFF interrupcion de transmicion TX apagada
  559.  
  560. & USART_RX_INT_OFF interrupcion de transmicion RX apagada
  561.  
  562. & USART_ASYNCH_MODE modo asyncrono
  563.  
  564. & USART_EIGHT_BIT trbaja respcion trnsmicion  en 8 bits
  565.  
  566. & USART_CONT_RX modo de recepsion continuo
  567.  
  568. & USART_BRGH_LOW, low baud rate
  569.  
  570. 129);  
  571.  
  572.  
  573. // el numero se llama SPBRG
  574.  
  575. [8000000/(4800*16)] - 1 = 103
  576.  
  577. 1000000/ (1200*8) -1=
  578.  
  579.  
  580. */
  581.  
  582.  
  583.  
  584.  
  585. //-----------------INICIALIZO MODULO SIM900D------------------------
  586.  
  587.  
  588. //1) devo encender el modulo sim con el powerkey, dado como diseñada
  589. // la placa devo enviar el puso mediante el pin c4, `reviamente configurado
  590. // como salida.
  591.  
  592.  
  593. //LATCbits.LATC4=1;
  594.  
  595. //Delay10KTCYx(150);   //delay_ms(1000);
  596. //Delay10KTCYx(150);
  597.  
  598.  LATCbits.LATC4=1;
  599.  
  600.  Delay10KTCYx(150);   //delay_ms(1000);
  601.  
  602.  Delay10KTCYx(150);   //delay_ms(1000);
  603.  
  604.  Delay10KTCYx(150);   //delay_ms(1000);
  605.  
  606.  Delay10KTCYx(150);   //delay_ms(1000);
  607.  
  608. LATCbits.LATC4=0;
  609.  
  610.  
  611.  
  612.  Delay10KTCYx(150);
  613.  Delay10KTCYx(150);   //delay_ms(1000);
  614.  Delay10KTCYx(150);
  615.  Delay10KTCYx(150);   //delay_ms(1000);
  616.  Delay10KTCYx(150);
  617.  
  618.  
  619. //LATCbits.LATC4=1;
  620.  
  621.  
  622.    
  623.  
  624.  
  625.  
  626. //2) Llamo al iniciador del sim 900d
  627.  
  628.  
  629. inicializacionSIM900();
  630.  
  631.  
  632.  
  633. //---------------------------------------------------------------------------------
  634.  
  635. while(1){
  636.  
  637. LATCbits.LATC7=0;
  638.  
  639.  
  640.  for(i=1;i<=5;++i){//Titila 5 veces
  641.  
  642.              LATCbits.LATC7=1;
  643.              LATCbits.LATC6=1;
  644.              Delay10KTCYx(150);
  645.  
  646.              LATCbits.LATC7=0;
  647.              LATCbits.LATC6=0;
  648.              Delay10KTCYx(150);
  649. }
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658. if(PORTCbits.RC3==0){  // led c7 envio sms
  659.         LATCbits.LATC7=1;
  660.  
  661.  
  662.  
  663.  
  664. /*
  665.         canal10=readADC();
  666.  
  667. putrsUSART("canal 0= ");
  668. itoa(canal10 . String); //convierto entero a string
  669. putsUSART(String);
  670. putrsUSART("\r");
  671. */
  672.  
  673.  
  674. /*
  675. Nombre completo              Constante en C    ASCII
  676. sonido de alerta BEL               \a             7
  677. nueva línea NL                     \n             10
  678. tabulador horizontal HT            \t             9
  679. retroceso BS                       \b             8
  680. retorno de carro CR                \r             13
  681. salto de página FF                 \f             12
  682. barra invertida \                  \\             92
  683. apóstrofo '                        \'             39
  684. comillas "                         \"             34
  685. carácter nulo NULL                 \0             0
  686.  
  687. */
  688.  
  689.  
  690.  
  691.  
  692. //Para mandar sms via comandos AT:
  693.  
  694.  
  695. //putrsUSART("AT+CMGF=1\r");
  696.  
  697.  
  698. inicializacionSIM900();
  699.  
  700.  
  701. Delay10KTCYx(150);
  702. Delay10KTCYx(150);
  703. Delay10KTCYx(150);
  704. Delay10KTCYx(150);
  705.  
  706.  
  707.  
  708.     // putrsUSART( "AT+CMGS=\"336154627096\"\r");
  709.  
  710.  
  711. //putrsUSART( fprintf( "AT+CMGS=\"336154627096\"\r"));
  712.  
  713.  
  714.  
  715.  
  716. //fprintf( "AT+CMGS=\"336154627096\"\r");
  717.  
  718.  
  719.  
  720.  
  721.  Delay10KTCYx(120); //delay_ms(300);
  722.  
  723.   //    putrsUSART( "\r");
  724.              
  725.  
  726.  
  727.  
  728.  
  729. Delay10KTCYx(120); //delay_ms(300);
  730.  
  731.  
  732. putrsUSART((const far rom char *)"ATD336154627096;\r");
  733. //putrsUSART("\r");
  734.  
  735.  
  736.  
  737.  
  738.        
  739. }// fin led c7
  740.  
  741.  
  742. if(PORTCbits.RC2==0){ // led c6
  743.  
  744.   LATCbits.LATC7=1;
  745.  
  746.     //    putrsUSART((const far rom char *)"ATD336154627096;\n\r");
  747.  
  748. putrsUSART((const far rom char *)"ATD336154627096;\n");
  749.         //putrsUSART( "\r");
  750.  
  751.         //putrsUSART("AT+CPOWD=1");
  752.  
  753.         Delay10KTCYx(150);   //delay_ms(1000);
  754.  
  755. Delay10KTCYx(150);   //delay_ms(1000);
  756. Delay10KTCYx(150);   //delay_ms(1000);
  757.      
  758.  
  759.  
  760. }// fin led c6
  761.  
  762.  
  763.  
  764. }  // fin while(1)
  765.  
  766.  
  767.  
  768.  
  769. //---------------------------------------------------------------------------------
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777. /*
  778.  
  779. spbrg
  780. This is the value that is written to the baud rate generator register which
  781. determines the baud rate at which the USART operates. The formulas
  782. for baud rate are:
  783. Asynchronous mode, high speed:
  784.       FOSC / (16 * (spbrg + 1))
  785. Asynchronous mode, low speed:
  786.       FOSC / (64 * (spbrg + 1))
  787. Synchronous mode:
  788.       FOSC / (4 * (spbrg + 1))
  789. Where FOSC is the oscillator frequency
  790.  
  791.  
  792. */
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799. /*
  800.  while(1){  // inicio while usart
  801.     if (DataRdyUSART()){
  802.       //ch = get_byte();
  803.      // send_byte(ch+1);
  804.      // send_byte(0x0D);
  805.      // send_byte(0x0A);
  806.      putrsUSART( "Hello World!" );
  807.  
  808.  
  809.      // PORTB++;
  810.      }// fin if
  811.  
  812. LATCbits.LATC1=1;
  813.  
  814. putrsUSART( "Hola Esteban!!!" );
  815.             Delay10KTCYx(200);
  816.  
  817.  
  818. LATCbits.LATC1=0;
  819.  
  820.  
  821.    } // fin while usart
  822. */
  823.  
  824. // importante comunicacion serie
  825.  
  826.  
  827.  
  828. }// Fin Main



« Última modificación: 28 de Diciembre de 2012, 12:08:47 por Suky, Razón: Colocación de Geshi a código »

Desconectado esteban_pic

  • PIC10
  • *
  • Mensajes: 21
Re: problemas con placa mc wireless kit gsm- GSM900D
« Respuesta #1 en: 11 de Diciembre de 2012, 19:50:20 »
me olvide el cristal es de 12 mghz!!!!

Desconectado CHELOXR

  • PIC10
  • *
  • Mensajes: 3
Re: problemas con placa mc wireless kit gsm- GSM900D
« Respuesta #2 en: 28 de Diciembre de 2012, 02:08:23 »
me olvide el cristal es de 12 mghz!!!!

revisá esta línea  putrsUSART((const far rom char *)"A\n\r");//puts("A",SERIAL_SIM900); //para sincronizar el baudrate del SIM 900
yo uso esto:

putrsUSART ("ATE0\r"); //Autobauding and ECHO OFF

Espero te sirva!

Desconectado Suky

  • Moderador Local
  • DsPIC33
  • *****
  • Mensajes: 6758
Re: problemas con placa mc wireless kit gsm- GSM900D
« Respuesta #3 en: 28 de Diciembre de 2012, 12:13:36 »
me olvide el cristal es de 12 mghz!!!!

revisá esta línea  putrsUSART((const far rom char *)"A\n\r");//puts("A",SERIAL_SIM900); //para sincronizar el baudrate del SIM 900
yo uso esto:

putrsUSART ("ATE0\r"); //Autobauding and ECHO OFF

Espero te sirva!

Eso no es  el problema.

Lo que si no se porque el cast, si la función recibe como puntero un string en ROM, solo usaría putrsUSART("A\n\r");

Después, estoy seguro que la empresa tiene código fuente en C18, que hay que revisar, pero podría ayudarte. Consúltales  ;-)

También te recomiendo que leas este hilo para guiarte de como trabajar con el modulo: Telecontrol GSM - Desarrollo de proyectos


Saludos!
No contesto mensajes privados, las consultas en el foro