久久久国产一区-久久久国产一区二区三区丝-久久久国产一区二区三区丝袜-久久久国产综合视频-久久久精品白浆无码-久久久精品波多野结衣

羅的密歐
級別: 論壇先鋒
精華主題: 0
發帖數量: 135 個
工控威望: 1215 點
下載積分: 8158 分
在線時間: 108(小時)
注冊時間: 2022-07-22
最后登錄: 2025-02-14
查看羅的密歐的 主題 / 回貼
樓主  發表于: 2024-05-21 09:03
有沒有大佬幫忙的,之前同事弄了iee754,32位單精度16進制轉換十進制浮點,但是離職了。下面分享一下他編寫的,給大佬們看看
if check == 9 and response[0]==0x02  and response[2]==0x04 then
ma=response[5]
mb=response[6]
ma=ma<<8
ma=ma+mb
output=ma


mc=response[3]
mc=mc>>4
mc=mc+1
if mc-8>0 then
mc=mc-8
bin[16]=1
end if
if mc-4>0 then
mc=mc-4
bin[17]=1
end if
if mc-2>0 then
mc=mc-2
bin[18]=1
end if
if mc-1>0 then
mc=mc-1
bin[19]=1
end if


//IEEE754
output=output+1
if output-32768>0 then
output=output-32768
bin[0]=1
end if
if output-16384>0 then
output=output-16384
bin[1]=1
end if
if output-8192>0 then
output=output-8192
bin[2]=1
end if
if output-4096>0 then
output=output-4096
bin[3]=1
end if
if output-2048>0 then
output=output-2048
bin[4]=1
end if
if output-1024>0 then
output=output-1024
bin[5]=1
end if
if output-512>0 then
output=output-512
bin[6]=1
end if
if output-256>0 then
output=output-256
bin[7]=1
end if
if output-128>0 then
output=output-128
bin[8]=1
end if
if output-64>0 then
output=output-64
bin[9]=1
end if
if output-32>0 then
output=output-32
bin[10]=1
end if
if output-16>0 then
output=output-16
bin[11]=1
end if
if output-8>0 then
output=output-8
bin[12]=1
end if
if output-4>0 then
output=output-4
bin[13]=1
end if
if output-2>0 then
output=output-2
bin[14]=1
end if
if output-1>0 then
output=output-1
bin[15]=1
end if

ieee=bin[1]*128+bin[2]*64+bin[3]*32+bin[4]*16+bin[5]*8+bin[6]*4+bin[7]*2+bin[8]
ieee=ieee-127

select case ieee
case 0
ieee2=1
break
case 1
ieee2=2+bin[9]
break
case 2
ieee2=4+bin[9]*2+bin[10]
break
case 3
ieee2=8+bin[9]*4+bin[10]*2+bin[11]
break
case 4
ieee2=16+bin[9]*8+bin[10]*4+bin[11]*2+bin[12]
break
case 5
ieee2=32+bin[9]*16+bin[10]*8+bin[11]*4+bin[12]*2+bin[13]
break
case 6
ieee2=64+bin[9]*32+bin[10]*16+bin[11]*8+bin[12]*4+bin[13]*2+bin[14]
break
case 7
ieee2=128+bin[9]*64+bin[10]*32+bin[11]*16+bin[12]*8+bin[13]*4+bin[14]*2+bin[15]
break
case 8
ieee2=256+bin[9]*128+bin[10]*64+bin[11]*32+bin[12]*16+bin[13]*8+bin[14]*4+bin[15]*2+bin[16]
break
case 9
ieee2=512+bin[9]*256+bin[10]*128+bin[11]*64+bin[12]*32+bin[13]*16+bin[14]*8+bin[15]*4+bin[16]*2+bin[17]
break
case 10
ieee2=1024+bin[9]*512+bin[10]*256+bin[11]*128+bin[12]*64+bin[13]*32+bin[14]*16+bin[15]*8+bin[16]*4+bin[17]*2+bin[18]
break
case 11
ieee2=2048+bin[9]*1024+bin[10]*512+bin[11]*256+bin[12]*128+bin[13]*64+bin[14]*32+bin[15]*16+bin[16]*8+bin[17]*4+bin[18]*2+bin[19]
break
end select
//ieee754


if bin[0]==0 then//負數時不輸出
//SetData(output, "Local HMI", LW, 50, 1)
//SetData(ma, "Local HMI", LW, 100, 1)
//SetData(ieee2, "Local HMI", LW, 50, 1)
//SetData(ieee2, "Local HMI", LW, 100, 1)
ma=ieee2
end if

end if
天下風云出我輩,一入江湖歲月催,皇圖霸業談笑中,不勝人生一場醉。

提劍跨騎揮鬼雨,白骨如山鳥驚飛。塵事如潮人如水,只嘆江湖幾人回。
ren1823
級別: 工控俠客
精華主題: 0
發帖數量: 329 個
工控威望: 2945 點
下載積分: 487 分
在線時間: 456(小時)
注冊時間: 2019-08-01
最后登錄: 2025-02-15
查看ren1823的 主題 / 回貼
1樓  發表于: 2024-05-21 09:23
浮點數、10進制、16進制數底層都是相同的二進制數,只是顯示方式不同而已。上面的程序就是把數的二進制格式的位一個個拆出來然后再按照二進制的位組合成10進制數
羅的密歐
級別: 論壇先鋒
精華主題: 0
發帖數量: 135 個
工控威望: 1215 點
下載積分: 8158 分
在線時間: 108(小時)
注冊時間: 2022-07-22
最后登錄: 2025-02-14
查看羅的密歐的 主題 / 回貼
2樓  發表于: 2024-05-21 11:13
是的,但是我不是正經學編程的,對這個轉換不太理解。十進制轉十六進制這種簡單的就可以
引用
引用第1樓ren1823于2024-05-21 09:23發表的  :
浮點數、10進制、16進制數底層都是相同的二進制數,只是顯示方式不同而已。上面的程序就是把數的二進制格式的位一個個拆出來然后再按照二進制的位組合成10進制數
天下風云出我輩,一入江湖歲月催,皇圖霸業談笑中,不勝人生一場醉。

提劍跨騎揮鬼雨,白骨如山鳥驚飛。塵事如潮人如水,只嘆江湖幾人回。
羅的密歐
級別: 論壇先鋒
精華主題: 0
發帖數量: 135 個
工控威望: 1215 點
下載積分: 8158 分
在線時間: 108(小時)
注冊時間: 2022-07-22
最后登錄: 2025-02-14
查看羅的密歐的 主題 / 回貼
3樓  發表于: 2024-05-21 16:02
額,解決辦法現在不打算研究這個困難的辦法,我就弄成輸入16進制。數據轉換的讓人找手機網頁轉換
天下風云出我輩,一入江湖歲月催,皇圖霸業談笑中,不勝人生一場醉。

提劍跨騎揮鬼雨,白骨如山鳥驚飛。塵事如潮人如水,只嘆江湖幾人回。

主站蜘蛛池模板: 少妇高潮惨叫久久久久久欧美 | 日韩精品无码中文字幕一区二区 | 无码欧美黑人又大又 | 亚洲成av人片天堂网久久浪潮 | 久久综合九色综合国产 | 日本欧美产综合在线 | 夜夜躁日日躁狠狠久久 | 五月天少妇手机免播放 | 国产女人毛多水多A片视频 国产女人毛片好多水 | 亚洲国在线精品国自产拍 | 天天人人综合影视123 | 国产精东剧天美传媒影视林凤娇 | 亚洲一区在线播放 | 无码精品人妻一区二区三区老牛 | 免费人妻精品一区二区三区 | 日韩精品久久人人躁人人噜 | 中文字幕国产专区 | 国产高清一区二区三区直播 | 91精品国产99久久 | av一区二区在线观 | 久久亚洲精品2017 | 天天躁天天夜夜躁人人爽天天天天 | 日韩一级欧美一级在线观看 | av无码天一区二区一三区 | 久久只这里是精品66 | 亚洲精品久久7777777 | 三区日本天堂少妇无码太爽了不卡 | 国产日韩精品欧美一区喷 | 久久久久国产成人精品 | 国产主播一区二区三区在线观看 | 亚洲日韩av无码 | 久久99精品久久久子伦 | 在线成人免费观看国产精品 | 视频一区二区欧美日韩在线 | 精品无码国产自产在线观看水浒传 | 丝袜久久精品视频 | 91精品国产一区二区三区免费一本大道综合伊人精品热热国产 | 日韩成人黄色片 | 国产AV午夜精品一区二区三区 | 春色校园亚洲愉拍自拍 | 精品国产你懂的在线观看 |