while reading a data through the serial port.I want to know that the data which is coming through the port in which format it is ? wheathr ASCII, Decimal or Hexa or in Bytes it is, plz any boby give the hint
Use a terminal program like HyperTerminal or TeraTerm to see the output from the serial device. You can use these software to establish a connection from your PC to the device, then check the output on your screen to determine the data format.
Also check the manufacturer manual, they typically will details about the data format and also the serial port connection details (baud rate etc).
It depends upon how you are configuring serial port to connect the device: data length (Bytesize) is one of the property to decide data to receive and ofcourse how the device is transferring
DCB structure looks like following:
DWORD BaudRate: Speed
BYTE StopBits: 0,1,2 = 1, 1.5, 2 (default = 0)
BYTE Parity: 0-4= no, odd, even, mark, space (default = 0)
BYTE ByteSize: Number of bits/byte, 4-8 (default = 8)
Last one decides the data stream and all other decides the connectivity..
ByteSize is simply the number of bits the device manufacturer has chosen to use per BYTE of data the device outputs. Typically they use 7 or 8: the range itself is limited to 5,6,7 or 8.
So there will be this BYTE stream irrespective of ASCII, HEX format. For example you can have both ASCII or HEX format using any of the 5,6,7 or 8 bits per BYTE.
Which is why one should look at the manufacturer manuals or try the hyperterminal to see that data format.