Benchtop Measurement and Test
Distributed Measurement and Control
High-Performance Test
Systems Engineering Software
Perspectives showcases how NI sees what’s next in the world of test and technology.
You can request repair, RMA, schedule calibration, or get technical support. A valid service agreement may be required.
Provides support for NI data acquisition and signal conditioning devices.
Provides support for Ethernet, GPIB, serial, USB, and other types of instruments.
Provides support for NI GPIB controllers and NI embedded controllers with GPIB ports.
修改时间 01-16-2012 07:15 AM
我的程序每秒要从串口接收一个300字节的字符串,字符串包括帧头、数据段、校验,其中数据段有可以分为18个小段,每小段包含整数、浮点数(整数作为index,浮点数作为坐标值,为后续画图做准备),每段数据格式相同。
我的问题是:
1、用读串口程序得到的字符串显示为乱码,我该怎么把这些乱码转化成需要的整数和浮点数?这个问题困扰了我很久。
2、有什么方便的方法处理这类很多段数据同时做格式变换、提取的问题?
已解决! 转到解答。
01-17-2012 11:22 PM - 编辑日期 01-17-2012 11:24 PM
串口读进来的数值建议使用Hex格式,
方式一、使用“截取字符串.vi”进行字符串分段,对于数值型的分段数据使用“字符串/数值转换.vi”进行数值转换;
方式二、使用“字符串至字节数组转换.vi”,首先将字符串转换成数值,再使用数组处理模板中的vi进行数值抽取和分段,可以直接使用“数组子集.vi”得到数据段中的18个小段。
修改时间 01-19-2012 07:26 AM
可以参考一下这个贴子《LabVIEW串口通信详解》:
http://www.vihome.com.cn/bbs/forum.php?mod=viewthread&tid=19496
修改时间 01-24-2012 07:49 AM
thx,好帖啊,受益匪浅!
What do you need our team of experts to assist you with?
Thanks!
We'll be in touch soon!