varunme
Advanced Member level 3
For this program to initiate by interrupt
Below interrupt code is correct?
Code:
void Send_SMS(char *s1, char *s2, const char *s3, const char *s4, const char *s5, const char *s6, const char *s7, char *s8, unsigned int *idx, char *gsmAttempt, char clr) {
while(strstr(s1, CopyConst2Ram(s2, s3)) == 0) {
GSM_Send_Const_Command(s1, s2, s3, s5, idx, gsmAttempt, 1);
GSM_Send_Const_Command(s1, s2, s3, s6, idx, gsmAttempt, 1);
GSM_Send_Const_Command(s1, s2, s4, s7, idx, gsmAttempt, 1);
UART1_Write_Text(s8);
Delay_ms(500);
UART1_Write(0x1A);
DelayXSec(6);
}
memset(gsmBuffer, '\0', sizeof(gsmBuffer));
(*idx) = 0;
}
Below interrupt code is correct?
Code:
unsigned cnt, cnt1;
char rxchar, i = 0, flag = 0; // Variable for storing the data from UART and array counter
unsigned char rxarray[80]; // array to store the received charaters
unsigned short j;
void interrupt() {
if (PIR1.RCIF) { // test the interrupt for uart rx
rxchar = Uart1_Read(); //
rxarray[i] = rxchar;
i++;
// ******************************************************
// Only select one of the following statements
if (rxchar == 36) { // select this if looking for a terminating character
flag = 1;
} // end if (rxchar == "$")
PIR1.RCIF = 0; // clear RCIF
} // end if (PIR1.RCIF)
}