I am having a problem receiving data from a serial port.
In fact, the serial port receives MIDI information, it is no problem to set the baud rate to the midi standard of 31,25 KHz.

What I need is the following.

The sequence of CHR(176) + CHR(44) + CHR(69) should turn a port pin 'on'
The sequence of CHR(176) + CHR(44) + CHR(5) should turn a port pin 'off'

While this is running, a random combination of characters may appear on the input, but this should not influence the status of the output pin used.
The output should only react on 176+44+69 AND 176+44+5
I have made something already, but it seems this is not reliable.
Any ideas? Suggestions are highly appreciated!