当前位置:网站首页>STM32 stores float data in flash
STM32 stores float data in flash
2022-06-25 12:39:00 【Who am I?】
Float Type numbers are used in computers 4 Byte store , follow IEEE-754 Format standard :
| Float data | The symbolic part (S) | The base part (M) | Index part (E) |
| explain | 0 Express positive 1 Negative | Use binary numbers to represent the actual value of this floating point number , The base part is actually occupied 24 bit A value of , But the highest bit is not stored , Share in storage 23 bit Science and Technology Law . | Occupy 8 bit Binary number of , The range of values that can be expressed is 0~255. Because the index can be positive or negative , So, in accordance with the IEEE Specify the calculated index minus 127 Is the real index ,float The real range of the type of index is -127 To 128. |
So the format is :SEEE EEEE EMMM MMMM MMMM MMMM MMMM MMMM
stay flash Medium access float There are two ways of data , The first way to use pointers
hold float Data stored in flash in
float data;
uint32_t temp;
temp = *(uint32_t *)&data;
Flash_WriteWordData(Flash_Save_Adder, temp);
from flash Read it out
Flash_ReadWordData(Flash_Write_Adder, temp);
data = *(float *)&temp;Second common body , Use the common body to share a section of memory for storage
float data;
union
{
float a;
uint32_t b;
}temp;
temp.a = data;
Flash_WriteWordData(Flash_Save_Adder, temp.b);
from flash Read it out
Flash_ReadWordData(Flash_Write_Adder, temp.b);
data = temp.a;
Link to the original text :https://blog.csdn.net/qq_41836400/article/details/121964054
边栏推荐
- The R language cartools package divides data, the scale function scales data, and the NaiveBayes function of e1071 package constructs a naive Bayesian model
- 初识CANOpen
- Install MySQL client
- Dynamic proxy
- GNSS receiver technology and application review
- The R language uses the follow up The plot function visualizes the longitudinal follow-up map of multiple ID (case) monitoring indicators, and uses stress The type parameter specifies the line type of
- Record a debugging when curl has no return value
- Go novice exploration road 2
- Learning notes 2022 overview | automatic graph machine learning, describing AGML methods, libraries and directions
- An example of using dynamic datalist
猜你喜欢

Happy shopkeeper source code -- Introduction to happy shopkeeper system development mode

Flutter common commands and problems

QT TCP UDP network communication < theory >

MySQL common interview questions

Zhangxiaobai's way of penetration (VIII) - detailed operation steps of SQL injection - Boolean blind injection of blind injection

ECSHOP video list_ ECSHOP uploading video, video classification, video list playing video function

初识CANOpen

Zhangxiaobai's road of penetration (VI) -- the idea and process of SQL injection and the concat series functions and information of SQL_ Schema database explanation

A commonly used statistical modeling method -- difference analysis

C program linking SQLSERVER database: instance failed
随机推荐
Thinkphp3 reinforcement i() function filter single quotation marks
(7) Pyqt5 tutorial -- > > window properties and basic controls (continuous update)
Explain AHP in human language (very detailed principle + simple tool implementation)
ECSHOP product attribute color specification size stock item No. automatic combination
Set the transparency of the picture to gradient from left to right
Dynamic proxy
yolov5训练使用的负样本图片
Gradle knowledge points
Qt5 multi thread operation implemented by object base class and use of movetothread method
三入职场!你可以从我身上学到这些(附毕业Vlog)
Hook technology
sudo: ulimit: command not found
Go defer little knowledge
Ten commandments of self-learning in machine learning
Why do we do autocorrelation analysis? Explain application scenarios and specific operations
初识CANOpen
Possible causes of wechat applet decryption failure
Penetration tool environment -- use of cknife Chinese kitchen knife
Ramda rejects objects with null and empty object values in the data
Laravel excel export