hi all,
i would like to implement a serial controller controlling 7 segment display to c++.
Can anyone just give me an algorithm so i can apply it to c++ coding??i dont need the code just plain simple pseudo code will do.

The controller decodes incoming hexadecimal encoded in ASCII text stream.Assume input stream is stored in an input buffer from where the command handler reads each character. Valid commands are stored in the command buffer and a command handler reads them and executes them thereby updating the current display. the command is: [$] [UP/DOWN?STOP]. the $ is the start character for each command, UP increments the output value, DOWN decrements the output value while STOP sets the output value to 0 if the output is below 5. the output range is from 0 to 9.