hi every body
I am using mplab...I am not expert in microcontroller programming ...
I have made GUI to send data to my serial port ...
now I want to write a program in PIC that executes accordingly the serially sent data to my serial port and send data back to the serial port as well....
I am beginner to this so please help to begin with serial port communication..
char *Receive_MSG(char *String, unsigned short int MSG_Length)
{
unsigned short int Index = 0; // Message Index
while(Index < MSG_Length)
{
String[Index] = Receive_Byte();
if(String[Index] != 13 && String[Index] != 10)
{
String[Index + 1] = '\0'; // Set the next character to NULL
Index++;
}
else
{
String[Index + 1] = '\0'; // Set the next character to NULL
break;
}
}
return String;
}
Send a string to the HyperTerminal
Code:
void Send_MSG(char *Message)
{
unsigned short int Index = 0;
while(Message[Index] != '\0')
{
Send_Byte(Message[Index]);
Index++;
}
Send_Byte(13); // Send CR
Send_Byte(10); // Send LF
}