MCU Keywords Registers and Operators

Publisher:BlossomBeautyLatest update time:2015-12-30 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Appendix 1 Keywords in C51
Keywords use illustrate
auto Storage Type Description Used to describe local variables. The default value is
break Program Statements Exit the innermost loop
case Program Statements Selections in a Switch Statement
char Data Type Description Single-byte integer or character data
const Storage Type Description A constant value that cannot be changed during program execution
continue Program Statements Turn to the next cycle
default Program Statements Failed Selection in Switch Statement
do Program Statements Constructing a do..while loop structure
double Data Type Description Double-precision floating point numbers
else Program Statements Constructing if..else selection structure
enum Data Type Description enumerate
extern Storage Type Description Global variables declared in other program modules
flost Data Type Description Single-precision floating point numbers
for Program Statements Constructing a for loop structure
goto Program Statements Constructing a goto transfer structure
if Program Statements Constructing if..else selection structure
int Data Type Description Basic integers
long Data Type Description Long integer
register Storage Type Description Using variables stored inside the CPU
return Program Statements Function Returns
short Data Type Description Short integer
signed Data Type Description Signed number, the highest bit of binary data is the sign bit
sizeof Operators Counts the number of bytes of an expression or data type
static Storage Type Description Static variables
struct Data Type Description Structure type data
swicth Program Statements Constructing a switch selection structure
typedef Data Type Description Redefine data types
union Data Type Description Union type data
unsigned Data Type Description Unsigned data
void Data Type Description Untyped data
volatile Data Type Description This variable can be implicitly changed during program execution
while Program Statements Constructing while and do..while loop structures
Appendix 1-1 ANSIC standard keywords
Keywords use illustrate
bit Bit Scalar Declaration Declare a bit scalar or bit type function
sbit Bit Scalar Declaration Declare a bit-addressable variable
Sfr Special Function Register Declaration Declare a special function register
Sfr16 Special Function Register Declaration Declare a 16-bit special function register
data Memory Type Description Directly addressable internal data memory
bdata Memory Type Description Bit-addressable internal data memory
idata Memory Type Description Indirectly addressable internal data memory
pdata Memory Type Description Paged addressing of external data memory
xdata Memory Type Description External data storage
code Memory Type Description Program Memory
interrupt Interrupt function description Define an interrupt function
reentrant Reentrant Function Description Define a reentrant function
using Register Group Definition Define the chip's working registers
Appendix 1-2 Extended keywords of the C51 compiler
Appendix 2 AT89C51 special function register list (applicable to chips with the same architecture)
symbol address Notes
*ACC E0H accumulator
*B F0H Multiplication register
*PSW D0H Program status word
SP 81H Stack Pointer
DPL 82H Data memory pointer lower 8 bits
DPH 83H Data memory pointer upper 8 bits
*IE A8H Interrupt Enable Controller
*IP 8H Interrupt Priority Controller
*P0 80H Port 0
*P1 90H Port 1
*P2 A0H Port 2
*P3 B0H Port 3
PCON 87H Power control and baud rate selection
*SCON 98H Serial port controller
SBUF 99H Serial Data Buffer
*TCON 88H Timer control
TMOD 89H Timer mode selection
TL0 8A Timer 0 lower 8 bits
TL1 8BH Timer 1 lower 8 bits
TH0 8CH Timer 0 lower 8 bits
TH1 8DH Timer 1 high 8 bits
Special function registers marked with * are bit-addressable registers.
 
Appendix III Operator precedence and associativity
level category name Operators Combination
 
1
Cast, array,
structure, union
Type conversion ( )  
Right Associative
Subscript [ ]
Accessing structure or union members ->or.
 
 
 
 
2
logic Logical NOT !  
 
 
 
Left Associative
Font Bitwise inversion ~
Increment plus one ++
Reduction minus one --
pointer Get address &
Get content *
arithmetic Monocular subtraction -
Length calculation Length calculation sizeof
 
3
 
arithmetic
take *  
 
 
 
 
 
 
 
Right Associative
remove /
Taking the mold %
4 Arithmetic and pointer operations add +
reduce -
5 Font Shift Left <<
Shift Right >>
 
6
 
 
 
relation
greater or equal to >=
more than the >
Less than or equal to <=
Less than <
7 Equal to ==
not equal to !=
8  
Font
Bitwise AND &
9 Bitwise XOR ^
10 Bitwise OR |
11 logic Logical AND &&  
 
Left Associative
12 Logical OR ||
13 condition Conditional Operations ?:
14 Assignment Assignment =
Compound Assignment Op=
15 comma Comma operation , Right Associative

Reference address:MCU Keywords Registers and Operators

Previous article:msp430 MCU controls lcd1602 display C program
Next article:MCU long distance communication solution

Recommended ReadingLatest update time:2024-11-16 20:58

Keil simulation shows "Can not read register xx while CPU is running"
The program can be downloaded using jlink, but the following error always occurs during online simulation: ***JLink Error: Could not start CPU core. (ErrorCode: -1) **JLink Warning: CPU could not be halted ***JLink Error: Can not read register 15 (R15) while CPU is running ***JLink Error: Can not read register 16
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号