T290i controlling with pic
Discussion in "Embedded GSM Development" started by turker1 Sep 7, 2008.
Sun Sep 07 2008, 04:17 pm
Hi.I am getting operator name and displaying on LCD.
My code:
It works. But it is not stable.Sometimes dont work.LCD displays "e" only.
Why? What is problem?
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
you forgot to add while(1) loop at end..
if it does not work then try with sending normal string..
if it does not work then try with sending normal string..
Sun Sep 07 2008, 05:54 pm
I tried. But same problem again. This text is true. ', "TR TURKCELL"e'
Look video:
[yt]a4Re5v2N5SU[/yt]
Look video:
[yt]a4Re5v2N5SU[/yt]
[ Edited Sun Sep 07 2008, 07:02 pm ]
Sun Sep 07 2008, 07:08 pm
try this way..
char str[20]; sprintf(str,substring(11,25,s)); while(*str){ lcd_putc(*str++); }
Sun Sep 07 2008, 07:47 pm
if you can make lcd_puts function then you can do this way too..
lcd_puts(substring(11,25,s));
Tue Sep 09 2008, 03:38 am
seems like you need to review the substring function. i dont think its working.. make simple for loop logic?
Powered by e107 Forum System