Discussion in "Embedded GSM Development" started by    turker1    Sep 7, 2008.
Sun Sep 07 2008, 04:17 pm
#1
Hi.I am getting operator name and displaying on LCD.
My code:
#include <16F628.h>

#use delay(clock=4000000)
#define use_portb_lcd TRUE
#include <LCD.C>

#use rs232(baud=9600,parity=N,xmit=PIN_A2,rcv=PIN_A1,bits=8)
char s[30];
int i=0;
char *substring(int start, int stop,  char *text)
{
   return ("%.*s\n", stop - start, &text[start]);
}


void main()
{
lcd_init();

printf("AT\r\n");
delay_ms(100);
output_high(PIN_A0);
printf("ATE0\r\n");
delay_ms(100);
printf("AT+COPS?\r\n");
getc();
getc();
gets(s);
printf(lcd_putc,substring(11,25,s));
lcd_putc('e');
}

It works. But it is not stable.Sometimes dont work.LCD displays "e" only.
Why? What is problem?
Sun Sep 07 2008, 04:41 pm
#2
you forgot to add while(1) loop at end..
if it does not work then try with sending normal string..
Sun Sep 07 2008, 05:54 pm
#3
I tried. But same problem again. This text is true. ', "TR TURKCELL"e'
Look video:
[yt]a4Re5v2N5SU[/yt]


[ Edited Sun Sep 07 2008, 07:02 pm ]
Sun Sep 07 2008, 07:08 pm
#4
try this way..
char str[20];
sprintf(str,substring(11,25,s));
while(*str){
     lcd_putc(*str++);
}
Sun Sep 07 2008, 07:16 pm
#5
code gives error at '++'
Sun Sep 07 2008, 07:46 pm
#6
make a lcd_puts function and use str as..
lcd_puts(str);

try again..
Sun Sep 07 2008, 07:47 pm
#7
if you can make lcd_puts function then you can do this way too..
lcd_puts(substring(11,25,s));
Mon Sep 08 2008, 11:57 pm
#8
do you think problem is sending string to LCD?
Tue Sep 09 2008, 03:38 am
#9
seems like you need to review the substring function. i dont think its working.. make simple for loop logic?

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

MnoioCoove
Tue May 21 2024, 02:06 am
PedroDug
Sun May 19 2024, 05:39 pm
JewelAmuck
Sun May 19 2024, 03:06 pm
Minniemus
Sun May 19 2024, 07:39 am
Andyhet
Sat May 18 2024, 07:28 am
BrettTibre
Fri May 17 2024, 06:14 pm
Gordonfax
Fri May 17 2024, 10:28 am
Davidspils
Fri May 17 2024, 10:19 am