I have made the following function outside the main() that calls the MCC generated function "EUSART1_Read()". I need to get a string basically through the following function but this has some issues that involves return types and assignments. Can someone please have a look and help me to resolve the issue in receiving the string using the MCC generated function.
Code:
char EUSART_Read(void)
{
int i = 0;
char rx = 'a';
char rx_string[10];
while (rx != 0x0d)
{
rx = EUSART1_Read(); // Return type of this function is uint8_t
rx_string[i] = rx; // store the data in string
i++;
}
return rx_string;
}
I need to call this function in the main() function but it says that rx_string is not assignable.
Code:
rx_string = EUSART_Read();
Even if I define rx_string as uint8_t, the problem is the same. Somewhere I am not using the correct data type and return type.
Hi, I am using PIC18F Microcontroller with XC8 compiler in MPLAB. I am wondering about UART read and write functions.There exist puts() and gets() functions in the library. Can I send and receive data serially through these two functions ? What is the difference between puts() and gets()...
Hi, I am able to receive character using EUSART1_Read(); function in PIC 18F but I need to receive a complete string of 30 to 50 characters which is terminated by enter from keyboard. I am not sure if I need to use push() function as well or not. I wrote this function outside the mai...