The easiest way is to take the data from each of the buttons and put them into an array builder. Take the output of this array builder and pass it to a 1D array search function that is searching for the first array element that set to a TRUE (meaning the button has been pressed). The output of this search routine will be either a -1 (meaning no buttons were pressed) or the index of the button that was pressed.
If the output is -1, do nothing. Otherwise, use the index to index into an array of command strings and send the selected string to the serial port.
If you need more detail let me know and I'll put something together for you...
Mike...