about the storageof variables (arm7 platform)
来源:互联网 发布:如何关闭qq游戏端口 编辑:程序博客网 时间:2024/04/30 15:04
In this screen, we can see the storage of variable NvSt_InfoB.u8_PumpDuty,
It is a byte value which has 8bits, I want to change its value in a routine, so I transfer its address into the routine, but the address used by the routine should be int32, so I force it address to int32 by do this: (INT32U*)&NvSt_InfoB.u8_PumpDuty.
All of the process done are still right, but later its problem coming. When I get the value which stored in the 32 bits address, it get the value of
u8_PumpDrv[0](0)
u16_PumpCycle(110:0x6E)
NvSt_InfoB.u8_PumpDuty(50:0x32)
So the value is 6E32 (28210)
Form doing this we can know two things
what the internal process of a forceful variable type change?
Answer: it will extend the higher address, and lower address store the low byte value.
So now we used little-ended.
Attention: you can forceful change a variable from Int8 to Int32
,but if you want to forceful change a pointer from Int8* to Int32* you need to know that the value store in the Int32* address maybe different, its value related with the 24bits value near the 8bits address, if these 24bits not 0 , you will get a wrong value finally!
强制类型转换在变量中可能好用,但在转化指针时就要注意了,这个转换后的地址取出的值可比转换前的长或者短,这就出问题了。
- about the storageof variables (arm7 platform)
- cmd operation about the environmental variables
- Storage about C variables
- Everything you always wanted to know about the processing of customer exit variables, but …
- Chapter 5 - More About Variables
- some tips about shell variables
- initialize the variables!!!
- THE HANDLER_READ_* STATUS VARIABLES
- the variables of python
- the class variables initlization
- about platform builder's build
- arm7
- Platform Builder: Using Environment Variables to Control Macro Definition
- start the JXTA platform.
- The FEniCS computing platform
- The Opensource about SIP
- About the AOSA
- About the class Crgn
- 条款11: 在operator= 中处理"自我赋值"
- sizeof 用法总结2
- POJ 1019 Number Sequence
- Launcher App:墙纸太大造成设置墙纸时产生“OutOfMemoryError: bitmap size exceeds VM budget”
- 数据库连接字符串大全 之 SQL服务器篇
- about the storageof variables (arm7 platform)
- 数据结构——关于KMP算法的效率分析
- SQL Server中, DateTime (日期)型操作的 SQL语法(转载)
- extjs 根据不同的操作动态替换panel上的tbar
- C++文件流操作(耦合)
- 打造极速MyEclipse
- .net按格式导出到.txt文件
- wave音频数据的格式
- 声音的播放——MCI的使用