i have written a library in C for using the SIM900 GSM with my uC but it has many many bugs. Sometimes it works sometimes not. My hardware works fine I think.
I rewrote it and made sure that the basic functions are bug free.
Now I want to write the SIM900_command function that will use SIM900_transmit( char* ) and SIM900_reveive( char** );
How to know how much time to wait between AT command and receiving the answer from SIM900. I do not want to just put _delay_ms(1000).
Thanks in advance...
Usually, you wait until a character is available and then receive it. Have a look here. There you have for AVR devices with a single UART:
unsigned char uart_recieve (void)
{
while(!(UCSRA) & (1<<RXC));
return UDR;
}
So, with while(!(UCSRA) & (1<<RXC));
you basically block execution until there is a character available at the uart.