GSM-TC35 + PIC16F877A + SK40C

Bluetooth, XBee, RF......

GSM-TC35 + PIC16F877A + SK40C

Postby vinctal910713 » Wed Mar 26, 2014 5:43 pm

Hi,

i was having problem with the gsm. i have built the program given but cytron tutorial. but the gsm was unable to make call and sms.
the gsm modem was able to in ready mode when did not connect to the pic.
once i connect the pic via sk40c. when i turn on my pic power, about after 30 sec the gsm yellow light will be blinking(not in ready mode)
i just modify the given program sw1 and sw2 from rc0 and rc1 change to rb0 and rb1. and then change the number of calling. when i turn on the power. gsm is able to function in ready mode.

once i press sw1(RB0) the yellow indicator keep on blinking.

please refer the the program code.
CODE: SELECT_ALL_CODE
 /*******************************************************************************
* This is the main program for GSM MODEM TC35 using SK40C to control
*
* Author: ANG JIA YI @ Cytron Technologies Sdn. Bhd.
*******************************************************************************/
// GSM modem TC35 with PIC16F877A
// This template C file should be compiled with:
// MPLAB IDE v8.63
// HI-TECH C for the PIC10/12/16 MCU Family
// HI-TECH operate in LITE Mode with v9.80
// Last Updated date: 1 July 2012
// Please email support@cytron.com.my if you have any problem

#include <htc.h>      //include hitech C header file
#include "system.h"      //include system header file for PTK40A
#include "uart.h"      //include uart header file, to enable the functions of uart
#include "lcd.h"      //include lcd header file, to enable the functions of lcd
__CONFIG (FOSC_HS & WDTE_OFF & PWRTE_ON & BOREN_OFF & LVP_OFF); // This is the setting for PIC16F877A

#define _XTAL_FREQ 20000000 //This is the preprocessor directive which is define the frequency to 2MHz

/*******************************************************************************
* Defination of label                                                        *
*******************************************************************************/
#define sw1    RB0
#define sw2      RB1
#define sw3      RC2
#define sw4    RC3
#define   sw5    RC4

/*******************************************************************************
* PRIVATE FUNCTION PROTOTYPES                                                  *
*******************************************************************************/
void delay_ms(unsigned int ui_value);
void beep(unsigned char uc_count);

/*******************************************************************************
* Global Variables                                                             *
*******************************************************************************/

/*******************************************************************************
* MAIN FUNCTION                                                                *
*******************************************************************************/
int main(void)
{
   unsigned char a=0;
   unsigned char mode = 0;
   // ensure all the hardware port in zero initially
   PORTA = 0;
   PORTB = 0;
   PORTC = 0;
   PORTD = 0;
   PORTE = 0;

   // Initialize the I/O port direction, this must be configured according to circuit
   // please refer to PTK40A schematic for details
   // TRISX control pin direction, output pin must be configure as '0'
   // while input must be configure as '1'
   TRISA = 0b00010001;
   TRISB = 0b00001111;
   TRISC = 0b10011111;
   TRISD = 0;
   TRISE = 0;


   //Initialize LCD
   lcd_initialize(); //to ensure the Uart modlue is properly configured to be used
   
   //Initialize UART
   uart_initialize(); //to ensure the Uart modlue is properly configured to be used
   
   // GSM modem are widely use in our daily life. FOr example for cellphone
   // GSMn also be use to contol the contoller to do what ever we want to do
   // GSM is a good long range device to contol the thing we needed to control
   
   lcd_clear();
   lcd_putstr("   CYTRON TECH \n GSM MODEM TC35");
   delay_ms(1000);   lcd_clear();
   uart_putstr("AT \r");
   delay_ms(1000);   
   lcd_clear();
   lcd_putstr(" SW1 to call\r SW2 to hang");
   while(1)    // create an infinite loop
   {
      if(sw1==0)
      {
         uart_putstr("ATD0173446226;\r");  //way to call (ATD<phone number>; then + \r for calling
         lcd_clear();
         lcd_putstr("CALLING");
         while(sw2==1);               //wait to hang off the call
         uart_transmit('\r');         //send \r to interrupt the call
         lcd_clear();
         lcd_putstr("END CALL");      
         delay_ms(2000);
         lcd_clear();
         lcd_putstr(" SW1 to call\r SW2 to hang");
      }   
   }      
   while(1) continue;   // infinite loop to prevent PIC from reset if there is no more program   
}

/*******************************************************************************
* PRIVATE FUNCTION: delay_ms
*
* PARAMETERS:
* ~ ui_value   - The period for the delay in miliseconds.
*
* RETURN:
* ~ void
*
* DESCRIPTIONS:
* Delay in miliseconds.
*
*******************************************************************************/
void delay_ms(unsigned int ui_value)
{
   while (ui_value-- > 0) {
      __delay_ms(1);      // macro from HI-TECH compiler which will generate 1ms delay base on value of _XTAL_FREQ in system.h
   }   
}

/*******************************************************************************
* PRIVATE FUNCTION: beep
*
* PARAMETERS:
* ~ uc_count   - How many times we want to beep.
*
* RETURN:
* ~ void
*
* DESCRIPTIONS:
* Beep for the specified number of times.
*
*******************************************************************************/
void beep(unsigned char uc_count)
{
   while (uc_count-- > 0) {
      pwm_set_duty_cycle(1023);   //buzzer is share at RC2 pin, PWM
      delay_ms(80);
      pwm_set_duty_cycle(0);
      delay_ms(100);
   }
}

   



please help. thank you

Regard

vincent
vinctal910713
Newbie
 
Posts: 9
Joined: Sun Mar 23, 2014 12:42 am

Re: GSM-TC35 + PIC16F877A + SK40C

Postby ober » Wed Mar 26, 2014 10:01 pm

Which yellow LED? Is label D6?

LED D6 will need to be blinking in following rate to indicate the GSM modem and SIM card is ready:
ON for 75ms (short) and OFF for 3 seconds

If the LED D6 is blinking around 600ms ON and 600ms OFF means the SIM card is not detected or not inserted properly, or the modem is searching for the service provider such as Celcom, Digi, Maxis or any other same service provider.

You do not need to connect to microcontroller for the modem to search for SIM card and service provider. Just the power to the TC35 modem and the SIM card is good enough. This has nothing to do with the microcontroller, pressing switch or not. So ignore the microcontroller first. Make sure the LED D6 blinking to indicate the SIM card is ready before proceed to microcontroller.
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Re: GSM-TC35 + PIC16F877A + SK40C

Postby vinctal910713 » Thu Mar 27, 2014 1:02 am

hi,

they is no prblem with the signal. if i connect to the laptop via hyper terminal everything is fine.

problem occur when i interface with the sk40c board. i connect the 4 wires (Vdd, Gnd, RXD and TXD) on the gsm to the sk40c board. i follow the TC35 GSM Development Board User's Manual Rev2 instruction. power adapter is connected to each ( Gsm and sk40c).

when i turn on the power for sk40c board, about 30sec after the gsm D6 led will blink the LED D6 is blinking around 600ms ON and 600ms OFF. what happen? since it able to function properly via hyper terminal then still the SIM card is not detected or not inserted properly, or the modem is searching for the service provider such as Celcom, Digi, Maxis or any other same service provider. ?

please advice

regards
vincent.
vinctal910713
Newbie
 
Posts: 9
Joined: Sun Mar 23, 2014 12:42 am

Re: GSM-TC35 + PIC16F877A + SK40C

Postby ober » Thu Mar 27, 2014 7:01 pm

vinctal910713 WROTE:hi,
they is no prblem with the signal. if i connect to the laptop via hyper terminal everything is fine.
vincent.

So you are saying you can send SMS or make call if the GSM modem is connected to laptop? And the D6 LED is showing the SIM card is ready with ON for short and OFF for long period? But after connect to SK40C and you activate the power, the GSM showing the SIM card is not detected?
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Re: GSM-TC35 + PIC16F877A + SK40C

Postby vinctal910713 » Thu Mar 27, 2014 8:32 pm

yes gsm modem can send sms or make call when i connected to laptop.

the problem occurs when i connect to the SK40C
when i connect to SK40C,the LED D6 is blinking around 600ms ON and 600ms OFF. what is the problem? should not be the SIM card is not detected.

please advice.

thanks

vincent
vinctal910713
Newbie
 
Posts: 9
Joined: Sun Mar 23, 2014 12:42 am

Re: GSM-TC35 + PIC16F877A + SK40C

Postby ober » Thu Mar 27, 2014 10:52 pm

In that case, please capture a clear photo of the wiring connections. Do let us check the wiring.
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Re: GSM-TC35 + PIC16F877A + SK40C

Postby vinctal910713 » Fri Mar 28, 2014 12:43 am

all the connect i follow the TC35 GSM Development Board User's Manual Rev2 instruction.
Attachments
2014328002435.jpg
2014328002600.jpg
vinctal910713
Newbie
 
Posts: 9
Joined: Sun Mar 23, 2014 12:42 am

Re: GSM-TC35 + PIC16F877A + SK40C

Postby ober » Fri Mar 28, 2014 7:24 am

I think the connection in User's Manual have mistake, we will correct it.

Move the white jumper (from VDD of SK40C) to VCC (The last pin of 4 pin UART header pin) on TC35 GSM board, together with other 3 jumpers wires. So all 4 jumper wires should be together.

Try it again.
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Re: GSM-TC35 + PIC16F877A + SK40C

Postby vinctal910713 » Fri Mar 28, 2014 7:35 pm

hi ,
now the gsm can interface with sk40c.( the gsm led d6 show normal when the sk40c supply turn on) but still cant make a call or sms. i have try to load the SAMPLE SOURCE CODE project 1 and 2. but the gsm did not send sms or call.

CODE: SELECT_ALL_CODE
 /*******************************************************************************
* This is the main program for GSM MODEM TC35 using SK40C to control
*
* Author: ANG JIA YI @ Cytron Technologies Sdn. Bhd.
*******************************************************************************/
// GSM modem TC35 with PIC16F877A
// This template C file should be compiled with:
// MPLAB IDE v8.63
// HI-TECH C for the PIC10/12/16 MCU Family
// HI-TECH operate in LITE Mode with v9.80
// Last Updated date: 1 July 2012
// Please email support@cytron.com.my if you have any problem

#include <htc.h>      //include hitech C header file
#include "system.h"      //include system header file for PTK40A
#include "uart.h"      //include uart header file, to enable the functions of uart
#include "lcd.h"      //include lcd header file, to enable the functions of lcd
__CONFIG (FOSC_HS & WDTE_OFF & PWRTE_ON & BOREN_OFF & LVP_OFF); // This is the setting for PIC16F877A

#define _XTAL_FREQ 20000000 //This is the preprocessor directive which is define the frequency to 2MHz

/*******************************************************************************
* Defination of label                                                        *
*******************************************************************************/
#define sw1    RB0
#define sw2      RB1
#define sw3      RC2
#define sw4    RC3
#define   sw5    RC4

/*******************************************************************************
* PRIVATE FUNCTION PROTOTYPES                                                  *
*******************************************************************************/
void delay_ms(unsigned int ui_value);
void beep(unsigned char uc_count);

/*******************************************************************************
* Global Variables                                                             *
*******************************************************************************/

/*******************************************************************************
* MAIN FUNCTION                                                                *
*******************************************************************************/
int main(void)
{
   unsigned char a=0;
   unsigned char mode = 0;
   // ensure all the hardware port in zero initially
   PORTA = 0;
   PORTB = 0;
   PORTC = 0;
   PORTD = 0;
   PORTE = 0;

   // Initialize the I/O port direction, this must be configured according to circuit
   // please refer to PTK40A schematic for details
   // TRISX control pin direction, output pin must be configure as '0'
   // while input must be configure as '1'
   TRISA = 0b00010001;
   TRISB = 0b00001111;
   TRISC = 0b10011111;
   TRISD = 0;
   TRISE = 0;


   //Initialize LCD
   lcd_initialize(); //to ensure the Uart modlue is properly configured to be used
   
   //Initialize UART
   uart_initialize(); //to ensure the Uart modlue is properly configured to be used
   
   // GSM modem are widely use in our daily life. FOr example for cellphone
   // GSMn also be use to contol the contoller to do what ever we want to do
   // GSM is a good long range device to contol the thing we needed to control
   
   lcd_clear();
   lcd_putstr("   CYTRON TECH \n GSM MODEM TC35");
   delay_ms(1000);   lcd_clear();
   uart_putstr("AT \r");
   delay_ms(1000);   
   lcd_clear();
   lcd_putstr(" SW1 to call\r SW2 to hang");
   while(1)    // create an infinite loop
   {
      if(sw1==0)
      {
         uart_putstr("ATD0173446226;\r");  //way to call (ATD<phone number>; then + \r for calling
         lcd_clear();
         lcd_putstr("CALLING");
         while(sw2==1);               //wait to hang off the call
         uart_transmit('\r');         //send \r to interrupt the call
         lcd_clear();
         lcd_putstr("END CALL");      
         delay_ms(2000);
         lcd_clear();
         lcd_putstr(" SW1 to call\r SW2 to hang");
      }   
   }      
   while(1) continue;   // infinite loop to prevent PIC from reset if there is no more program   
}

/*******************************************************************************
* PRIVATE FUNCTION: delay_ms
*
* PARAMETERS:
* ~ ui_value   - The period for the delay in miliseconds.
*
* RETURN:
* ~ void
*
* DESCRIPTIONS:
* Delay in miliseconds.
*
*******************************************************************************/
void delay_ms(unsigned int ui_value)
{
   while (ui_value-- > 0) {
      __delay_ms(1);      // macro from HI-TECH compiler which will generate 1ms delay base on value of _XTAL_FREQ in system.h
   }   
}

/*******************************************************************************
* PRIVATE FUNCTION: beep
*
* PARAMETERS:
* ~ uc_count   - How many times we want to beep.
*
* RETURN:
* ~ void
*
* DESCRIPTIONS:
* Beep for the specified number of times.
*
*******************************************************************************/
void beep(unsigned char uc_count)
{
   while (uc_count-- > 0) {
      pwm_set_duty_cycle(1023);   //buzzer is share at RC2 pin, PWM
      delay_ms(80);
      pwm_set_duty_cycle(0);
      delay_ms(100);
   }
}

   


please advice

regards
vincent.
vinctal910713
Newbie
 
Posts: 9
Joined: Sun Mar 23, 2014 12:42 am

Re: GSM-TC35 + PIC16F877A + SK40C

Postby vinctal910713 » Mon Mar 31, 2014 8:20 am

Can you help to solve the problem? The gsm modem still unable to sent SMS/call via sk40c. I follow all ur instruction and load the sample program given in cytron the tutorial.
vinctal910713
Newbie
 
Posts: 9
Joined: Sun Mar 23, 2014 12:42 am

Next

Return to Wireless Device

Who is online

Users browsing this forum: No registered users and 7 guests

cron