rlucian90
Junior Member level 1
- Joined
- Sep 21, 2012
- Messages
- 15
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,410
Hello guys.
I have a problem interfacing a phone with pic 16f648a.
The problem is when i try to sync the phone with the pic and after that i can send the command from pic to phone to send sms.
To sync the pic with the phone is very simple, i need to send AT until phone gives me a reply OK., so i thought the easiest way of doing this is using the UART1_READY function from the mikroC.
It's working this way sometimes but not always and i don't know why. Why does the UART1_READY function remains 0 if my phone send OK?
How can i make it?
Thank you so much.
I have a problem interfacing a phone with pic 16f648a.
The problem is when i try to sync the phone with the pic and after that i can send the command from pic to phone to send sms.
To sync the pic with the phone is very simple, i need to send AT until phone gives me a reply OK., so i thought the easiest way of doing this is using the UART1_READY function from the mikroC.
It's working this way sometimes but not always and i don't know why. Why does the UART1_READY function remains 0 if my phone send OK?
How can i make it?
Thank you so much.
Code:
while(1)
{
if(PORTB.B5==1) //button pressed
{ //if it is still pressed after 50ms then
Delay_ms(50); //send SMS
if(PORTB.B5==1)
{
UART1_Init(9600); //init UART
Delay_ms(3000);
//wait for stabilize
while (!UART1_Data_Ready()) {
//sync with modem
sms_AT();
}
trash = UART1_Read(); //clear buffer for next event
sms_mode(); //the text mode for sms
sms_nr(); //sms number to call
sms_msg(); //sms message to send
Delay_ms(100); //light LED
PORTB.B0=1;
Delay_ms(100);
PORTB.B0=0;
Delay_ms(1000);
} //button deboundcer end
} //button pressed end
else
{
PORTB.B0=0;
}
} //While end
}