Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Need help with connecting PIC with siemens c45 in C

Status
Not open for further replies.

jaime

Member level 1
Member level 1
Joined
Jul 15, 2005
Messages
38
Helped
4
Reputation
8
Reaction score
2
Trophy points
1,288
Location
Porto-Portugal
Activity points
1,608
PIC AT Command and CCS

Hello
I'm trying to connect my pic to my siemens c45 in C.

I would like to do an interrupt by the rx pin to read the data from the phone.
I Know that the phone send OK (in hex: 0D 0A 4F 4B 0D 0A

I have to use a rotine with getc because this string dont finish with 0D(CR), so i cant use gets.
How can i do this?

Thanks

Jaime
 

PIC AT Command and CCS

Hi,

When sending AT Command you can also at add the 0x0D at the end there is not problem. I dont know how to use CCS, im more of the h*tech compiler, but just send the AT and wait for the OK. Use a good program to sniff the data line ( with a buffer to the PC ). I love to use the Docklight that you can find on the web. Has many features that are very useful when working with Modem and MCU.

If you found my answer useful, click on the button that says Helped me. ( NO points will be taken from you! )


Good luck.
 

Re: PIC AT Command and CCS

Thanks for the reply

I have no problem sending at commands.

My problem is receivind data. I need to see one routine that reveivs at commands.
I konw that i have to wait for the OK. But how do I know that i'm receiving an OK?

thanks
 

Re: PIC AT Command and CCS

Hi,
why you can't use getc, this not a connection with NL/CR byte, getc read your receive buffer and get the value to a variable :
buffer[n]=getc(); this in RSRX int subroutine
when you recive he will be writen to the variable buffer[].
0A this is a new line. If your modem return always 0A or 0D after string , den you can use both of them to end of the mesage, you will have one flag start package, flag end package.

temp=getc();
if((temp==0x0A || temp==0x0D) & start package)
{
start package=false;
end package = true;
}
else
{
buffer[x]=temp;
x++;
}

in your program you will check end package, and when it's a true you will read data from buffer and make x=0 anf end ackage=false :

if(end package)
{
end package=false
if(buffer[0]='O' && buffer[1]='K' && x==1)
{
do something;
}
}
 

    jaime

    Points: 2
    Helpful Answer Positive Rating
PIC AT Command and CCS

I understand what you mean but i dont realy see the first part of the program working.

if((temp==0x0A || temp==0x0D) & start package)

i think the program never enter in this condition. There's no start package=true and temp only gets one of the condition 0x0A or 0x0D... do you agree?

Like i said i understand what you mean but i dont know who to do it, so help me a litle more
:)

You got the points!!!

Thanks
 

Re: PIC AT Command and CCS

Hi,
when i write this last night i was a very sleeply and see that i forgot something:

#INT_RDA
void RDA_IRS(void)
{
char temp;
temp=getc();
if((temp==0x0A||temp==0x0D) && package_start)
{
package_start=0;
package_end=1;
}
else
{
if(temp!=0x0A && temp!=0x0D)
{
package_start=1;
buffer[n]=temp;
n++;
}
}
}

this is a package receive.

if(package_end)
{
package_end=0;
if(buffer[0]=='O' && buffer[1]=='K' && n==2)
{
printf("Hello");
n=0;
}
}

and this is check the package, thi is swork, but .... this is only idea, when you have a communication, you must implement this in the communication protocol, because i suppose that you must receive and transmit data to the modem.
 

    jaime

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top