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 support@ccsinfo.com

How can I display a sms on LCD?
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Praful



Joined: 18 Jun 2012
Posts: 23

View user's profile Send private message

help sms on lcd
PostPosted: Sat May 04, 2013 4:31 am     Reply with quote

How can I display a sms on LCD? Rolling Eyes
Please help/guide me....
Smile
Praful



Joined: 18 Jun 2012
Posts: 23

View user's profile Send private message

help sms on LCD
PostPosted: Sat May 04, 2013 7:09 am     Reply with quote

Dear Gabriel,
Thanks for your valuable code Rolling Eyes
http://www.ccsinfo.com/forum/viewtopic.php?t=50390
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Sat May 04, 2013 9:46 am     Reply with quote

Hi Praful,

I'm glad to see you find this code useful.

Before I start to help you please answer/do the following:

- Are you simulating or using REAL hardware?
- Have you gotten the original code as posted to work with your hardware?
- Show me your attempt at modifying the code.
- Tell me where you are stuck.


G.
_________________
CCS PCM 5.078 & CCS PCH 5.093
Praful



Joined: 18 Jun 2012
Posts: 23

View user's profile Send private message

PostPosted: Sun May 05, 2013 12:22 pm     Reply with quote

Firstly I am simulating the code with two uC.
And making a hardware side by side. I'm stuck at message devide for a displaying on LCD . I'm using 20x4 LCD to display a message on it.
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Mon May 06, 2013 6:42 am     Reply with quote

Hi,

How are you simulating with 2 uC? That doesnt make much sense...
You havent answered half of the questions i asked you... there is a reason i asked those questions.

Let me know when you have real hardware, and have compiled and actually gotten the code to run in your setup.

The point of posting code for others, is to help others save time, not waste mine.


G.
_________________
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: Mon May 06, 2013 6:43 am     Reply with quote

Hi,

Your question is fairly open-ended! Displaying text on an LCD is very
straight-forward, and is covered in (literally) thousands of messages on this
forum. Rather, I suspect what you are really asking is how to extract the
SMS data from the GSM module, parse the actual SMS message, and display
it on the LCD?

I posted some code snippets recently that should help you out with this task:

http://www.ccsinfo.com/forum/viewtopic.php?t=50241&highlight=

Using a 2nd PIC to simulate the GSM modem is a good idea. During the
development of of my GSM project, I used a PC, and a Visual Basic
application I wrote to do this. You just have to be very careful that you
are accurately simulating the behavior of the GSM modem, or you'll be
actually making your life harder, not simpler

John Very Happy
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Mon May 06, 2013 6:54 am     Reply with quote

Hi Ezflyr,

It would be great if you could maybe post the Simulating Code!

I appologize if i am reluctant to jump in and help right out of the box, but you know how things are lately around here...

indeed the question is related to parsing the input buffer looking for the particular string or SMS message.

however if he was simulating on ISIS, or simply fishing for a pointless answer to an imaginary problem i really didnt want to waste my time...


If he has actually compiled and tried the code as posted, and it works, then I know that he *Has working hardware and its fairly easy to help him out.

I/we/anyone helping have to rule out other posible sources of problems...

1) Hardware
2) Proteus
3) Compiler
4) etc...

and I also want to see him try...


G.
_________________
CCS PCM 5.078 & CCS PCH 5.093
Praful



Joined: 18 Jun 2012
Posts: 23

View user's profile Send private message

PostPosted: Tue May 07, 2013 5:04 am     Reply with quote

Dear Gabriel,
I made a hardware and test the code but not succeed like Proteus.
My working code on Proteus is as follows but on real hardware it stuck at first stage not getting "OK" for "AT".(RETRYING - STUCK IN LOOP).
Please help...
My code:-
while(1)
{
printf("%s",Receive_String); //To print on Hyper terminal
Printf(lcd_putc,"%s",Receive_String); //To print on LCD
CLEAR_BUFFER();
}
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Tue May 07, 2013 6:38 am     Reply with quote

PROTEUS: Defined as Software that will Stop any kind of help in this forum.
Read the forum Guidelines.


I really think you are NOT using real hardware since:
Code:
while(1)
{
printf("%s",Receive_String); //To print on Hyper terminal
Printf(lcd_putc,"%s",Receive_String); //To print on LCD
CLEAR_BUFFER();
}


First, you are using the HARDWARE UART to print to Hyperterminal..
the hardware UART shoud be to the modem.

Secondly you clearly have not even read the code since you are printing an EMPTY buffer...infinitely.

Receive_String is CLEARED by CLEAR_BUFFER()

and Third, if you cant even get past the first Check, which happens to be a COMs check, then you have a hardware issue... or absence there of.


I think I am out... Sorry.

At least until you prove you are using real hardware.
if you are, try disabling FLow Control on your modem. ethier in software or by shorting CTS & DTR.
_________________
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: Tue May 07, 2013 7:07 am     Reply with quote

Hi Praful,

Have you spent any time searching the forum for other GSM projects? If you
had, you'd know that we always want to know what GSM modem you are
using, and how it's connected to your PIC? I don't want to 'pile on' here, but
you've got to learn how to ask questions intelligently if you expect to get
any meaningful help here on the forum!

At this point, you appear to have a 'hardware' issue (this is a big leap of
faith, because I'm not 100% convinced you actually have 'real' hardware!)
There is really no point in doing anything else until you can perform
a successful communications test with your modem, and receive an 'OK'.

John
Praful



Joined: 18 Jun 2012
Posts: 23

View user's profile Send private message

PostPosted: Tue May 07, 2013 7:12 am     Reply with quote

Dear Gabriel,
Look at the code and attached picture.....
code:-
#include <16F877A.h>
#device adc=8

#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected

#use delay(clock=8000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

#include "string.h"
#include "smsDriver.c"
#define LCD_DB4 PIN_D0
#define LCD_DB5 PIN_D1
#define LCD_DB6 PIN_D2
#define LCD_DB7 PIN_D3

#define LCD_E PIN_D4
#define LCD_RS PIN_D5

#include <flex_lcd.c>

void main()
{
int sms_index=1;



setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_CLOCK_DIV_2);
setup_psp(PsP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
ENABLE_INTERRUPTS(INT_RDA);
ENABLE_INTERRUPTS(GLOBAL); // Enable Interrupts
lcd_init();
printf("Program Starts Now");
printf(lcd_putc,"Program Starts Now");
delay_ms(1000);
printf(lcd_putc,"\f");

//**************************************************************************
// Clears the Comm buffer
//**************************************************************************

CLEAR_BUFFER();
lcd_putc("\fBUFFER CLEARED\n");
DELAY(1); // Delay a maximum of X seconds

//**************************************************************************
// Check if modem is attached
//**************************************************************************
if(CHECK_COM())
{
lcd_putc("\fCOMMS ARE GOOD\n");
lcd_putc("\MOVING ON...\n");
DELAY(1); // Delay a maximum of X seconds
}
else
{
lcd_putc("\fCOMMS FAILED\n");
DELAY(1); // Delay a maximum of X seconds
while(!CHECK_COM())
{
lcd_putc("\RETRYING - STUCK IN LOOP\n");
DELAY(1); // Delay a maximum of X seconds
}
lcd_putc("\f");
lcd_putc("\fCOMMS ARE GOOD\n");
}
DELAY(1); // Delay a maximum of X seconds;

//**************************************************************************
// Set Modem to TXT mode
//**************************************************************************
lcd_putc("\fSET MODEM TO TXT MODE\n");
DELAY(1); // Delay a maximum of X seconds
if(SET_PDU())
{
lcd_putc("\OK! - MOVING ON...\n");
DELAY(1); // Delay a maximum of X seconds
}
else
{
lcd_putc("\ERROR - STUCK IN LOOP...\n");
while(1);
}

//**************************************************************************
// Set Prefered message Storage
//**************************************************************************
lcd_putc("\fSETTING SMS MEMORY\n");
DELAY(1); // Delay a maximum of X seconds;
if(SET_MEM())
{
lcd_putc("\OK! - MOVING ON...\n");
DELAY(1); // Delay a maximum of X seconds
}
else
{
lcd_putc("\ERROR - STUCK IN LOOP...\n");
while(1);
}

//**************************************************************************
// WAIT FOR SMS AND READ
//**************************************************************************
lcd_putc("\fMODEM SETUP IS DONE\n");
lcd_putc("\CLEARING BUFFER...\n");
CLEAR_BUFFER();
lcd_putc("\DONE ---> RUN PROGRAM\n");
DELAY(1); // Delay a maximum of X seconds
lcd_putc("\f");
while(1)
{
printf("%s",Receive_String);
Printf(lcd_putc,"%s",Receive_String);
CLEAR_BUFFER();
}//--END OF MAIN WHILE

}
Code:
Praful



Joined: 18 Jun 2012
Posts: 23

View user's profile Send private message

PostPosted: Tue May 07, 2013 7:19 am     Reply with quote

how can i insert an image of my project to show u reality...?????

Here is the project Photo just taken by my mob

http://imageshack.us/photo/my-images/801/img20130507184619.jpg/


Last edited by Praful on Tue May 07, 2013 7:31 am; edited 1 time in total
ezflyr



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

View user's profile Send private message

PostPosted: Tue May 07, 2013 7:25 am     Reply with quote

Hi,

Post your picture to a free picture hosting service, and give us the link here!

What Modem are you using? How is it connected to your PIC??

John
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Tue May 07, 2013 7:33 am     Reply with quote

Praful,

You have succesfully butchered the code beyond any kind of functionality.

Even if you get past the COMs check, the posted code WILL NEVER WORK.

The code I've posted, will work with an '877A as is with some Basic Minor changes to allow compilation for that chip.


Note the following:
1) I didnt see any link or picture in your post... (might be my PC)
2) Ill Assume there is one and that you are using real hardware for now.
3) You did not even try to get the code to work AS IS before you started to chop it. i cant guide you if you butcher code blindly.
4) how exactly are you telling you PIC that a new message has arrived? you deleted half the code.
5) how are you reading the SMS? again, deleted half the code.
6) see below:
Code:
while(1)
{
printf("%s",Receive_String);
Printf(lcd_putc,"%s",Receive_String);
CLEAR_BUFFER();
}


Exactly what do you expect here? there is NOTHING INSIDE "Receive_String"... CLEAR_BUFFER does just that... IT CLEARS THE BUFFER!


you code as you posted, provided you have not butchered unnesesarily the code more than you already have, should run atleast until the COMs check... which you say fails... thus you have a HARDWARE PROBLEM.

Possible reasons might be that:
- you modem is not set up with matching Baud Rate.
- you have flow control enabled.
- you don have real hardware.
_________________
CCS PCM 5.078 & CCS PCH 5.093
Praful



Joined: 18 Jun 2012
Posts: 23

View user's profile Send private message

PostPosted: Tue May 07, 2013 7:33 am     Reply with quote

Dear John,
I just attached a link of my project and tomorrow I'll attach the schematic also thanks for your kind help..... And sorry Gabriel I forgot that correcting tomorrow and show u the maximum code thanks again for ur help...
Praful


Last edited by Praful on Tue May 07, 2013 7:38 am; edited 1 time in total
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 1, 2, 3  Next
Page 1 of 3

 
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