选中String Control,右击,在弹出的快捷菜单中,点击Hex Display。这时,该输入控件只接受16进制的输入。
处理时,得到的就是一段16进制的Buffer。如果是接口通讯内容,你可以直接将其发送。如果作为某种数据输入,你可以使用String/Number Conversion中的 Hexadecimal String To Number方便的处理。
4个字节的16进制也就是无符号型16位整数。昨天试验的时候我的LabVIEW中的Numeric Control不接收16进制的输入,所以只能用String Control的Hex Display来代替。今天又能用了。不好意思~~~
右击Numeric Control选择快捷菜单的Display Format...在弹出的对话框中的选择HexFormat,稍微配置一下,然后就可以了。
如果Numeric Control不能用,只能用String Control。采用事件触发的方式,仍然是HexDisplay,配置String Control的Mouse Leave事件,检查String的长度,或者使用String/ String Subset,截取从Offset开始的Length=4就可以了。然后,再将子字符串输入该StringControl的属性节点Value中。
This VI trims String In (Hex) to Four (4) Bytes and Left-Padding with 0x00 if less than Four (4) Bytes.
It could be better... for your reference.