View previous topic :: View next topic |
Author |
Message |
SirDrake
Joined: 02 Jun 2004 Posts: 2
|
Conection pic-mobile phone |
Posted: Wed Jun 02, 2004 4:36 am |
|
|
Hi, i´m newby here and in programing pics but finding some help i've come here. I hope u could help me.
I'm trying to send some at commands to a siemens mobile and recive the data with a 16f876. With the pc i can do the comunication but the phone seems not reciving anything.
I use a 9 pin conector where i conect the data cable. The pin 1,4 and 6 are joined, the same as the 7and 8. The pin 2 goes to tx of the max232, the 3 goes to the rx of the max and the 5 to Gnd. That's right? the max is joined to the rx and tx pins of the pic.
I paste a program that i've typed.
#include <16F876.h>
//#device adc=8
#use delay(clock=4000000)
#use rs232(baud=9600,xmit=PIN_C6,Rcv=PIN_C7)
#fuses XT,NOWDT,NOPROTECT,NOLVP
void main()
{
char string[30];
char cr;
int i=0;
port_b_pullups(TRUE);
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_spi(FALSE);
setup_counters(RTCC_INTERNAL,WDT_18MS);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
SET_TRIS_C(0b10000000);//rc7 como entrada de datos del puerto serie
delay_ms(2000);
output_high(PIN_A0);
delay_ms(1000);
printf("at");
output_low(PIN_A0);
getc();
delay_ms(500);
output_high(PIN_A0);
delay_ms(1000);
}
if i conect the conector to the pc and open the hyperterminal y recive at and if i press a key the led lights. But if i conect the conector to the data cable and to the phone with the echo activated the led must light when recive the echo but it doesn't happens.
Have someone any idea?
Thanks |
|
|
William H. Conley III
Joined: 27 May 2004 Posts: 17 Location: Tucson, AZ
|
|
Posted: Wed Jun 02, 2004 9:14 am |
|
|
I would use:
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7,BRGH1oK,errors)
getc() will return one byte.
Are you sure you have the TX and RX connected correclty to you CELL MODEM?
Is there a way to disable FLOW control on you modem.
-bc |
|
|
Lorenzo
Joined: 23 Apr 2004 Posts: 14 Location: Pescara (Italy)
|
|
Posted: Thu Jun 03, 2004 12:56 am |
|
|
You must send:
printf("at\r");
Lorenzo |
|
|
SirDrake
Joined: 02 Jun 2004 Posts: 2
|
|
Posted: Thu Jun 03, 2004 2:49 am |
|
|
I conect the rx and tx of the max232 to the conector and it to the datacable. I'm sure that the link is right but i don't know if i must conect to the max or to the pic.
If i send at/r y must recive ok but if i send at i must recive at (the echo) and i recive nothing.
What is the flow control?
now i'm going to change the connection parameters and tell you if make something diferent.
Thanks |
|
|
William H. Conley III
Joined: 27 May 2004 Posts: 17 Location: Tucson, AZ
|
|
Posted: Thu Jun 03, 2004 11:00 am |
|
|
Flow control is a way for your modem to tell another device to stop or start transmitting data. It can be hardware, (RTS/CTS) or software, (XON/XOFF).
If your modem requires flow control, or has flow control enabled, it may case serial data to be ignored.
The way you have your serial routines written will accept one byte.
I would wite a buffer routine that buffers data then you can parse through the array.
-bc |
|
|
|