Microcontroller › PIC › usart transmission problem › Hi Kingshuk,You haven’t
April 1, 2013 at 5:45 pm
#9405
Participant
Hi Kingshuk,
You haven’t written anything inside an infinite loop, but you can see the data being sent again and again.
Most probably your controller is getting restarted again and again after sending some data, that’s why you feel that the controller is continuosly sending data.
The reason for such an issue is always related with memory shortage. You might be either trying to allocate memory which is not avilable at the moment or trying to access memory which has not been allocated (using pointers).
This is basically run time error. Suggest you to thoroughly analyse your pointer usage.
For example in the following function;
void gsm_cmd(unsigned char *string)
{
int i=0;j=0;
while(string!=”)
{
if(string==0x5C) // Not to send ” cahracter
i++;
else //#### TRY PUT AN ELSE HERE ####
putch(string); // Send by serial communication
i++;
}
Try this also; change to ‘const char’
const char *sms_format=”AT+CMGF=1″;
const char *sms_write=”AT+CMGS=”9038940850″”; // 10-Digit Mobile Number
const char *sms=”Hello”;
const char *sms_report=”SMS Sent…”;
Change to this type in function defenitions and wherever required.