Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

this needs to be PLP TOOLS The Task In this project, you will be converting ASCI

ID: 3786294 • Letter: T

Question

this needs to be PLP TOOLS

The Task In this project, you will be converting ASCII strings received from the UART into an integer value that is passed to a provided print function. Strings will be terminated using a semicolon (;) character. Your program should be able to handle multiple strings concatenated together and treat each string ending with a ';' as a separate input. When processing strings, it should detect any invalid characters within a string. Invalid characters are any characters other than '0' through '9' and ';'. If an invalid character is detected the rest of the string (i.e. a characters leading up to and including the next ';') should be received by the UART, but ignored. Your program should then use the print function to output an error message and then continue processing the next string as a new string.

Explanation / Answer

According to your requirement I'm writing the code.

char data = 52; // or char data = 0x34;
char nibble_data;

nibble_data = ((data & 0xf0) >> 4) + '0';
if (nibble_data > '9') nibble_data += 'A' - '9';
TXREG = nibble_data;
while(PIR1.TXIF==0);

nibble_data = (data & 0x0f) + '0';

if (nibble_data > '9') nibble_data += 'A' - '9';
TXREG = nibble_data;
while(PIR1.TXIF==0);

I didn't got any chance to test this code. Can you please check it out.