中文说明:应用背景MATLAB具有强大的数学运算能力,对于处理矩阵十分方便,在处理复杂数据是,可以用MATLAB搭建上位机,数学处理完成后用串口将数据发送下位机,例如32单片机。这其中来自传感器的浮点数传输是一个复杂的问题,作者通过不断试验,成功解决这一难题。关键技术串口每次收发是8位数据,浮点数在内存中的存储是32位,如何通过串口发送浮点数,需要应用数据转换,运算,实现起来比较麻烦,本文介绍如何将上位机运算所得的浮点数组发送到下位机中。
English Description:
Application backgroundMATLAB has a strong mathematical ability, the processing matrix is very convenient, in dealing with complex data is, you can use MATLAB to build up the host computer, after the completion of mathematical processing with the serial port to send data to the lower computer, such as 32 microcontroller. This is a complicated problem in which the floating point number transmission is a complex problem.Key TechnologySerial port is 8 bit data each time, the floating-point number in memory is 32 bits, how to transmit the floating point data through the serial port, need to use data conversion, computing, to achieve more trouble, this article describes how to use the upper computer and the floating-point array sent to the lower computer.