如何通过Vb.Net中的串行端口发送和接收Ascii,二进制,十进制,十六进制数据........告诉我有关按钮的编码 [英] How Can I Send And Receive Ascii ,Binary,Decimal,Hex Data Through Serial Port In Vb.Net........Tell Me About Coding Of Button

查看:350
本文介绍了如何通过Vb.Net中的串行端口发送和接收Ascii,二进制,十进制,十六进制数据........告诉我有关按钮的编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即时通讯使用.net 2010并使用串口,​​我可以发送和接收ASCII数据..............

但我在发送时遇到问题接收二进制,十六进制,十进制数据。

请给我解决方案

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

推荐答案

这不是那么简单的解释......



串口不发送ASCII数据,十六进制数据或二进制数据 - 它发送的字节为7或8位块(取决于您配置端口的方式)由链接两端的软件解释为ASCII或二进制数据。

询问发送任何其他内容表示您没有; t了解发生了什么!



所有串口都是两台设备之间的物理连接,支持以约定的速度传输数据(波特率) )和格式(每字符位,奇偶校验,停止位),并允许软件将字节或字节流发送到物理buff呃将它们转移到另一台设备(如果满足流量控制要求)

除了那之外它对数据一无所知 - 它无法判断它是否具有人类可读性,机器可读性或完全性随机:它并不关心。



数据是什么,它代表什么,完全取决于连接两端的软件,并且没有内在字符集或数字基数:它只是一个字节流。



所以你需要看看你想要与之沟通的内容,看看它的期望发送和接收:然后处理。但忘记二进制,十六进制和十进制 - 它们取决于您对数据的解释,与串口无关。
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.


这篇关于如何通过Vb.Net中的串行端口发送和接收Ascii,二进制,十进制,十六进制数据........告诉我有关按钮的编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆