https://www.ccsinfo.com/forum/viewtopic.php?p=168648
In the link I provided in my previous post there is FTP section. In that it contains 2 codes, one for Arduino and another for Raspberry Pi. Use the Arduino code. You have to convert the Arduino related code.
Try to make a code using the AT command sequence mentioned in the code (link in post #4) and use the template code given below. I will write a code for you but I need a 2 or 3 days time.
Code C - [expand] |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
| const char gprsBuffer[200];
const char response[] = "OK";
const char cmd_at[] = "AT\r\n";
char temp[30];
void Interrupt(){
if(//Test if UART Interrupt flag is set here){
gprsBuffer[i++] = UART2_Read();
gprsBuffer[i] = '\0';
//Clear UART Interrupt flag here
}
}
// copy const to ram string
char * CopyConst2Ram(char *dest, const char *src){
char * d ;
d = dest;
for(;*dest++ = *src++;)
;
return d;
}
//Use loop like below for each AT command you send
//Replace the Delay_ms() function with milli sec delay function provided by your compiler
//Provide proper delay for each AT command as required
while(strstr(gprsBuffer, CopyConst2Ram(temp, response) == 0){
UART_Write_Text(cmd_at);
Delay_ms(2000);
i = 0;
}
//clear gprsbuffer[] here
//another loop here to send another AT command.
//If needed make a function which includes the above loop and clear buffer code and call it to send different AT commands
//You should also pass delay value to function so that delay can be changed as needed for different AT commands |
Provide me an ISR code to receive UART data and also provide me a Timer interrupt code which interrupts every 500 ms or 1 sec. Also provide me the names of Timerx enable bit, Timerx interrupt flag bit, UART interrupt enable bit, UART interrupt flag bit. I need them to write a code.
I have made a function for mikroC code and I have used it for GSM and GPRS projects. If you provide the above mentioned data then I will make a function for you.
My function prototype is like this.
Code C - [expand] |
1
| void GSM_Send_AT_Cmd(void (*myUARTxfp)(char *), char *buff, int lenBuff, const char *atResponse, const char *atCmd, const char *aterr, char *Const2RamBuff, int lenConst2RamBuff, unsigned int sec, unsigned int *ptr2i, unsigned int *ptr2AttemptFlag, unsigned int *ptr2timeCnt, unsigned int *ptr2time) |