Understanding of STM32 pointers

Publisher:数字探险家Latest update time:2017-11-05 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Definition of pointer:

I conclude that a pointer is a variable used to store the address of a variable of a certain type.

         For example, unit8 * p = 0x5555 5555

      Pointer p represents the variable used to store the address of the unit8 type variable

      *Pointers are variables

      *Pointers are variables that store addresses

      *A pointer is a variable that stores the address of a variable of a certain type

Baidu defines it as:

  Its value directly points to a value stored in another place in the computer's memory.

      In the above example, *p means the number stored at the address 0x5555 5555.

   

Pointer definition format: (data type + asterisk) + variable name    

       For example, the following two examples

       int * xxx

       YYY*xxx 

The meaning of pointer: At this time, the variable xxx becomes a pointer, which points to the first address of this data type.

Use of pointers:

                     typedef struct {

                                        __IO uint32_t AAA;

                                        __IO uint32_t BBB;

                                         __IO uint32_t CCC;

                                         __IO uint32_t DDD; } YYY; Let’s use a structure to illustrate

     YYY->AAA means the content stored in variable AAA

      Same thing with YYY.AAA, different ways of expressing it

Precautions:

In STM32, pointers are incremented by 4 bytes, for example, a pointer is 0x4001 2000

         No matter what number is in it, the next pointer is 0x4001 2004         

for example  

uint8 i[5] = {0X11,OX22,OX33,OX44,OX55}

&i = 0X4001 2000

Then i[0] = *0X4001 2000

       i[1] = *0X4001 2004

        i[2] = *0X4001 2008

         i[3] = *0X4001 200C

          i[4] = *0X4001 2010

0x4001 2001~0x4001 2003 are empty.     


Keywords:STM32 Reference address:Understanding of STM32 pointers

Previous article:STM32 clock division factor
Next article:STM32 interrupt understanding

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号