输出到RS232端口。 [英] Output to a RS232 Port.

查看:71
本文介绍了输出到RS232端口。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在试图弄清楚如何将一串数据发送到一个COM端口。

我的字符串的接收端将是一台机器,它将从我那里得到的东西指向某些机器。

我将使用来自用户的数据构建字符串。我不知道我是否应该首先构建一个表,然后将表的一行发送到端口或尝试构建一个要发送的字符串。

该字符串将包含8个字节的字段byte0是常数400,而字节1-7将是来自用户的数据。

我开始构建一个表,然后只用所需的数据更新表。但是我不知道我是否可以将表格中的单行数据发送到com端口。

我真的在寻找任何有关这方面做法的建议。

感谢您过去的所有帮助,并期待您的良好见解。

I''m trying to figure out how to send a string of data to a com port.
The receiving end of my string will be a machine that directs what it gets from me to certain machines.
I will build the string using data from the user. I don''t know if I should build a table first and then send the one line of the table to the port or try and build a string to send.
The string will consist of 8 byte fields byte0 is a constant number of 400 while byte 1 - 7 will be data from the user.
I started by building a table and then just updating the table with the data needed. However I don''t know if I can send the single line of data from the table to the com port.
I''m really looking for any advise on a good way to do this.
Thanks for all your help in the past and looking forward to your good insight.

推荐答案

作为一般规则,您不会可以直接访问任何系统的端口Tom。您是否有某种API可以让您与RS232端口连接?
As a general rule you won''t have direct access to any of the system''s ports Tom. Do you have some sort of API in mind that allows you to interface with the RS232 port?


就像我提到的这是我第一次尝试这样的东西,所以任何建议将不胜感激。

我确实在互联网上找到了一些代码,我想弄清楚我已经在这里列出了一个.bas和一些示例代码
Like I mentioned this is my first time trying something like this so any advice would be greatly appreciated.
I did find some code on the internet that I''m trying to figure out I''ve listed it here there is a .bas and some sample code
展开 | 选择 | Wrap | 行号


看起来你有一个可行的方法汤姆。不幸的是,你需要有理解该特定API的人来帮助你。


我假设你知道这个代码实际上会被允许运行吗?正如我之前所说,标准代码无法直接访问硬件。另一方面,您使用的API很可能来自信任的位置(IE。来自HAL的正确一侧 - 操作系统的硬件抽象层)。

我可以在VBA方面提供帮助,但看起来这不是你需要的。
It looks like you have a workable approach available Tom. Unfortunately, you need someone with the understanding of that particular API to help you.

I assume you know that this code will actually be allowed to run? As I said earlier, standard code not have direct access to the hardware. On the other hand, it may well be that the API you''re using goes from a position of trust (IE. from the correct side of the HAL - Hardware Abstraction Layer - of the OS).

I could help on the VBA side, but it looks like that isn''t what you need here.


这篇关于输出到RS232端口。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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