Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i m using .net 2010 and working with serial port,i can send and receive ASCII data..............
but i have problem in sending and receiving binary,hex,decimal data.
please give me solution
Posted
Comments
Nelek 25-Nov-14 3:48am    
Don't think we can read minds or do astral projections to see your monitor. If you need help, the least you could do is to add some relevant code to your question or to explain your problem in such a way, that the users of CP can understand it. Otherwise, nobody will be able to help you.

Please use the "improve question" and add relevant information or a piece of code envolved. There are thousands of ways to screw things up, how are we supposed to know which one did you choose?

I strongly recommend you to read:
What have you tried?[^]
How to ask a question?[^]

1 solution

This is not going to be that simple to explain...

A serial port doesn't send "ASCII data", "Hex data", or "Binary data" - it sends bytes, which are 7 or 8 bit "chunks" (depending on how you have configured the port) which are interpreted as ASCII or binary data by the software at both ends of the link.
To ask about sending anything else indicates that you don;t understand what is going on!

All a serial port is, is a physical connection between two pieces of equipment which supports transmission of data at an agreed speed (the baud rate) and format (bits per character, parity, stop bits) and which allows software to send a byte or stream of bytes to the physical buffer which transfers them to the other device (if the flow control requirements are met)
It knows nothing about the data other than that - it can't tell if it human readable, machine readable, or totally random: and it doesn't care.

What the data is, and what it represents, is entirely up to the software at the two ends of the connection and has no intrinsic character set, or number base: it's just a byte stream.

So you need to look at what you are trying to communicate with, and see what it expects to send and receive: and then deal with that. But forget "binary" and "hex" and "decimal" - they are down to your interpretation of the data, nothing to do with the serial port.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900