迪文科技论坛

 找回密码
 立即注册
搜索
查看: 162|回复: 2

[Question]How to convert float number via <Variable data input> ?

[复制链接]

9

主题

65

回帖

264

积分

中级会员

Rank: 3Rank: 3

积分
264
发表于 2023-7-17 18:22:13 | 显示全部楼层 |阅读模式
Hi, I'm using <Variable data input> to input my numbers as float (ex. 123.45)
with below properties :

    - Data auto-uploading : (checked)
    - Variable type : Long int(double word)
    - Integer digits : 3
    - Decimal digits : 2
    - VP(0x) : 2000

And linked it to <Data variable display> to show my number.
No problem to disaply the number on my <Data variable display>.

But, when I try to input

     9 => (11) : 5a a5 08 83 20 00 02 00 00 03 84
     1.2 => (11) : 5a a5 08 83 20 00 02 00 00 00 78

I assume "02 00 00 03 84" is 9, but how it can be converted like that ?
And how abut real float like my 1.2 ?

Could you exaplin how I can convert it to the real number via console message ?
回复

使用道具 举报

0

主题

332

回帖

9539

积分

论坛元老

Rank: 8Rank: 8

积分
9539
发表于 2023-7-17 20:02:28 | 显示全部楼层
Hello, decimals are expressed in the form of fixed point decimals, such as 0X3039 (the hexadecimal number of 12345). The specified decimal places are 2, representing 123.45,Refer to this link for the Floating-point arithmetic conversion tool[url=【提问】开发应用指南的浮点数转换工具 http://inforum.dwin.com.cn:20080 ... d=1910&fromuid=9665 (出处: 迪文科技论坛)]【提问】开发应用指南的浮点数转换工具 http://inforum.dwin.com.cn:20080 ... d=1910&fromuid=9665 (出处: 迪文科技论坛)[/url]
回复

使用道具 举报

9

主题

65

回帖

264

积分

中级会员

Rank: 3Rank: 3

积分
264
 楼主| 发表于 2023-7-19 13:46:07 | 显示全部楼层
Thanks alot for your info, 一袋米好重 !

I see that a first number, '2' is the position of floating point.
I'm using decimal digits to 2, and it will be 3 if my decimal digits are changed to 3...

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|迪文科技论坛 ( 京ICP备05033781号-1 )

GMT+8, 2024-12-28 16:30 , Processed in 0.087657 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表