Hi Everyone, my application is composed of a main loop that reads values of A/D Inputs, data from 4 COM Ports (2x NMEA, 1xIMU, 1x XBEE) and takes decision about switching on/off relay according to some user defined conditions. A C# application runs on a computer that sends some request about data values in “real timet” to my EMX. The link between the computer is the CDC with debugging functionnalities. Actually my main loop iterates in 300ms-400ms depending on the number of conditions to check but the application that runs on the computer have a timeout of 300ms (this application was designed for a previous project). In some bad cases even if I send correct data, my application on the computer put in the garbage the answer send by the EMX). The fact is that I collect requests only once in the loop and send answer as soon as possible but this is not enough.
Therefore I have two options: Threading (but sending answer needs to retrieve data and therefore I am obliged to lock an important data structure which stop other thread untill unlocking and the payload will be very big).
The other option I think is to work with event such as the one that exists for serial port as soon as data are received. Does this functionnality exists or can be implemented for the CDC?