The function below reads characters from a UART and puts them in an array. It contains a repsonse from a hardware device.
In main I want to check that the array contains the correct response.
How can I get getData()
to return an array and how can I compare this array to the correctResponse
array?
void getData(int length){
int i;
int buffresponse[6];
for (i = 0; i < length; i++)
{
//Perform a single character read from the UART interfac
buffresponse[i] = getcharacter(UART_4);
}
buffresponse[i] = 0;
}
int main(void)
{
unsigned char correctResponse[] = { 0x56, 0x00, 0x26, 0x00 };
getData();
}
}