CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Problem interface GSM TC35 with PIC18f4550
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Tue Feb 04, 2014 2:49 pm     Reply with quote

Hi Low,

I looked at the datasheet, a noted a couple of important things. First, the pin nomenclature is a bit odd. I see where it comes from, but in my opinion it's a
potential source of confusion. In the case of the TC-35, the 'Tx' pin is the input, and the 'Rx' pin is the output. So, the Tx pin on the modem gets
connected to the Tx pin on the PIC. The same for the Rx pin!

I identified another issue. The TC-35 is a 3.3V-ish device, and the 'RS232' levels are CMOS 2.65V. This means that you really can't connect the modem
directly to the PIC if the PIC is powered at 5V. The PIC output *may* damage the GSM input, and the GSM output will most likely be not enough to reliably
trigger the PIC input.

So, you have two possible solutions:

Solution #1: Power your PIC and your TC-35 at 3.3V. This may require a special version of the PIC. I'll leave that to you to determine.

Solution #2: Power the TC-35 at 3.3V, and the PIC at 5V, and use a 'level translator' between the two. By a level translator, I mean
something like this: https://www.sparkfun.com/products/11978

Are you sure you made the TC-35 work with your PC? I don't see how you did that without some additional hardware? Also, the TC-35 has a
rather rigorous 'Turn-on' procedure. How did you accomplish that?

John
low



Joined: 04 Feb 2014
Posts: 28
Location: Malaysia

View user's profile Send private message AIM Address

PostPosted: Wed Feb 05, 2014 12:56 pm     Reply with quote

Hi ezflyr,

Ya.. I very sure TC-35 work to my PC... I use the adapter 12V directly connect to the GSm module to power up it...

Regards
low



Joined: 04 Feb 2014
Posts: 28
Location: Malaysia

View user's profile Send private message AIM Address

PostPosted: Wed Feb 05, 2014 1:02 pm     Reply with quote

[http://www.thanksbuyer.com/gsm-sms-tc35-remote-control-module-900-1800mhz-voice-adapter-uart-rs232-for-arduino-avr-51-27375?keyword=GSM%20SMS]

This type of TC35 GSM module i using...

Regards
low



Joined: 04 Feb 2014
Posts: 28
Location: Malaysia

View user's profile Send private message AIM Address

PostPosted: Wed Feb 05, 2014 1:43 pm     Reply with quote

Hi Gabriel,

What is the mean COMMS FAILED??? My LCD display COMMS FAILED RETRYING- STRUCK


Regards
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Wed Feb 05, 2014 3:19 pm     Reply with quote

Hi Low,

Well, the module shown in the link you posted today is totally different than the module shown in the link you posted yesterday. This makes me realize
that we are all wasting our valuable time trying to help you! Without good, solid and reliable data, how do you think you are going to get your project
completed?

Your question to Gabriel further highlights the fact that you don't even have a basic idea about what's going on with the hardware or the 'driver' that's
been provided to you. Frankly, this project has a very low probability of success.....

The module you show today appears to have a 9 Pin 'D' connector, so it most likely has a TTL-to-RS232 converter built in. That is why you can
use it with your PC. That mystery is now solved. So, you need to add a MAX232 device to your PIC, so that you can then connect directly to the
board you've shown today.

PIC ---> MAX232 ---> TC-35 Modem Board

I'll leave it to you to figure out the cabling, but remember, the TC-35 Tx output needs to ultimately connect to the PIC Rx input, and the TC-35 Rx
input needs to ultimately connect to the PIC Tx output.

John
low



Joined: 04 Feb 2014
Posts: 28
Location: Malaysia

View user's profile Send private message AIM Address

PostPosted: Thu Feb 06, 2014 9:24 am     Reply with quote

Hi ezflyr,

Thank you, now I already connected PIC ---> MAX232 ---> TC-35 Modem Board

I follow this connection:

http://www.aquihayapuntes.com/indice-practicas-pic-en-c/control-de-mensajes-sms-a-traves-de-un-pic.html?start=1

For the coding i tried Gabriel sample code but i failed to build it!!!!

Error part:
Code:
 setup_ccp1(CCP_PWM|CCP_PULSE_STEERING_A);   // Configure CCP1 as a PWM
 


UNDENTIFIER identifier CCP_PULSE_STEERING_A

It is my compiler version problem??? I using PCH Compiler V4.093


Regards,
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Thu Feb 06, 2014 10:53 am     Reply with quote

Hi Low,

In the driver provided by Gabriel, he is using a 'PWM' output to generate a negative bias voltage for his LCD. My guess is you don't need that, so just
get rid of that code.

BTW, how is it that you built the code before (you showed us an error message generated by the code!), but now you can't build it???

John
low



Joined: 04 Feb 2014
Posts: 28
Location: Malaysia

View user's profile Send private message AIM Address

PostPosted: Thu Feb 06, 2014 11:34 am     Reply with quote

hi ezflyr,

Before i delete the code but it came out 6 warnings with 0 error...
Then i try burn the hex run it.....


Regards
low



Joined: 04 Feb 2014
Posts: 28
Location: Malaysia

View user's profile Send private message AIM Address

PostPosted: Thu Feb 06, 2014 11:04 pm     Reply with quote

hi ezflyr,

The LCD still display COMMS FAILED RETRYING- STRUCK???

Which part i did it wrong??? Sad Sad Sad

Regards
low



Joined: 04 Feb 2014
Posts: 28
Location: Malaysia

View user's profile Send private message AIM Address

PostPosted: Fri Feb 07, 2014 2:16 am     Reply with quote

Hi ezflyr,

Thank you i success send the message.... Now want change the coding in real project....


Thank you

Regards,
low



Joined: 04 Feb 2014
Posts: 28
Location: Malaysia

View user's profile Send private message AIM Address

PostPosted: Fri Feb 07, 2014 10:28 am     Reply with quote

hi,

The input i using PIR sensor... How to change the code which when PIR detected able to send the sms for first alert message then wait after 5 min just send for second message??? Below is my code ardy able to send sms

Code:
#include <18F4550.h>                   // PIC18F4550 HEADER FILE
#include <stdlib.h>
#fuses HS,NOWDT,NOLVP,NOPROTECT        // EXTERNAL CLOCK, NO WATCH DOG TIMER, NO LOW VOLTAGE PROGRAMMING
#use delay (clock=20M)                 // 20 MHZ CRYSTAL
#include <lcd.c>                       // LCD DISPLAY HEADER FILE
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7,stream=GSM)

#define LED1         PIN_B6               // LED1
#define BUZZER       PIN_B7               // BUZZER
#define BUTTON1        PIN_B0               // PRESET BUTTON 1   

#define LCD_E           PIN_D0               // PIN E
#define LCD_RS          PIN_D1               // PIN RS
#define LCD_RW          PIN_D2               // PIN RW
#define LCD_D4          PIN_D4               // PIN D4
#define LCD_D5          PIN_D5               // PIN D5
#define LCD_D6          PIN_D6               // PIN D6
#define LCD_D7          PIN_D7               // PIN D7

void PIR();


void main()
{
lcd_init();                      //INITIALISE LCD
lcd_putc("\f....WELCOME.....");
delay_ms(1000);
lcd_putc("\f");
lcd_putc("\n...loading...!");
delay_ms(1000);
lcd_putc("\f");
lcd_putc("\f....Ready");
delay_ms(1000);



while(TRUE)                      // always repeat program

   {
   printf(lcd_putc,"\fSystem On!!");        // DISPLAY VR VALUE AT LCD DISPLAy
   delay_ms(5);
   if (!input(BUTTON1))             // when press button 1
   {
      output_high(LED1);               // turn on LED1
      delay_ms(100);
      PIR();
 else
   
      {
      output_low(LED1);
      output_low(BUZZER);
      lcd_putc(0x01);
      delay_ms(300);
      }
   }
   }




void PIR()
{

printf("AT+CMGF=1\n\r"); //It inhabits the text mode sms
delay_ms (500);
fprintf(GSM, "at+cmgs=\"0174366043\"\r\n");
delay_ms (4000);
printf ("GSM TC35");
delay_ms (500);
putchar (0x1a);      //Ctrl-Z(send)
}

Thank you


Regards,
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Fri Feb 07, 2014 12:41 pm     Reply with quote

it means the communication between the module and the PIC is failing.

The pic is sending "AT" and the modem is not responding with "OK"
it will remain stuck in a loop retrying until it receives the appropiate OK response form the module.

In other words... you hardware is wrong because your connections to the GSM module are not working.

... as a simple test, try switching the TX RX lines...
Are you sharing the Ground?

G.
_________________
CCS PCM 5.078 & CCS PCH 5.093
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Fri Feb 07, 2014 12:43 pm     Reply with quote

Quote:
In the driver provided by Gabriel, he is using a 'PWM' output to generate a negative bias voltage for his LCD. My guess is you don't need that, so just
get rid of that code.


That is correct.
_________________
CCS PCM 5.078 & CCS PCH 5.093
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Fri Feb 07, 2014 4:23 pm     Reply with quote

Hi Low,

At this point, I think you've got to play a little bit! If we show you everything, how are you going to learn?

As far as your request, in it's simplest form, just wait for the signal from the PIR detector, and then send Msg #1. Now enter a delay loop for 5 minutes, and at the end send Msg #2. Your code won't be able to do anything else during the delay, so in that sense it's not very well written, but at least it will satisfy your stated design criteria.

John
low



Joined: 04 Feb 2014
Posts: 28
Location: Malaysia

View user's profile Send private message AIM Address

PostPosted: Fri Apr 11, 2014 12:34 am     Reply with quote

hi masters,
Now i want continue my project which can received and display the message on the lcd...
I already read all the old or past post i still cant get the point to start... Can masters show me some hint????
Thank you

Regards
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4  Next
Page 2 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group