This explanations are for the device search in case device like PC. The PC attached device’s com port number assignment is not fixed. If connecting MCU and UART in Embedded System,  it doesn’t need automatic search.

In case of device detecting COM port from host, there is case that user choose COM port to communicate in application program. This means bad products design regardless of user’s convenience. It has to be designed that the program search COM port connected with device automatically. This function can not be solved only by software. It has to set the function to search automatically in the device.

COM port searching method

In LXSDF T5A packet,  “Com port search information” which is PCD0[31] and  “LXDeviceID” which is  PCD0[30] and PCD1[30] are used to find proper COM port of the product for information to use device search.

You can find the device’s COM port easily if practicing the procures as the following explanation cycling all the Com port from host in order. Open one COM port temporarily and process the data received like the following table.

 Flow Chart  Steps.  Description
 Step 1. If sync bytes (255, 255, 255, 255, 254) is detected :  It’s possible device to communicate. Goto step 2.

If sync bytes is not detected  : it’s not  LXSDF T5A packet. Start again opening another COM port.

 Step 2. If PC (Packet Count ) value becomes number 31, it is sure of the device transmitting data to LXSDF T5A Format. However, it could transmit the same format data like LXSDF T5A in some products coincidentally. For occupying safely, if the PCD0[31] is 110, it is sure that is LXSDF T5A packet.
 Step 3. If device is communicated by LXSDF T5A format, the next phase is to search device to communicate. At this time, check PCD0[30] and PCD1[30] which is product’s LXDeviceID to communicate.