lloydi12345
Member
I tried AT commands on hyperterminal and they have no problem. I have written a program and it just can't receive the character 'O' or even 'K' on its uart1_read(). I don't know if it's because of the phone or because of the simulation. I checked everything by virtual terminal using Proteus and the phone used is T68i ericsson. The format allowed only is in PDU.
if I change the while statement to this:
or even this:
it works fine. But I don't really have any interest on the echoed message, I want to check if I'm receiving "OK" message.
Can you help me how to check "OK" here on mikroC PRO?
Code:
char i;
char rec[10];
char old;
void main(){
portb = 0x00;
adcon1 = 0x06;
cmcon = 0x07;
trisb = 0x00;
uart1_init(9600);
delay_ms(500);
uart1_write_text("AT\r"); // Send "AT" and press enter
delay_ms(2000);
i = 0;
do {
while(!UART1_Data_Ready()) {
; // just wait here until a char appears
}
old = UART1_Read();
rec[i++] = old;
} while (old != 'O');
portb = 0xff; // Flash LEDs
}
if I change the while statement to this:
Code:
while (old != 'A')
Code:
while (old != 'T)
Can you help me how to check "OK" here on mikroC PRO?
Attachments
Last edited: