Data type serial communication problem

Category: VC/MFC -> ATL/ActiveX/COM Author: myisdog002 Date: 2001-07-08 19:49:40
 
myisdog002
2001-07-08 19:49:40
When using vc serial communication ,
getinbuffercount () function to get a number of binary buffer it or other types ?
are used in the data transmission hardware layer binary number to complete, from the hardware layer to the software layer , to complete the conversion of data types is by who complete it?
linliqun55
2001-07-08 20:02:05
This is my code, MSCOMM32.ocx controls, no problem, has been used for many years without problems :
void   CMy72V300AView :: OnCommMscomm1 ()
{
VARIANT   variant_inp;
COleSafeArray   safearray_inp;
long   i   =   0, len;
switch   (m_Comm1.get_CommEvent ())
{
case   2:
// expressed in the receive buffer character
{

variant_inp   =   m_Comm1.get_Input ();
safearray_inp   =   variant_inp;
len   =   safearray_inp.GetOneDimSize ();
for   (i   =   0;   i   <   len;   i ++)
{
safearray_inp.GetElement (& i,   & m_ReceBuff [i]);      
}      
m_Comm1.put_OutBufferCount ( 0); //   ' empty transmit buffer
m_Comm1.put_InBufferCount (0); //  ' slippery empty receive buffer
safearray_inp.Clear ();
}
break;
default:
break;
}
}
serial port initialization :
view1- > m_Comm1.put_CommPort (1);   / / Serial 1
view1- > m_Comm1.put_InBufferSize (4096);   // set the input buffer size , Bytes      
view1- > m_Comm1.put_OutBufferSize (2048);   // set the size of the input buffer , Bytes      
if (view1- >! m_Comm1.get_PortOpen ())   // open serial
{
view1 - > m_Comm1.put_PortOpen (true);      
}
view1- > m_Comm1.put_OutBufferCount (0); //   ' empty transmit buffer
view1 - > m_Comm1.put_InBufferCount (0); //   ' slippery empty receive buffer

view1- > m_Comm1.put_InputMode (1);   // set the input mode to binary mode      
view1- > m_Comm1.put_Settings (str);   // set the baud rate and other parameters      
view1- > m_Comm1.put_RThreshold (8);   // said there are eight to eight characters that raise events      
view1- > m_Comm1.put_InputLen (0);
jdlxjb
2001-07-08 20:19:00
about communication , recommendations are used to send and receive binary
lovefen112
2001-07-08 20:35:21

I have not thoroughly understand how to use other types of data transmission na

I just want to know getinbuffercount () function to obtain the binary data or other types of ?
yuexiaoqing
2001-07-08 20:49:44
your question can be confusing
bai00000baibin00000
2001-07-08 21:03:04
the number of characters in the buffer returned by this function is an integer , not a binary or character
demortx333
2001-07-08 21:24:53
certainly binary ah
computer world , only 0 and 1
dazhou1112072460168
2001-07-08 21:59:44


data types do not need to walk around it?
you directly put the received data dump , ah , will not go wrong in certain circumstances ?
Why do I see some code that needs to transfer data type it?
solving
zisechibang
2001-07-08 22:23:44

to store data in the buffer when it should be a binary data type , right ?
is not returned after the data type from the buffer to be reduced to (char, int, long) of the various types of data ? ? ?
qiu1001
2001-07-08 22:39:04
before
serial receive and send data to see a lot of code that are related to data conversion , string directly into any specific requirements completely impossible
serial data conversion is it in ?
I see your code simply will accept data over the structure of the body and the safe array ,
is not needed to receive and send data over the side COlevariant   's structure ? ? ? ?