View previous topic :: View next topic |
Author |
Message |
Gabriel
Joined: 03 Aug 2009 Posts: 1067 Location: Panama
|
|
Posted: Fri Nov 18, 2016 3:30 pm |
|
|
as per the original post:
Quote: | As is, the sample program responds to 3 commands: "Luz1", "Luz2" & "Aire".
(spanish for Light1, Light2, and Airconditioning)
The only action taken by the code is to display a message on the LCD.
The Exception is "Luz2" which aditionally, replys back with an SMS to a SET & and PREDEFINED Number... See SEND_SMS(); |
"Luz2" - just to be clear.
G. _________________ CCS PCM 5.078 & CCS PCH 5.093 |
|
|
xoom
Joined: 18 Nov 2016 Posts: 4
|
|
Posted: Sat Nov 19, 2016 1:49 am |
|
|
Gabriel wrote: | as per the original post:
Quote: | As is, the sample program responds to 3 commands: "Luz1", "Luz2" & "Aire".
(spanish for Light1, Light2, and Airconditioning)
The only action taken by the code is to display a message on the LCD.
The Exception is "Luz2" which aditionally, replys back with an SMS to a SET & and PREDEFINED Number... See SEND_SMS(); |
"Luz2" - just to be clear.
G. |
SEND_SMS(); my send sms mode can send a message on its own.
But I send a message with Luz2 as module, but i can't receive a message back. |
|
|
xoom
Joined: 18 Nov 2016 Posts: 4
|
|
Posted: Sat Nov 19, 2016 7:23 am |
|
|
I do not understand the codes :( |
|
|
Gabriel
Joined: 03 Aug 2009 Posts: 1067 Location: Panama
|
|
Posted: Sat Nov 19, 2016 9:27 am |
|
|
What is your PIC?
what is your modem?
do you have an LCD on board?
does the code compile and program successfully the chip?
IS THIS HARDWARE OR SIMULATION?
G. _________________ CCS PCM 5.078 & CCS PCH 5.093 |
|
|
xoom
Joined: 18 Nov 2016 Posts: 4
|
|
Posted: Sat Nov 19, 2016 10:26 am |
|
|
18f4520
Quote: | what is your modem? |
Sim900R - i can send sms from the module, but i cant read the message i send to the module
Quote: | do you have an LCD on board? |
i don't use lcd. i use only led control.
Quote: | does the code compile and program successfully the chip? | i send "Luz2" message to the module from my mobile phone.
but the module doesn't send a message back to me.
Quote: | IS THIS HARDWARE OR SIMULATION? |
Hardware |
|
|
40inD
Joined: 30 Jul 2007 Posts: 112 Location: Moscow, Russia
|
|
Posted: Wed Jan 18, 2017 5:15 am |
|
|
Is this driver suitable for SIM800L ?
And how to pass my own string to SEND_SMS() function? |
|
|
Gabriel
Joined: 03 Aug 2009 Posts: 1067 Location: Panama
|
|
Posted: Wed Jan 18, 2017 10:46 am |
|
|
Hi, it *should* work since the AT commands used here are pretty basic/standard.
To pass your own string just modify the PRINTF statement to print what ever you want. _________________ CCS PCM 5.078 & CCS PCH 5.093 |
|
|
40inD
Joined: 30 Jul 2007 Posts: 112 Location: Moscow, Russia
|
|
Posted: Wed Jan 18, 2017 11:36 pm |
|
|
Gabriel, do I understand right, that main cycle of program is
Code: |
/**************************************************************************
// WAIT FOR SMS AND READ
//**************************************************************************
CLEAR_BUFFER();
blink_led(1, 20);
DELAY(1); // Delay a maximum of X seconds
while(1)
{....}
| ?
And if I want to read some data from sensors or do other things, I must do it in this cycle? |
|
|
Gabriel
Joined: 03 Aug 2009 Posts: 1067 Location: Panama
|
|
Posted: Thu Jan 19, 2017 6:59 am |
|
|
That is correct.
It just loops checking for the "+CMTI" string.... just ad sensors here. _________________ CCS PCM 5.078 & CCS PCH 5.093 |
|
|
towpew
Joined: 25 Sep 2015 Posts: 24 Location: sweden
|
Receive_String problem |
Posted: Thu Nov 02, 2017 5:09 am |
|
|
Hi
I am testing this SMS program for SIM800L, and it works fine, but I have
added some code for getting the phone number from the Read_String
It´s a simple added routine in the READ_SMS where i copy the number from the Receive_String.
Code: | strncpy(sendernr,Receive_String + 32,14); |
It works fine after the first SMS, so only after cold start "boot" the number
is wrong, I get the index fault 2 steps to left.
After boot the number is
12345678912"",
and after the first SMS it is OK
"+12345678912"
So the Receive_String is shifted 2 step to the left BUT only after the first Boot, I have tried to Se where this is fault could be but I have not found it.
The CLEAR_BUFFER that is called on different places and clears the Receive_String and this is also done in the start of the code, so therefore this fault seems odd.
I also initiate the sendernr[20] array in the declaration with zeros.
Can someone who has using this code see any other potential leak that I have missed, specially when it starts up from boot ? |
|
|
towpew
Joined: 25 Sep 2015 Posts: 24 Location: sweden
|
Receive_String problem |
Posted: Thu Nov 02, 2017 6:35 am |
|
|
Hi again
I probably solved this issue, as i am using another PIC the 30F4011.
This has a small buffer on the Received interrupt. When I set the
U1RXISEL0 and 1 to zero for the interrupt to come from the first incoming
byte it seems to work every time, even after cold boot.
If I get any other result later, I will get back. |
|
|
siproelec
Joined: 13 Nov 2017 Posts: 1 Location: caracas
|
Re: SMS - Text Messages - GSM - Remote Control - UPDATE 06/0 |
Posted: Mon Nov 13, 2017 9:03 am |
|
|
Gabriel wrote: | Hi All,
It is about time I updated the SMS code I posted a long time ago.
|
hola buen dia amigo soy nuevo en el foro y nuevo programando en ccs me interesa mucho este tema quiero hacer un discador de mensajes para un sistema de alarmas con un pic y he estado viendo los ejemplos en youtube pero no todos esta claros, los que mas claros estan son los realizados con arduino.
me gustaria tener algun ejemplo para partir de ahi con mi programa he estudiado los comandos de la libreria string.h que veo que facilitan mas el manejo de las cadenas de caracteres no si me recomiendas algun video o algo pro donde empezar te lo agradezco.
Translation:
Hello good day. Friend, I am new in the forum and new to programming in CCS. I am very interested in this topic I want to make a message dialer for an alarm system with a pic.
I have been seeing the examples on YouTube but they are not all clear to me. The most clear are those made with Arduino.
I would like to have an example to start from there with my program. I studied the commands of the library string.h. I see that they facilitate more the handling of the character strings. If you can recommend me any video or something to start with, I thank you for it. |
|
|
Gabriel
Joined: 03 Aug 2009 Posts: 1067 Location: Panama
|
|
Posted: Mon Nov 13, 2017 10:08 am |
|
|
Hi siproelec,
English is the forum's language, so i would recommend you stick to it or the moderator may have to do what moderators do.
The code provided has all the necessary steps to receive and send SMS.
It also does all the setup steps a typical modem needs in order to successfully control it and send your messages.
As a first step, i would suggest you connect your modem to a terminal program and learn how to manually send an SMS using AT commands.
This will provide a good understanding of what is required.
As for using String functions, yes, there are better ways to do what I've done on this code... it is meant to be a starting point for others to build on.
G. _________________ CCS PCM 5.078 & CCS PCH 5.093 |
|
|
SubhamayS
Joined: 07 Mar 2012 Posts: 34 Location: jalpaiguri, India
|
enfora1218_driver -12-02-2013.c This file is not available |
Posted: Sun May 06, 2018 10:16 am |
|
|
The code supplied here is not compiling due to the unavailability of enfora1218_driver -12-02-2013.c |
|
|
SubhamayS
Joined: 07 Mar 2012 Posts: 34 Location: jalpaiguri, India
|
Re: enfora1218_driver -12-02-2013.c This file is not avail |
Posted: Sun May 06, 2018 10:19 am |
|
|
Gabriel wrote: | Test Conditions:
Quote:
MODEM: ENFORA 1218
PIC: 16F886 @20MHz / 5V
BAUD: 115.2
COM: RS-232 / MAX232 Chip
LCD:16x2 + Flex_LCD driver (available in library)
COMPILED: PCM 4.135 - MPLAB 8.85 |
The code supplied here is not compiling due to the unavailability of enfora1218_driver -12-02-2013.c
i am working with SIMCom SIM900A. Can I work with your driver with this modem ? |
|
|
|