How does STVD/COSMIC assign variables to specified addresses?

Publisher:静默思考Latest update time:2022-03-31 Source: eefocusKeywords:STVD  COSMIC  address Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

STM8 data @near @tiny defines
stm8 stvd under
which near equals xdata 51 and
tiny equals idata 51

Waveshare Electronics
http://www.waveshare.net/article/STM8-3-1-10.htm

How to assign a variable to a specific address

For example:
unsigned char temp_A@0x00; //define unsigned variable temp_A, and force its address to be 0x00
unsigned char temp_B@0x100; //define unsigned variable temp_B, and force its address to be 0x100
@tiny unsigned char temp_C; //define unsigned variable temp_C, and the compiler will automatically assign it an address in RAM with an address less than 0x100
@near unsigned char temp_D; //define unsigned variable temp_D, and the compiler will automatically assign it an address in RAM with an address greater than 0xFF You
can also use the pseudo-instruction "pragma" to define functions or variables in a specified section, for example:
#pragma section [name] //Define the uninitialized variables defined below into the .name section
Unsigned char data1;
Unsigned int data2;
…(any variables that need to be defined in the .name section)

#pragma section [] //Return to a normal section.
Note: The pragma pseudo-instruction can be used to locate functions, initialize variables, or uninitialize variables. These three are distinguished by different brackets.
(name): code
[name]: uninitialized variable
{name}: initialized variable


Keywords:STVD  COSMIC  address Reference address:How does STVD/COSMIC assign variables to specified addresses?

Previous article:STM8L RTC summary initialization and configuration
Next article:STM8L controls the temperature sensor DS18B20

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号