是德科技
直播中

李小红

7年用户 130经验值
私信 关注
[问答]

怎么将16位二进制数转换成十进制数的函数?

有没有人建立一个将16位二进制数转换成十进制数的函数?谢谢,JB

以上来自于谷歌翻译


     以下为原文

  Has anyone built a function(s) that converts a 16-bit binary number into decimal?

Thanks,
JB  

回帖(4)

刘刚

2019-3-26 11:37:10
如果它已经是一个数字,你所要做的就是改变显示格式 - Properties> NumberFormat。如果它真的是一个字符串(文本),在它前面加上“#B”并使用asuint16()。

以上来自于谷歌翻译


     以下为原文

  If it's already a number, all you have to do is change the display format - Properties > NumberFormat.

If it's really a string (text), put "#B" in front of it and use asuint16().
举报

梁兴力

2019-3-26 11:44:26
Hiis是二进制数串行还是并行?简单方法如下:如果平行,你只需使用公式A * 2 ^ 15 + B * 2 ^ 14 ...... + P * 2 ^ 0(A是MSB,P
是LSB)如果是连续的,你必须处理字符串

以上来自于谷歌翻译


     以下为原文

  Hi
is the binary number serial or parallel?
the simple method is below.
if parallel , you just use formula      A*2^15+B*2^14......+P*2^0    (A is MSB, P is LSB)
if serial , you must process the string
举报

曹皓轩

2019-3-26 11:51:49
通常,如果您有任何问题,第一步是查看VEE安装下的示例文件夹。有大量示例涵盖了VEE编程的不同方面。关于您的问题,我附上了在examples文件夹下找到的示例。
我希望它能做到你想要的。

以上来自于谷歌翻译


     以下为原文

  Normally if you have any questions the first step is to look into examples folder under VEE installation.
There are a huge number of examples that cover different aspects of VEE programming.

About your question, I have attached the example that was found under examples folder.
I hope it does what you want.

附件

举报

h1654155275.6260

2019-3-26 12:07:43
要补充jkinzie更改显示格式的答案,请转到视图>属性。然后,您将看到属性面板,要以不同格式显示的属性是NumberFormat,双击它并修改为
你想要使用的格式.Vee没有注意数字的格式,它只是在显示时你必须指定你想如何看它。编辑:你可以尝试做一个像#B1010101010101010这样的常量(
#B表示它是二进制的并且用一个简单的字母数字对象显示它,但是将其NumberFormat属性改为Dec.Vee会自动将#B .....改为常量对象中的十进制,以防你想继续看
它在二进制上显示更改Constant对象的NumberFormat。注意:您可以将#B或#b用于二进制,#H或#h用于十六进制。

以上来自于谷歌翻译


     以下为原文

  To complement jkinzie´s answer to change the display format, go to View > Properties.
You will then see the properties panel, the property you want to move in order to display in different formats is the NumberFormat, double click on it and modify to the format you want to use.
Vee doesn´t pay attention to the format of the number, it is just when displaying when you have to specify how do you want to see it.

Edit:
You can try doing a constant like #B1010101010101010 (#B means it is binary) and displaying it with a simple alpha numeric object but changing its NumberFormat property to Dec.
Vee will automatically change the #B..... to decimal in the constant object, in case you want to keep seeing it displayed on binary change the NumberFormat of the Constant object.

Note:
You can use #B or #b for binary, #H or #h for hex.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分