10 years ago.

Suggestion on coding approach

Hello everybody, I am evaluating to use mbed for a new project. The project is a stand-alone test system that normally runs a finite state machine with a scan time in the order of 10 - 20 ms. During the tuning and/or debugging of the system, I need to have the possibility to connect to the system and remotely control it either via serial port or via Ethernet. The remote control via serial port it is not a problem because my protocol has a terminator character so, even while the finite state machine is running, I enqueue the incoming characters and if a terminator character was received I manage the command. The problem is on the remote control via ethernet port because, even if I work in non-blocking mode, for checking if a connection request from a client is pending I have to set a timeout that slows down the finite state machine. My question then is: what is the best coding approach in this situation? Is it better to use the mbed RTOS and manage the communication in a dedicated thread? Thank you in advance!

Be the first to answer this question.