- 5
- 0
- 约7千字
- 约 4页
- 2020-10-30 发布于广东
- 举报
Technical Note TN 240
HCS12X – Accessing Data (advanced)
The present document describes how programmer can help the HCS12X compiler to generate the
more optimal code for data access. It will cover following topics:
Converting addresses (from logical to global, …)
Defining a variable with logical addresses and access global
Mixed addressing mode access to global variables
Note 1:
Information described in this technical note apply to SMALL (-Ms) and BANKED (-Mb)
Memory model. They do not apply to LARGE (-Ml) memory model.
Note 2:
We usually recommend using SMALL memory model for application with less than 32Kb
code and BANKED memory model otherwise. We do not recommend using LARGE memory
model.
Note 3:
Please refer to technical note TN238 for basic usage of data definition with various addressing
modes with and without banked memory.
Converting addresses (from Logical to Global, …)
There are runtime functions available to convert perform address conversion.
These functions are implemented in datapage.c and are used for instance when you are assigning a
__rptr pointer to a __far pointer.
1. For instance following code snippet (variables defined in nond extended addressing
area):
char data;
volatile char temp;
void func1(void) {
char *__far ptr;
char *__rptr rptr;
ptr = data;
rptr = ptr;
temp = *rptr;
}
2. Generates following code:
20: ptr = data;
0000 ce0000 [2] LDX #GLOBAL (data)
0003 c600 [1] LDAB #GLOBAL_PAGE (data)
21: rptr = ptr;
0005 160000 [4] JSR _CONV_GLOBAL_TO_LOGICAL
22:
您可能关注的文档
- BD220006_CP400s Connect one CPU Or CPUs Connect one CP400_CP400多个屏或多个控制器的连接.pdf
- BD220008_CP400 Control & Status Word_CP400控制字和状态字.pdf
- BD220010_CP400 Alarm & History Curves_CP400历史显示和警报显示.pdf
- bPlus条码秤操作培训.pdf
- CD220003_CP600 Communicate with AC500 & eCo PLC via Modbus RTU_CP600触摸屏和AC500以及eCo PLC Modbus RTU通讯.pdf
- CD220005_CP600 Ports Connection_CP600使用不同端口时的接线示意图.pdf
- CD220010_CP600 Runtime update_CP600运行环境更新.pdf
- CD220012_CP600 Alarm & History Curves_CP600历史曲线和报警条.pdf
- CMTest软件操作文档V2.pdf
- CoDeSys编程简介_53页_0.5M_高清版.pdf
最近下载
- 高中信息技术课程思政教育研究教学研究课题报告.docx
- 在公司2026年度党风廉政建设和反腐败工作会上的讲话.docx VIP
- 义务教育版(2024)六年级全一册信息科技 第22课 电梯门的开与关 课件.pptx VIP
- 2025中华护理学会团体标准——抗肿瘤药物静脉给药技术.pptx
- 水电站调速器系统计算书.doc VIP
- 2024—2025学年度人教版四年级语文下册课内阅读汇编30篇有答案.docx VIP
- 不良品处 理流程图.pdf VIP
- 义务教育版(2024)六年级全一册信息科技 第27课 定速巡航的控制 教学设计.docx VIP
- CWM500射频测试指导文档.pdf VIP
- 剑桥王牌教材第二版Think1 Unit2 单词默写.docx VIP
原创力文档

文档评论(0)