The OP
Published on 2018-3-16 11:36
Only look at the author
This post is from 51mcu
Latest reply
Same question, after specifying an absolute address in C51 code, is there no way to assign an initial value?
If it is mixed programming, there used to be a way:
Specify the initialization data in the A51 assembly code:
CSEG AT 0x1000
DB 12H,34H,56H,78H
Then define the reference in the C51 code:
unsigned char code *pinfo =0x1000;
or code unsinged char pinfo[4] _at_ 0x1000;
Details
Published on 2023-1-27 10:42
| ||
|
||
2
Published on 2018-3-16 11:46
Only look at the author
| |
|
|
|
This post is from 51mcu
Comments | ||
|
||
|
4
Published on 2018-3-16 12:52
Only look at the author
This post is from 51mcu
Comments | ||
|
||
|
This post is from 51mcu
Comments
Do you mean you don't know the address of the variable? Or do you mean you don't know the value of the variable? Did you not specify the address of the variable when defining it? Like this: C51 provides a method to access absolute addresses: 1. Absolute macros: In a program, use "#include" to use the macros defined in it to
Details
Published on 2018-3-16 13:09
| ||
|
||
|
6
Published on 2018-3-16 13:09
Only look at the author
This post is from 51mcu
Comments
I mean how to assign a value to this variable, because what I saw in the document is "absolute variables cannot be initialized". But in MDK, using __attribute__ is OK: const int ID __attribute__((at(0xf200)))=0x10; I don't know if there is such a method in C51.
Details
Published on 2018-3-16 13:35
| ||
|
||
|
This post is from 51mcu
Comments | ||
|
||
|
8
Published on 2018-3-16 13:53
Only look at the author
This post is from 51mcu
| ||
|
||
|
9
Published on 2018-3-16 14:09
Only look at the author
This post is from 51mcu
| ||
|
||
|
This post is from 51mcu
| ||
|
||
|
xiaoshishuai
Currently offline
|
11
Published on 2018-3-16 16:08
Only look at the author
|
|
|
|
12
Published on 2018-3-16 20:53
Only look at the author
This post is from 51mcu
| ||
Personal signature爱电子,爱生活
|
||
|
This post is from 51mcu
| ||
|
||
|
14
Published on 2018-3-18 17:12
Only look at the author
| |
|
|
|
This post is from 51mcu
Comments | ||
|
||
|
16
Published on 2020-6-14 21:59
Only look at the author
This post is from 51mcu
| ||
|
||
|
hailidianzi
Currently offline
|
17
Published on 2023-1-27 10:42
Only look at the author
This post is from 51mcu
| |
|
||
|
论坛测评队员
EEWorld Datasheet Technical Support
EEWorld
subscription
account
EEWorld
service
account
Automotive
development
circle
About Us Customer Service Contact Information Datasheet Sitemap LatestNews
Room 1530, Zhongguancun MOOC Times Building, Block B, 18 Zhongguancun Street, Haidian District, Beijing 100190, China Tel:(010)82350740 Postcode:100190