以 3 字节数据包发送数据
我正在尝试使用 Visual C++ 向我的 LAC 板发送命令。在 LAC Config 的第 6 页上,它表示缓冲区以 3 字节数据包发送。
Buffer[0]=Control
Buffer[1]=Data Low
Buffer[2]=Data High
这是什么意思?我如何确定应该将这些值设置为什么?
谢谢
I am trying to send a command to my LAC board using visual c++. On page 6 of LAC Config it says that the Buffer is sent in a 3-byte packet.
Buffer[0]=Control
Buffer[1]=Data Low
Buffer[2]=Data High
What does this mean and how do I figure out what I should set each of these values to?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您继续阅读,您将看到接下来是所有控制代码的列表,后面是每个控制代码的详细描述。该手册还提到可以使用示例代码,可能位于其网站上的某个位置。
一般来说,设置这些值有点棘手。
BYTE
可能是解析为无符号 8 位数据类型的 typedef 或宏,这意味着它只能保存 0 到 255 之间的值。两个字节最多可以表示 65535 的值。但是,如果您如果该缓冲区想要存储大于 255 的值,则必须将其分解为高字节和低字节。您可以通过以下方式执行此操作:If you read on, you will see that next comes a list of all control-codes, followed by a detailed description of each of them. The manual also mentions that sample-code is available, probably somewhere on their website.
In general, setting the values is a bit tricky.
BYTE
is probably a typedef or macro that resolves to an unsigned 8-bit data-type, meaning it can only hold values from 0 to 255. Two bytes could represent values up to 65535. However, if you want to store a value greater than 255 if that buffer, you'd have to decompose it into its higher and lower byte. You can do this the following way: