??? 03/09/07 08:50 Modified: 03/09/07 09:24 Read: times |
#134622 - Initial command sending code; help me take a look! Responding to: ???'s previous message |
. . Modem_Send("ATDT1234567"); . . void Modem_Send (char *str) { for (; *str != '\0'; str ++) { if (*str == '\n') //send Carriage return at the end of command { TI = 0; // Clear TI Flag while(TI != 1) // Check if byte is successfully sent out SBUF = "\n"; } else { TI = 0; // Clear TI Flag while(TI != 1) // Check if byte is successfully sent out SBUF = *str; //send each character of AT Command } } } Based on the guide and clues by everyone, i have created a simple function of sending a string to modem for now. I do not know if this is actually working yet since i do have the uC with me now so i could not test it yet. Help me take a look at this code to see if it is actually working and leave some comments if i did anything unncessary or maybe i accidentaly left something out. This of course, does not include sending more than one command since i have not written the function for detecting "OK" and "ERROR" response from the modem yet. |