My thought is to want to put the inside of the serial port to receive the byte data extracted, but I can't make it show, Debug, but you can see the corresponding variable is correct, strives for the great god action, the code is as follows:
The VARIANT variant_inp; COleSafeArray safearray_inp; Long len, k; K=m_mscomm. Get_InBufferCount (); The receive buffer characters// BYTE rxdata [92160]={}; If (k> 0) { Variant_inp=m_mscomm. Get_Input ();//read buffer Safearray_inp=variant_inp;//the VARIANT type variables into ColeSafeArray type Len=safearray_inp. GetOneDimSize ();//to get effective data length For (k=0; KSafearray_inp. GetElement (& amp; K, rxdata + k);//is converted into a BYTE array, deposit rxdata }
For (int j=0; j{ If (rxdata [j]==0 x6d & amp; & Rxdata + 9 [j]==0 x3c)//extraction temperature data { Char STR=rxdata + 6 [j]; Wendu. The Format (_T (" % d) ", STR); M_VoltageDisplay=wendu; } } }
The UpdateData (FALSE);
}
Probably is this meaning; Like every time I send 10 bytes, baotou is in the beginning, 0 x6d, tail is 0 x3c, 7th is my need to extract data, after extracted, according to the engineering code, rarely leave email I sent to the great god, action, genuflect is begged
CodePudding user response:
for (int j=0; j{ If (rxdata [j]==0 x6d & amp; & Rxdata + 9 [j]==0 x3c)//extraction temperature data { Char STR=rxdata + 6 [j]; Wendu. The Format (_T (" % d) ", STR); M_VoltageDisplay=wendu; } }
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- What do you mean the data here? The value of STR? You under the Debug debugging data correct? Had better not use char types, convert BYTE, char is a symbol of Numbers, range is 128 ~ 127, BYTE is unsigned, the range is 0 to 255. If the data is beyond the scope of char, may finally the value of the data is not what you want,