Serial Port Complete - Latest Microcontroller projects

(lily) #1

Chapter 13


 void command_read_byte(void)
{
switch (received_command[3])
{
case 'b':
{
// Read Port B.
// Store the value read and a LF to send in the response.


byte_to_ascii_hex(PORTB, &command_response[2]);
command_response[4] = 0x0a;

prepare_to_respond();
break;
}
// Add more cases as needed.

default:
break;
}
}
Free download pdf