开发者

How to pass decimal values over serialport in C#? [closed]

开发者 https://www.devze.com 2023-02-01 21:03 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, 开发者_Go百科or rhetorical andcannot be reasonably answered in its current form. F
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, 开发者_Go百科or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

how to pass decimal values over serialport control?


Start by convering whatever values that you want to pass into a byte array (System.Byte()), and then use the SerialPort.Write(Byte(), Int32, Int32) overload to write them to the serial port.

That overload allows you to specify the array of bytes that will be passed, the offset of the array at which to begin, and the number of bytes out of the array that should be passed.

Obviously you've looked already, so you know that you are not going to find an overload for the SerialPort.Write method that writes integer or decimal values directly.


Use SerialPort Class.

0

精彩评论

暂无评论...
验证码 换一张
取 消